vanagon 0.11.0 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '07341460977d9693423374862c7a7793998b4008'
4
- data.tar.gz: 2a4a0e66a4fb11bdaa96d1d7fb3aa36d7908c541
3
+ metadata.gz: 05ba6ccedb21955cc83f9a9b4c879952f97ae2c7
4
+ data.tar.gz: c6220fff6a4a1c7ba457447686610988cc778e77
5
5
  SHA512:
6
- metadata.gz: f83beaff1911b965ff21bbaf64ab2087ae9cef078c77b6b5cf3050bde80d59843dbfacb0aef31feb6788241e450e255a06c0728708d3db2152d280bcfd360592
7
- data.tar.gz: 370382929914b3cdb7dd16d350c66777e5ea0ccf228507c5c5e0e2961f23a18f11f4dd6649f6118f590ec4e14d3c91f9cb9d4dda61784785bb6a3f18d39211d9
6
+ metadata.gz: 73104a5003d115067156eba3a0dbebd8b089917392773a7b4e3f3bafc3904fc9befff092c80d509d04a9f1e9ac81911afc1369bea440330b015a2f6828feac00
7
+ data.tar.gz: d1c60858b7d44b348fd13bdbbd4454b7c4b6c3e5549384d6011d285f7f0ee099a36135bddc03938d1eded39b271091750b83280ddb4bf4937c4f15d41faeef44
data/bin/build CHANGED
@@ -2,7 +2,7 @@
2
2
  load File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "vanagon.rb"))
3
3
 
4
4
  optparse = Vanagon::OptParse.new("#{File.basename(__FILE__)} <project-name> <platform-name> [<target>] [options]",
5
- [:workdir, :configdir, :engine, :preserve, :verbose, :skipcheck, :only_build, :"remote-workdir"])
5
+ %i(workdir configdir engine preserve verbose skipcheck only_build remote-workdir))
6
6
  options = optparse.parse! ARGV
7
7
 
8
8
  project = ARGV[0]
@@ -3,7 +3,7 @@ require 'json'
3
3
 
4
4
  load File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "vanagon.rb"))
5
5
 
6
- optparse = Vanagon::OptParse.new("#{File.basename(__FILE__)} <project-name> <platform-name> [options]", [:workdir, :configdir, :engine])
6
+ optparse = Vanagon::OptParse.new("#{File.basename(__FILE__)} <project-name> <platform-name> [options]", %i(workdir configdir engine))
7
7
  options = optparse.parse! ARGV
8
8
 
9
9
  project = ARGV[0]
data/bin/devkit CHANGED
@@ -2,7 +2,7 @@
2
2
  load File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "vanagon.rb"))
3
3
 
4
4
  optparse = Vanagon::OptParse.new("#{File.basename(__FILE__)} <project-name> <platform-name> [<component-name>...] [options]",
5
- [:workdir, :configdir, :target, :engine])
5
+ %i(workdir configdir target engine))
6
6
  options = optparse.parse! ARGV
7
7
 
8
8
  project = ARGV[0]
@@ -6,7 +6,7 @@ require 'vanagon/extensions/hashable'
6
6
 
7
7
  load File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "vanagon.rb"))
8
8
 
9
- optparse = Vanagon::OptParse.new("#{File.basename(__FILE__)} <project-name> <platform-name> [options]", [:workdir, :configdir, :engine])
9
+ optparse = Vanagon::OptParse.new("#{File.basename(__FILE__)} <project-name> <platform-name> [options]", %i(workdir configdir engine))
10
10
  options = optparse.parse! ARGV
11
11
 
12
12
  project = ARGV[0]
data/bin/render CHANGED
@@ -3,7 +3,7 @@ load File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "vanagon.rb
3
3
 
4
4
  optparse = Vanagon::OptParse.new(
5
5
  "#{File.basename(__FILE__)} <project-name> <platform-name> [options]",
6
- [:workdir, :configdir, :engine]
6
+ %i(workdir configdir engine)
7
7
  )
8
8
  options = optparse.parse! ARGV
9
9
 
@@ -204,7 +204,7 @@ class Vanagon
204
204
  extract_with << source.extract(platform.tar) if source.respond_to? :extract
205
205
 
206
206
  @cleanup_source = source.cleanup if source.respond_to?(:cleanup)
207
- @dirname = source.dirname
207
+ @dirname ||= source.dirname
208
208
 
209
209
  # Git based sources probably won't set the version, so we load it if it hasn't been already set
210
210
  if source.respond_to?(:version)
