vagrant-adam 0.3.0a → 0.4.0a

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: ac99722c8b167642e4b9d0628aa8c84412127bf2
4
- data.tar.gz: 08afa21f86b4136fb2d155575089b002704341e1
3
+ metadata.gz: 05938e38f2d43c0e8c7dc8f65023b43933c2a6f3
4
+ data.tar.gz: 08a2a3e40f847c6ecbb61a3ea79dfdc243920eb9
5
5
  SHA512:
6
- metadata.gz: c9d5f4782cf60436927cdc7f8e9773140ebf49342a1e490a9cca1b073048e2e400293061eb3edd02e9306cb1c6087a2dcc16293567cb8ad397a76008abcfd643
7
- data.tar.gz: 82e3d13591794168b18465b2f84c883923f0dba38f7499b8d25827e44504a164cbf361d7fe3dc2eb0e9652c0feba43d04dee93089abb13ba1300c1818c471369
6
+ metadata.gz: a0141523a6c04ef07a10b88c1628d21f3678660ec4580e5c91d3300f4781b7b2588b129d5f15e85288e41651e1be6de4a366963aee5b5c7f8a3b10f76a219b83
7
+ data.tar.gz: a322a1a794a4c602a0e981243b0db423bfb7c785c394bd1bc95bb80ea375ec4165586f770929dc288696a12aa24e5d3c7c6d6f2036d25eb83b866089c63f72db
@@ -23,3 +23,8 @@ Feature: vagrant-adam local file
23
23
  And a shell file 'hello_world_local_file.sh' with content of "echo 'Hello World!'"
24
24
  And the Vagrant box is already running
25
25
  Then the provision output should contain "Hello World"
26
+
27
+ Scenario:
28
+ Given a Vagrantfile with no adam.provision_url
29
+ When I run `bundle exec vagrant up`
30
+ Then the exit status should not be 1
@@ -10,11 +10,17 @@ Feature: vagrant-adam validations
10
10
  Then the exit status should not be 0
11
11
  And the output should contain "The requested URL returned error: 404 Not Found"
12
12
 
13
+ Scenario: raises error if url of file doesnt exist
14
+ Given a Vagrantfile with a adam.provision_url of "https://@@@@@fakeurl...."
15
+ When I run `bundle exec vagrant up`
16
+ Then the exit status should not be 0
17
+ And the output should contain "'https://@@@@@fakeurl....' is not a valid URL"
18
+
13
19
  Scenario: raises error if path of file doesnt exist
14
20
  Given a Vagrantfile with a adam.provision_url of "/tmp/foo_bar_baz.sh"
15
21
  When I run `bundle exec vagrant up`
16
22
  Then the exit status should not be 0
17
- And the output should contain "Couldn't open file /tmp/foo_bar_baz.sh"
23
+ And the output should contain "File '/tmp/foo_bar_baz.sh' could not be found."
18
24
 
19
25
  Scenario:
20
26
  Given a Vagrantfile with no adam.provision_url
@@ -20,9 +20,17 @@ module VagrantPlugins
20
20
 
21
21
  def call(env)
22
22
  @app.call(env)
23
- fetch_or_create_pre_provision_script(env)
24
- run_provision_script(env)
25
- recover(env)
23
+
24
+ return unless @machine.communicate.ready? && provision_enabled?(env)
25
+
26
+ # Perform delayed validation
27
+ @machine.config.adam.validate!(@machine)
28
+
29
+ unless @provision_script.nil?
30
+ fetch_or_create_pre_provision_script(env)
31
+ run_provision_script(env)
32
+ recover(env)
33
+ end
26
34
  end
27
35
 
28
36
  private
@@ -21,10 +21,18 @@ module VagrantPlugins
21
21
 
22
22
  unless @provision_url.nil?
23
23
  unless (valid_uri? @provision_url) || (valid_file? @provision_url)
24
- msg = <<-EOH
25
- '#{ @provision_url }' is not a valid filepath or URL
26
- EOH
27
- errors << msg
24
+ unless (valid_uri? @provision_url)
25
+ msg = <<-EOH
26
+ '#{ @provision_url }' is not a valid URL
27
+ EOH
28
+ errors << msg
29
+ end
30
+ unless (valid_file? @provision_url)
31
+ msg = <<-EOH
32
+ File '#{ @provision_url }' could not be found.
33
+ EOH
34
+ errors << msg
35
+ end
28
36
  end
29
37
  end
30
38
 
@@ -1,6 +1,6 @@
1
1
  module VagrantPlugins
2
2
  # Define version for Gem here
3
3
  module Adam
4
- VERSION = '0.3.0a'
4
+ VERSION = '0.4.0a'
5
5
  end
6
6
  end
@@ -13,7 +13,10 @@ describe VagrantPlugins::Adam::Action::PreProvisionScript do
13
13
  double('machine').tap { |machine| machine.stub(config: config, communicate: communicate) }
14
14
  end
15
15
  let(:communicate) do
16
- double('communicate').tap { |machine| machine.stub(upload: upload) }
16
+ double('communicate').tap { |communicate| communicate.stub(upload: upload, ready?: ready?) }
17
+ end
18
+ let(:ready?) do
19
+ double('ready?')
17
20
  end
18
21
  let(:upload) do
19
22
  double('upload')
@@ -25,7 +28,7 @@ describe VagrantPlugins::Adam::Action::PreProvisionScript do
25
28
  double('vm').tap { |config| config.stub(guest: 'guest') }
26
29
  end
27
30
  let(:adam) do
28
- double('adam').tap { |config| config.stub(:finalize! => true, :provision_url => '/tmp/config.sh') }
31
+ double('adam').tap { |config| config.stub(:finalize! => true, :provision_url => '/tmp/config.sh', :validate! => true,) }
29
32
  end
30
33
 
31
34
  describe '#initialize' do
@@ -34,7 +37,7 @@ describe VagrantPlugins::Adam::Action::PreProvisionScript do
34
37
  end
35
38
 
36
39
  describe '#call' do
37
- context 'when called' do
40
+ context 'when called with config set' do
38
41
  subject(:pre_provision_script) { described_class.new(app, env) }
39
42
  it 'should fetch the script, then run it' do
40
43
  pre_provision_script.should_receive(:fetch_or_create_pre_provision_script).with(env)
@@ -42,6 +45,18 @@ describe VagrantPlugins::Adam::Action::PreProvisionScript do
42
45
  pre_provision_script.call(env)
43
46
  end
44
47
  end
48
+
49
+ context 'when called without config set' do
50
+ subject(:pre_provision_script) { described_class.new(app, env) }
51
+ let(:adam) do
52
+ double('adam').tap { |config| config.stub(:finalize! => true, :provision_url => nil, :validate! => true) }
53
+ end
54
+ it 'exit early' do
55
+ pre_provision_script.should_not_receive(:fetch_or_create_pre_provision_script).with(env)
56
+ pre_provision_script.should_not_receive(:run_provision_script).with(env)
57
+ pre_provision_script.call(env)
58
+ end
59
+ end
45
60
  end
46
61
 
47
62
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-adam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0a
4
+ version: 0.4.0a
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Souter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-17 00:00:00.000000000 Z
11
+ date: 2014-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler