vanagon 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/git/basic_submodules.rb +53 -0
  3. data/lib/vanagon/component.rb +19 -13
  4. data/lib/vanagon/component/dsl.rb +6 -5
  5. data/lib/vanagon/component/source.rb +80 -53
  6. data/lib/vanagon/component/source/git.rb +129 -20
  7. data/lib/vanagon/component/source/http.rb +41 -73
  8. data/lib/vanagon/component/source/local.rb +105 -62
  9. data/lib/vanagon/platform/deb.rb +8 -0
  10. data/lib/vanagon/platform/rpm.rb +4 -0
  11. data/lib/vanagon/project/dsl.rb +3 -1
  12. data/lib/vanagon/utilities.rb +11 -54
  13. data/spec/fixtures/files/fake_file_ext.7z +0 -0
  14. data/spec/fixtures/files/fake_file_ext.bz +0 -0
  15. data/spec/fixtures/files/fake_file_ext.bz2 +0 -0
  16. data/spec/fixtures/files/fake_file_ext.cpio +0 -0
  17. data/spec/fixtures/files/fake_file_ext.gz +0 -0
  18. data/spec/fixtures/files/fake_file_ext.rar +0 -0
  19. data/spec/fixtures/files/fake_file_ext.tar +0 -0
  20. data/spec/fixtures/files/fake_file_ext.tar.bz2 +0 -0
  21. data/spec/fixtures/files/fake_file_ext.tar.xz +0 -0
  22. data/spec/fixtures/files/fake_file_ext.tbz +0 -0
  23. data/spec/fixtures/files/fake_file_ext.tbz2 +0 -0
  24. data/spec/fixtures/files/fake_file_ext.txz +0 -0
  25. data/spec/fixtures/files/fake_file_ext.xz +0 -0
  26. data/spec/fixtures/files/fake_file_ext.z +0 -0
  27. data/spec/lib/vanagon/component/source/git_spec.rb +25 -17
  28. data/spec/lib/vanagon/component/source/http_spec.rb +2 -24
  29. data/spec/lib/vanagon/component/source/{localsource_spec.rb → local_spec.rb} +8 -8
  30. data/spec/lib/vanagon/component/source_spec.rb +150 -67
  31. data/spec/lib/vanagon/platform_spec.rb +40 -21
  32. data/spec/lib/vanagon/project/dsl_spec.rb +28 -3
  33. data/spec/lib/vanagon/utilities_spec.rb +0 -44
  34. metadata +28 -13