@@ -315,6 +315,29 @@ class Vanagon
315
315
  end
316
316
  end
317
317
 
318
+ # Set a source dir
319
+ #
320
+ # The build dir will be created when the source archive is unpacked. This
321
+ # should be used when the unpacked directory name does not match the
322
+ # source archive name.
323
+ #
324
+ # @example
325
+ # pkg.url "http://the-internet.com/a-silly-name-that-unpacks-into-not-this.tar.gz"
326
+ # pkg.dirname "really-cool-directory"
327
+ # pkg.configure { ["cmake .."] }
328
+ # pkg.build { ["make -j 3"] }
329
+ # pkg.install { ["make install"] }
330
+ #
331
+ # @param path [String] The build directory to use for building the project
332
+ def dirname(path)
333
+ if Pathname.new(path).relative?
334
+ @component.dirname = path
335
+ else
336
+ raise Vanagon::Error, "dirname should be a relative path, but '#{path}' looks to be absolute."
337
+ end
338
+ end
339
+
340
+
318
341
  # This will add a source to the project and put it in the workdir alongside the other sources
319
342
  #
320
343
  # @param uri [String] uri of the source
@@ -115,7 +115,6 @@ class Vanagon
115
115
  end
116
116
 
117
117
  target_file
118
-
119
118
  rescue Errno::ETIMEDOUT, Timeout::Error, Errno::EINVAL,
120
119
  Errno::EACCES, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse,
121
120
  Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
@@ -78,7 +78,6 @@ class Vanagon
78
78
  response = http.request(request)
79
79
 
80
80
  JSON.parse(response.body)
81
-
82
81
  rescue Errno::ETIMEDOUT, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET,
83
82
  EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError,
84
83
  Net::ProtocolError => e
@@ -1,32 +1,45 @@
1
1
  require 'vanagon/component/source/git'
2
2
 
3
3
  describe "Vanagon::Component::Source::Git" do
4
- let(:klass) { Vanagon::Component::Source::Git }
5
- let(:url) { 'git://github.com/puppetlabs/facter' }
6
- let(:ref_tag) { 'refs/tags/2.2.0' }
7
- let(:bad_sha) { 'FEEDBEEF' }
8
- let(:workdir) { ENV["TMPDIR"] || '/tmp' }
4
+ # before(:all) blocks are run once before all of the examples in a group
5
+ before :all do
6
+ @klass = Vanagon::Component::Source::Git
7
+ # This repo will not be cloned over the network
8
+ @url = 'git://github.com/puppetlabs/facter.git'
9
+ # This path will not be created on disk
10
+ @local_url = "file://#{Dir.tmpdir}/puppet-agent"
11
+ @ref_tag = 'refs/tags/2.2.0'
12
+ @workdir = nil
13
+ end
9
14
 
