vagrant-omnibus 1.4.1 → 1.5.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.
@@ -1,101 +1,121 @@
1
- # We have to use `require_relative` until RSpec 2.14.0. As non-standard RSpec
2
- # default paths are not on the $LOAD_PATH.
3
- #
4
- # More info here:
5
- # https://github.com/rspec/rspec-core/pull/831
6
- #
7
- require_relative '../spec_helper'
8
-
9
- # rubocop:disable LineLength
10
-
11
- describe VagrantPlugins::Omnibus::Config do
12
- let(:machine) { double('machine') }
13
- let(:instance) { described_class.new }
14
-
15
- subject(:config) do
16
- instance.tap do |o|
17
- o.chef_version = chef_version if defined?(chef_version)
18
- o.install_url = install_url if defined?(install_url)
19
- o.cache_packages = cache_packages if defined?(cache_packages)
20
- o.finalize!
21
- end
22
- end
23
-
24
- describe 'defaults' do
25
- its(:chef_version) { should be_nil }
26
- its(:install_url) { should be_nil }
27
- its(:cache_packages) { should be_true }
28
- end
29
-
30
- describe 'resolving `:latest` to a real Chef version' do
31
- let(:chef_version) { :latest }
32
- its(:chef_version) { should be_a(String) }
33
- its(:chef_version) { should match(/\d*\.\d*\.\d*/) }
34
- end
35
-
36
- describe 'setting a custom `install_url`' do
37
- let(:install_url) { 'http://some_path.com/install.sh' }
38
- its(:install_url) { should eq('http://some_path.com/install.sh') }
39
- end
40
-
41
- describe 'the `cache_packages` config option behaves truthy' do
42
- [true, 'something', :cachier].each do |obj|
43
- describe "when `#{obj}` (#{obj.class})" do
44
- let(:cache_packages) { obj }
45
- its(:cache_packages) { should be_true }
46
- end
47
- end
48
- [nil, false].each do |obj|
49
- describe "when `#{obj}` (#{obj.class})" do
50
- let(:cache_packages) { obj }
51
- its(:cache_packages) { should be_false }
52
- end
53
- end
54
- end
55
-
56
- describe 'validate' do
57
- it 'should be no-op' do
58
- expect(subject.validate(machine)).to eq('VagrantPlugins::Omnibus::Config' => [])
59
- end
60
- end
61
-
62
- describe '#validate!' do
63
- describe 'chef_version validation' do
64
- {
65
- '11.4.0' => {
66
- description: 'valid Chef version string',
67
- valid: true
68
- },
69
- '10.99.99' => {
70
- description: 'invalid Chef version string',
71
- valid: false
72
- },
73
- 'FUFUFU' => {
74
- description: 'invalid RubyGems version string',
75
- valid: false
76
- }
77
- }.each_pair do |version_string, opts|
78
- context "#{opts[:description]}: #{version_string}" do
79
- let(:chef_version) { version_string }
80
- if opts[:valid]
81
- it 'passes' do
82
- expect { subject.validate!(machine) }.to_not raise_error
83
- end
84
- else
85
- it 'fails' do
86
- expect { subject.validate!(machine) }.to raise_error(Vagrant::Errors::ConfigInvalid)
87
- end
88
- end
89
- end
90
- end
91
- end # describe chef_version
92
-
93
- describe 'not specified chef_version validation' do
94
- it 'passes' do
95
- Gem::DependencyInstaller.any_instance.stub(:find_gems_with_sources).and_return([])
96
- expect { subject.validate!(machine) }.to_not raise_error
97
- end
98
- end # describe not specified chef_version validation
99
-
100
- end # describe #validate
101
- end
1
+ require "spec_helper"
2
+
3
+ # rubocop:disable LineLength
4
+
5
+ describe VagrantPlugins::Omnibus::Config do
6
+ let(:machine) { double("machine") }
7
+ let(:instance) { described_class.new }
8
+
9
+ subject(:config) do
10
+ instance.tap do |o|
11
+ o.chef_version = chef_version if defined?(chef_version)
12
+ o.install_url = install_url if defined?(install_url)
13
+ o.cache_packages = cache_packages if defined?(cache_packages)
14
+ o.finalize!
15
+ end
16
+ end
17
+
18
+ context "default values" do
19
+ describe "#chef_version" do
20
+ subject { super().chef_version }
21
+ it { is_expected.to be_nil }
22
+ end
23
+
24
+ describe "#install_url" do
25
+ subject { super().install_url }
26
+ it { is_expected.to be_nil }
27
+ end
28
+
29
+ describe "#cache_packages" do
30
+ subject { super().cache_packages }
31
+ it { is_expected.to be_truthy }
32
+ end
33
+ end
34
+
35
+ describe "no longer resolves :latest to a Chef version" do
36
+ let(:chef_version) { :latest }
37
+
38
+ describe "#chef_version" do
39
+ subject { super().chef_version }
40
+ it { is_expected.to eql(:latest) }
41
+ end
42
+ end
43
+
44
+ describe "setting a custom `install_url`" do
45
+ let(:install_url) { "http://some_path.com/install.sh" }
46
+
47
+ describe "#install_url" do
48
+ subject { super().install_url }
49
+ it { is_expected.to eq("http://some_path.com/install.sh") }
50
+ end
51
+ end
52
+
53
+ describe "the `cache_packages` config option behaves truthy" do
54
+ [true, "something", :cachier].each do |obj|
55
+ describe "when `#{obj}` (#{obj.class})" do
56
+ let(:cache_packages) { obj }
57
+
58
+ describe "#cache_packages" do
59
+ subject { super().cache_packages }
60
+ it { is_expected.to be_truthy }
61
+ end
62
+ end
63
+ end
64
+ [nil, false].each do |obj|
65
+ describe "when `#{obj}` (#{obj.class})" do
66
+ let(:cache_packages) { obj }
67
+
68
+ describe "#cache_packages" do
69
+ subject { super().cache_packages }
70
+ it { is_expected.to be_falsey }
71
+ end
72
+ end
73
+ end
74
+ end
75
+
76
+ describe "validate" do
77
+ it "is a be no-op" do
78
+ expect(subject.validate(machine)).to eq("VagrantPlugins::Omnibus::Config" => [])
79
+ end
80
+ end
81
+
82
+ describe "#validate!" do
83
+ describe "chef_version validation" do
84
+ {
85
+ "11.4.0" => {
86
+ description: "valid Chef version string",
87
+ valid: true,
88
+ },
89
+ "10.99.99" => {
90
+ description: "invalid Chef version string",
91
+ valid: false,
92
+ },
93
+ "FUFUFU" => {
94
+ description: "invalid RubyGems version string",
95
+ valid: false,
96
+ },
97
+ }.each_pair do |version_string, opts|
98
+ context "#{opts[:description]}: #{version_string}" do
99
+ let(:chef_version) { version_string }
100
+ if opts[:valid]
101
+ it "passes" do
102
+ expect { subject.validate!(machine) }.to_not raise_error
103
+ end
104
+ else
105
+ it "fails" do
106
+ expect { subject.validate!(machine) }.to raise_error(Vagrant::Errors::ConfigInvalid)
107
+ end
108
+ end
109
+ end
110
+ end
111
+ end # describe chef_version
112
+
113
+ describe "not specified chef_version validation" do
114
+ it "passes" do
115
+ allow_any_instance_of(Gem::DependencyInstaller).to receive(:find_gems_with_sources).and_return([])
116
+ expect { subject.validate!(machine) }.to_not raise_error
117
+ end
118
+ end # describe not specified chef_version validation
119
+
120
+ end # describe #validate
121
+ end
@@ -0,0 +1,83 @@
1
+ require "spec_helper"
2
+
3
+ describe VagrantPlugins::Omnibus::Plugin do
4
+
5
+ context "action hooks" do
6
+ let(:hook) { double(append: true, prepend: true) }
7
+ let(:fake_class) { Class.new }
8
+
9
+ it "should hook InstallChef before Provision" do
10
+ stub_const("VagrantPlugins::Omnibus::Action::InstallChef", fake_class)
11
+ hook_proc = described_class.components.action_hooks[:__all_actions__][0]
12
+ hook = double
13
+ expect(hook).to receive(:after).with(Vagrant::Action::Builtin::Provision, VagrantPlugins::Omnibus::Action::InstallChef)
14
+ hook_proc.call(hook)
15
+ end
16
+ end
17
+
18
+ it "should define a config of type :omnibus" do
19
+ default_config = described_class.components.configs[:top].to_hash[:omnibus]
20
+ expect(default_config).to be(VagrantPlugins::Omnibus::Config)
21
+ end
22
+
23
+ describe ".check_vagrant_version" do
24
+ before :each do
25
+ stub_const("Vagrant::VERSION", "1.2.3")
26
+ end
27
+
28
+ it "accepts single String argument" do
29
+ expect(described_class.check_vagrant_version("~> 1.1")).to be_truthy
30
+ expect(described_class.check_vagrant_version("1.2")).to be_falsey
31
+ end
32
+
33
+ it "accepts an Array argument" do
34
+ expect(described_class.check_vagrant_version([">= 1.1", "< 1.3.0.beta"])).to be_truthy
35
+ expect(described_class.check_vagrant_version([">= 1.3"])).to be_falsey
36
+ end
37
+
38
+ it "accepts multiple arguments" do
39
+ expect(described_class.check_vagrant_version(">= 1.0", "<= 1.3")).to be_truthy
40
+ expect(described_class.check_vagrant_version("~> 1.2", ">= 1.2.5")).to be_falsey
41
+ end
42
+ end
43
+
44
+ describe ".check_vagrant_version!" do
45
+ subject { described_class.check_vagrant_version! }
46
+ let(:requirement) { ">= 1.1.0" }
47
+ let(:err_msg) { /requires Vagrant version #{Regexp.escape(requirement.inspect)}/ }
48
+
49
+ before :each do
50
+ stub_const(
51
+ "VagrantPlugins::ProxyConf::Plugin::VAGRANT_VERSION_REQUIREMENT",
52
+ requirement
53
+ )
54
+ stub_const("Vagrant::VERSION", vagrant_version)
55
+ allow($stderr).to receive(:puts)
56
+ end
57
+
58
+ context "on too old Vagrant version" do
59
+ let(:vagrant_version) { "1.0.9" }
60
+ it "raises error" do
61
+ expect { subject }.to raise_error(err_msg)
62
+ end
63
+ it "warns as stderr" do
64
+ expect($stderr).to receive(:puts).with(err_msg)
65
+ expect { subject }.to raise_error(err_msg)
66
+ end
67
+ end
68
+
69
+ context "on exact required Vagrant version" do
70
+ let(:vagrant_version) { "1.1.0" }
71
+ it "does not raise" do
72
+ expect { subject }.not_to raise_error
73
+ end
74
+ end
75
+
76
+ context "on newer Vagrant version" do
77
+ let(:vagrant_version) { "1.3.5" }
78
+ it "does not raise" do
79
+ expect { subject }.not_to raise_error
80
+ end
81
+ end
82
+ end
83
+ end
@@ -1,27 +1,27 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'vagrant-omnibus/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'vagrant-omnibus'
8
- spec.version = VagrantPlugins::Omnibus::VERSION
9
- spec.authors = ['Seth Chisamore']
10
- spec.email = ['schisamo@opscode.com']
11
- spec.description = 'A Vagrant plugin that ensures the desired version of' \
12
- ' Chef is installed via the platform-specific Omnibus' \
13
- ' packages.'
14
- spec.summary = spec.description
15
- spec.homepage = 'https://github.com/schisamo/vagrant-omnibus'
16
- spec.license = 'Apache 2.0'
17
-
18
- spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
19
- spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
20
- spec.test_files = spec.files.grep(/^(test|spec|features)\//)
21
- spec.require_paths = ['lib']
22
-
23
- spec.add_development_dependency 'bundler', '~> 1.3'
24
- spec.add_development_dependency 'rake'
25
- spec.add_development_dependency 'rspec'
26
- spec.add_development_dependency 'rubocop', '0.18.1'
27
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "vagrant-omnibus/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vagrant-omnibus"
8
+ spec.version = VagrantPlugins::Omnibus::VERSION
9
+ spec.authors = ["Seth Chisamore"]
10
+ spec.email = ["schisamo@chef.io"]
11
+ spec.description = "A Vagrant plugin that ensures the desired version of" \
12
+ " Chef is installed via the platform-specific Omnibus" \
13
+ " packages."
14
+ spec.summary = spec.description
15
+ spec.homepage = "https://github.com/chef/vagrant-omnibus"
16
+ spec.license = "Apache 2.0"
17
+
18
+ spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
19
+ spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(/^(test|spec|features)\//)
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake", "~> 11.0"
25
+ spec.add_development_dependency "rspec", "~> 3.0"
26
+ spec.add_development_dependency "chefstyle", "~> 0.4.0"
27
+ end
metadata CHANGED
@@ -1,85 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-omnibus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Chisamore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-26 00:00:00.000000000 Z
11
+ date: 2016-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '11.0'
34
34
  type: :development
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'
40
+ version: '11.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '3.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '3.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rubocop
56
+ name: chefstyle
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '='
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.18.1
61
+ version: 0.4.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '='
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.18.1
68
+ version: 0.4.0
69
69
  description: A Vagrant plugin that ensures the desired version of Chef is installed
70
70
  via the platform-specific Omnibus packages.
71
71
  email:
72
- - schisamo@opscode.com
72
+ - schisamo@chef.io
73
73
  executables: []
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
- - .gitignore
78
- - .rspec
79
- - .rubocop.yml
80
- - .ruby-version
81
- - .travis.yml
82
- - .yardopts
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".travis.yml"
80
+ - ".yardopts"
83
81
  - CHANGELOG.md
84
82
  - Gemfile
85
83
  - LICENSE
@@ -102,8 +100,9 @@ files:
102
100
  - test/support/cookbooks/chef-inator/recipes/default.rb
103
101
  - test/unit/spec_helper.rb
104
102
  - test/unit/vagrant-omnibus/config_spec.rb
103
+ - test/unit/vagrant-omnibus/plugin_spec.rb
105
104
  - vagrant-omnibus.gemspec
106
- homepage: https://github.com/schisamo/vagrant-omnibus
105
+ homepage: https://github.com/chef/vagrant-omnibus
107
106
  licenses:
108
107
  - Apache 2.0
109
108
  metadata: {}
@@ -113,17 +112,17 @@ require_paths:
113
112
  - lib
114
113
  required_ruby_version: !ruby/object:Gem::Requirement
115
114
  requirements:
116
- - - '>='
115
+ - - ">="
117
116
  - !ruby/object:Gem::Version
118
117
  version: '0'
119
118
  required_rubygems_version: !ruby/object:Gem::Requirement
120
119
  requirements:
121
- - - '>='
120
+ - - ">="
122
121
  - !ruby/object:Gem::Version
123
122
  version: '0'
124
123
  requirements: []
125
124
  rubyforge_project:
126
- rubygems_version: 2.0.14
125
+ rubygems_version: 2.6.6
127
126
  signing_key:
128
127
  specification_version: 4
129
128
  summary: A Vagrant plugin that ensures the desired version of Chef is installed via
@@ -139,4 +138,4 @@ test_files:
139
138
  - test/support/cookbooks/chef-inator/recipes/default.rb
140
139
  - test/unit/spec_helper.rb
141
140
  - test/unit/vagrant-omnibus/config_spec.rb
142
- has_rdoc:
141
+ - test/unit/vagrant-omnibus/plugin_spec.rb