@@ -6,14 +6,29 @@ describe 'Vanagon::Project::DSL' do
6
6
  let (:project_block) {
7
7
  "project 'test-fixture' do |proj|
8
8
  end" }
9
- let (:configdir) { '/a/b/c' }
9
+ let(:configdir) { '/a/b/c' }
10
10
 
11
11
  describe '#version_from_git' do
12
12
  it 'sets the version based on the git describe' do
13
13
  expect(Vanagon::Driver).to receive(:configdir).and_return(configdir)
14
14
  proj = Vanagon::Project::DSL.new('test-fixture', {})
15
15
  proj.instance_eval(project_block)
16
- expect(Vanagon::Utilities).to receive(:git_version).with(File.expand_path('..', configdir)).and_return('1.2.3-1234')
16
+
17
+ # Lying is bad. You shouldn't lie. But sometimes when you're
18
+ # working with gross abstractions piled into the shape of
19
+ # an indescribable cyclopean obelisk, you might have to lie
20
+ # a little bit. Instead of trying to mock an entire Git instance,
21
+ # we'll just instantiate a Double and allow it to receive calls
22
+ # to .describe like it was a valid Git instance.
23
+ repo = double("repo")
24
+ expect(::Git)
25
+ .to receive(:open)
26
+ .and_return(repo)
27
+
28
+ allow(repo)
29
+ .to receive(:describe)
30
+ .and_return('1.2.3-1234')
31
+
17
32
  proj.version_from_git
18
33
  expect(proj._project.version).to eq('1.2.3.1234')
19
34
  end
@@ -21,7 +36,17 @@ end" }
21
36
  expect(Vanagon::Driver).to receive(:configdir).and_return(configdir)
22
37
  proj = Vanagon::Project::DSL.new('test-fixture', {})
23
38
  proj.instance_eval(project_block)
24
- expect(Vanagon::Utilities).to receive(:git_version).with(File.expand_path('..', configdir)).and_return('1.2.3---1234')
39
+
40
+ # See previous description of "indescribable cyclopean obelisk"
41
+ repo = double("repo")
42
+ expect(::Git)
43
+ .to receive(:open)
44
+ .and_return(repo)
45
+
46
+ expect(repo)
47
+ .to receive(:describe)
48
+ .and_return('1.2.3---1234')
49
+
25
50
  proj.version_from_git
26
51
  expect(proj._project.version).to eq('1.2.3.1234')
27
52
  end
@@ -52,50 +52,6 @@ describe "Vanagon::Utilities" do
52
52
  end
53
53
  end
54
54
 
55
- describe "#is_git_repo?" do
56
- let(:dir) { Dir.mktmpdir }
57
- after(:each) { FileUtils.rm_rf(dir) }
58
-
59
- it "returns false if not in a git repo" do
60
- expect(Vanagon::Utilities.is_git_repo?(dir)).to be(false)
61
- end
62
-
63
- it "returns true if in a git repo" do
64
- Dir.chdir(dir) do
65
- Vanagon::Utilities.git('init')
66
- end
67
-
68
- expect(Vanagon::Utilities.is_git_repo?(dir)).to be(true)
69
- end
70
- end
71
-
72
- describe "#git_version" do
73
- let(:dir) { Dir.mktmpdir }
74
- after(:each) { FileUtils.rm_rf(dir) }
75
-
76
- it "raises an exception if not in a git repo" do
77
- expect { Vanagon::Utilities.git_version(dir) }.to raise_error(RuntimeError)
78
- end
79
-
80
- it "returns a git tag based version if there are tags in the repo" do
81
- Dir.chdir(dir) do
82
- Vanagon::Utilities.git('init')
83
- Vanagon::Utilities.git('commit --allow-empty -m "testing this ish"')
84
- Vanagon::Utilities.git('tag 1.2.3')
85
- end
86
-
87
- expect(Vanagon::Utilities.git_version(dir)).to eq('1.2.3')
88
- end
89
-
90
- it "returns empty string if there are no tags" do
91
- Dir.chdir(dir) do
92
- Vanagon::Utilities.git('init')
93
- end
94
-
95
- expect(Vanagon::Utilities.git_version(dir)).to be_empty
96
- end
97
- end
98
-
99
55
  describe '#ssh_command' do
100
56
  it 'adds the correct flags to the command if VANAGON_SSH_KEY is set' do
101
57
  expect(Vanagon::Utilities).to receive(:find_program_on_path).with('ssh').and_return('/tmp/ssh')
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vanagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-01 00:00:00.000000000 Z
11
+ date: 2016-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rspec
14
+ name: git
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
20
- type: :development
19
+ version: 1.3.0
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.0'
26
+ version: 1.3.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: yard
28
+ name: fustigit
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.8'
34
- type: :development
33
+ version: 0.1.3
34
+ type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.8'
40
+ version: 0.1.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: lock_manager
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -73,6 +73,7 @@ files:
73
73
  - bin/inspect
74
74
  - bin/repo
75
75
  - bin/ship
76
+ - lib/git/basic_submodules.rb
76
77
  - lib/makefile.rb
77
78
  - lib/vanagon.rb
78
79
  - lib/vanagon/common.rb
@@ -149,8 +150,22 @@ files:
149
150
  - spec/fixtures/component/test-fixture.json
150
151
  - spec/fixtures/files/fake_dir.tar.gz
151
152
  - spec/fixtures/files/fake_file.txt
153
+ - spec/fixtures/files/fake_file_ext.7z
154
+ - spec/fixtures/files/fake_file_ext.bz
155
+ - spec/fixtures/files/fake_file_ext.bz2
156
+ - spec/fixtures/files/fake_file_ext.cpio
157
+ - spec/fixtures/files/fake_file_ext.gz
158
+ - spec/fixtures/files/fake_file_ext.rar
159
+ - spec/fixtures/files/fake_file_ext.tar
160
+ - spec/fixtures/files/fake_file_ext.tar.bz2
152
161
  - spec/fixtures/files/fake_file_ext.tar.gz
162
+ - spec/fixtures/files/fake_file_ext.tar.xz
163
+ - spec/fixtures/files/fake_file_ext.tbz
164
+ - spec/fixtures/files/fake_file_ext.tbz2
153
165
  - spec/fixtures/files/fake_file_ext.tgz
166
+ - spec/fixtures/files/fake_file_ext.txz
167
+ - spec/fixtures/files/fake_file_ext.xz
168
+ - spec/fixtures/files/fake_file_ext.z
154
169
  - spec/fixtures/files/fake_file_ext.zip
155
170
  - spec/fixtures/wix/resources/windows/wix/file-1.wxs
156
171
  - spec/fixtures/wix/resources/windows/wix/file-2.wxs
@@ -168,7 +183,7 @@ files:
168
183
  - spec/lib/vanagon/component/rules_spec.rb
169
184
  - spec/lib/vanagon/component/source/git_spec.rb
170
185
  - spec/lib/vanagon/component/source/http_spec.rb
171
- - spec/lib/vanagon/component/source/localsource_spec.rb
186
+ - spec/lib/vanagon/component/source/local_spec.rb
172
187
  - spec/lib/vanagon/component/source_spec.rb
173
188
  - spec/lib/vanagon/component_spec.rb
174
189
  - spec/lib/vanagon/driver_spec.rb
@@ -214,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
229
  version: '0'
215
230
  requirements: []
216
231
  rubyforge_project:
217
- rubygems_version: 2.4.6
232
+ rubygems_version: 2.2.5
218
233
  signing_key:
219
234
  specification_version: 3
220
235
  summary: All of your packages will fit into this van with this one simple trick.
@@ -226,7 +241,7 @@ test_files:
226
241
  - spec/lib/vanagon/component/rules_spec.rb
227
242
  - spec/lib/vanagon/component/source/git_spec.rb
228
243
  - spec/lib/vanagon/component/source/http_spec.rb
229
- - spec/lib/vanagon/component/source/localsource_spec.rb
244
+ - spec/lib/vanagon/component/source/local_spec.rb
230
245
  - spec/lib/vanagon/component/source_spec.rb
231
246
  - spec/lib/vanagon/component_spec.rb
232
247
  - spec/lib/vanagon/driver_spec.rb