10
- after(:each) { %x(rm -rf #{workdir}/facter) }
15
+ # before(:each) blocks are run before each example
16
+ before :each do
17
+ allow(Git)
18
+ .to receive(:ls_remote)
19
+ .and_return(true)
20
+ end
11
21
 
12
22
  describe "#initialize" do
13
23
  it "raises error on initialization with an invalid repo" do
14
- # this test has a spelling error for the git repo
15
- # * this is on purpose *
16
- expect { klass.new("#{url}l.git", ref: ref_tag, workdir: workdir) }
17
- .to raise_error Vanagon::InvalidRepo
24
+ # Ensure initializing a repo fails without calling over the network
25
+ allow(Git)
26
+ .to receive(:ls_remote)
27
+ .and_return(false)
28
+
29
+ expect { @klass.new(@url, ref: @ref_tag, workdir: @workdir) }
30
+ .to raise_error(Vanagon::InvalidRepo)
18
31
  end
19
32
  end
20
33
 
21
34
  describe "#dirname" do
22
35
  it "returns the name of the repo" do
23
- git_source = klass.new(url, ref: ref_tag, workdir: workdir)
36
+ git_source = @klass.new(@local_url, ref: @ref_tag, workdir: @workdir)
24
37
  expect(git_source.dirname)
25
- .to eq('facter')
38
+ .to eq('puppet-agent')
26
39
  end
27
40
 
28
41
  it "returns the name of the repo and strips .git" do
29
- git_source = klass.new("#{url}.git", ref: ref_tag, workdir: workdir)
42
+ git_source = @klass.new(@url, ref: @ref_tag, workdir: @workdir)
30
43
  expect(git_source.dirname)
31
44
  .to eq('facter')
32
45
  end
@@ -34,16 +47,9 @@ describe "Vanagon::Component::Source::Git" do
34
47
 
35
48
  describe "#ref" do
36
49
  it "returns a default value of HEAD when no explicit Git reference is provided" do
37
- git_source = klass.new(url, workdir: workdir)
50
+ git_source = @klass.new(@url, workdir: @workdir)
38
51
  expect(git_source.ref)
39
52
  .to eq('HEAD')
40
53
  end
41
54
  end
42
-
43
- describe "#fetch" do
44
- it "raises an error on checkout failure with a bad SHA" do
45
- expect { klass.new("#{url}", ref: bad_sha, workdir: workdir).fetch }
46
- .to raise_error Vanagon::CheckoutFailed
47
- end
48
- end
49
55
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vanagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-22 00:00:00.000000000 Z
11
+ date: 2017-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -237,42 +237,42 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
237
  version: '0'
238
238
  requirements: []
239
239
  rubyforge_project:
240
- rubygems_version: 2.6.11
240
+ rubygems_version: 2.6.8
241
241
  signing_key:
242
242
  specification_version: 3
243
243
  summary: All of your packages will fit into this van with this one simple trick.
244
244
  test_files:
245
- - spec/lib/makefile_spec.rb
246
245
  - spec/lib/vanagon/common/pathname_spec.rb
247
246
  - spec/lib/vanagon/common/user_spec.rb
248
- - spec/lib/vanagon/component/dsl_spec.rb
249
- - spec/lib/vanagon/component/rules_spec.rb
250
- - spec/lib/vanagon/component/source/git_spec.rb
251
247
  - spec/lib/vanagon/component/source/http_spec.rb
252
248
  - spec/lib/vanagon/component/source/local_spec.rb
249
+ - spec/lib/vanagon/component/source/git_spec.rb
253
250
  - spec/lib/vanagon/component/source_spec.rb
254
- - spec/lib/vanagon/component_spec.rb
255
- - spec/lib/vanagon/driver_spec.rb
256
- - spec/lib/vanagon/engine/always_be_scheduling_spec.rb
251
+ - spec/lib/vanagon/component/dsl_spec.rb
252
+ - spec/lib/vanagon/component/rules_spec.rb
257
253
  - spec/lib/vanagon/engine/base_spec.rb
254
+ - spec/lib/vanagon/engine/always_be_scheduling_spec.rb
258
255
  - spec/lib/vanagon/engine/docker_spec.rb
259
256
  - spec/lib/vanagon/engine/ec2_spec.rb
260
257
  - spec/lib/vanagon/engine/hardware_spec.rb
261
258
  - spec/lib/vanagon/engine/local_spec.rb
262
259
  - spec/lib/vanagon/engine/pooler_spec.rb
263
- - spec/lib/vanagon/environment_spec.rb
264
- - spec/lib/vanagon/extensions/ostruct/json_spec.rb
265
- - spec/lib/vanagon/extensions/set/json_spec.rb
266
- - spec/lib/vanagon/extensions/string_spec.rb
267
- - spec/lib/vanagon/optparse_spec.rb
260
+ - spec/lib/vanagon/platform/solaris_11_spec.rb
268
261
  - spec/lib/vanagon/platform/deb_spec.rb
269
262
  - spec/lib/vanagon/platform/dsl_spec.rb
270
263
  - spec/lib/vanagon/platform/rpm/aix_spec.rb
271
264
  - spec/lib/vanagon/platform/rpm_spec.rb
272
- - spec/lib/vanagon/platform/solaris_11_spec.rb
273
265
  - spec/lib/vanagon/platform/windows_spec.rb
274
- - spec/lib/vanagon/platform_spec.rb
275
266
  - spec/lib/vanagon/project/dsl_spec.rb
267
+ - spec/lib/vanagon/extensions/ostruct/json_spec.rb
268
+ - spec/lib/vanagon/extensions/set/json_spec.rb
269
+ - spec/lib/vanagon/extensions/string_spec.rb
270
+ - spec/lib/vanagon/optparse_spec.rb
271
+ - spec/lib/vanagon/platform_spec.rb
276
272
  - spec/lib/vanagon/project_spec.rb
277
273
  - spec/lib/vanagon/utilities/shell_utilities_spec.rb
278
274
  - spec/lib/vanagon/utilities_spec.rb
275
+ - spec/lib/vanagon/component_spec.rb
276
+ - spec/lib/vanagon/driver_spec.rb
277
+ - spec/lib/vanagon/environment_spec.rb
278
+ - spec/lib/makefile_spec.rb