chef-sugar 4.2.1 → 5.0.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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/chef/sugar/version.rb +1 -1
  3. metadata +3 -63
  4. data/.github/lock.yml +0 -3
  5. data/.github/reaction.yml +0 -1
  6. data/.gitignore +0 -26
  7. data/.kitchen.yml +0 -16
  8. data/.travis.yml +0 -17
  9. data/CHANGELOG.md +0 -261
  10. data/CONTRIBUTING.md +0 -20
  11. data/Gemfile +0 -2
  12. data/README.md +0 -540
  13. data/Rakefile +0 -11
  14. data/chef-sugar.gemspec +0 -33
  15. data/libraries/chef-sugar.rb +0 -1
  16. data/metadata.rb +0 -24
  17. data/recipes/default.rb +0 -20
  18. data/spec/spec_helper.rb +0 -25
  19. data/spec/support/shared_examples.rb +0 -20
  20. data/spec/unit/chef/sugar/architecture_spec.rb +0 -129
  21. data/spec/unit/chef/sugar/cloud_spec.rb +0 -149
  22. data/spec/unit/chef/sugar/constraints_spec.rb +0 -45
  23. data/spec/unit/chef/sugar/core_extensions/array_spec.rb +0 -10
  24. data/spec/unit/chef/sugar/core_extensions/object_spec.rb +0 -62
  25. data/spec/unit/chef/sugar/core_extensions/string_spec.rb +0 -48
  26. data/spec/unit/chef/sugar/data_bag_spec.rb +0 -118
  27. data/spec/unit/chef/sugar/docker_spec.rb +0 -39
  28. data/spec/unit/chef/sugar/init_spec.rb +0 -74
  29. data/spec/unit/chef/sugar/ip_spec.rb +0 -53
  30. data/spec/unit/chef/sugar/kernel_spec.rb +0 -16
  31. data/spec/unit/chef/sugar/kitchen_spec.rb +0 -18
  32. data/spec/unit/chef/sugar/node_spec.rb +0 -172
  33. data/spec/unit/chef/sugar/platform_family_spec.rb +0 -166
  34. data/spec/unit/chef/sugar/platform_spec.rb +0 -342
  35. data/spec/unit/chef/sugar/ruby_spec.rb +0 -39
  36. data/spec/unit/chef/sugar/run_context_spec.rb +0 -19
  37. data/spec/unit/chef/sugar/shell_spec.rb +0 -104
  38. data/spec/unit/chef/sugar/vagrant_spec.rb +0 -37
  39. data/spec/unit/chef/sugar/virtualization_spec.rb +0 -135
  40. data/spec/unit/recipes/default_spec.rb +0 -9
data/Rakefile DELETED
@@ -1,11 +0,0 @@
1
- require 'bundler/gem_tasks'
2
-
3
- require 'rspec/core/rake_task'
4
- RSpec::Core::RakeTask.new do |t|
5
- t.rspec_opts = [
6
- '--color',
7
- '--format progress',
8
- ].join(' ')
9
- end
10
-
11
- task default: :spec
@@ -1,33 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'chef/sugar/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'chef-sugar'
8
- spec.version = Chef::Sugar::VERSION
9
- spec.authors = ['Seth Vargo']
10
- spec.email = ['sethvargo@gmail.com']
11
- spec.description = 'A series of helpful sugar of the Chef core and ' \
12
- 'other resources to make a cleaner, more lean recipe ' \
13
- 'DSL, enforce DRY principles, and make writing Chef ' \
14
- 'recipes an awesome experience!'
15
- spec.summary = 'A collection of helper methods and modules that ' \
16
- 'make working with Chef recipes awesome.'
17
- spec.homepage = 'https://github.com/sethvargo/chef-sugar'
18
- spec.license = 'Apache 2.0'
19
-
20
- spec.required_ruby_version = '>= 2.2.2'
21
-
22
- spec.files = `git ls-files`.split($/)
23
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
24
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
25
- spec.require_paths = ['lib']
26
-
27
- spec.add_development_dependency 'bundler', '~> 1.3'
28
- spec.add_development_dependency 'rake'
29
-
30
- spec.add_development_dependency 'chefspec'
31
- spec.add_development_dependency 'test-kitchen'
32
- spec.add_development_dependency 'kitchen-vagrant'
33
- end
@@ -1 +0,0 @@
1
- require "chef/sugar"
@@ -1,24 +0,0 @@
1
- name 'chef-sugar'
2
- maintainer 'Seth Vargo'
3
- maintainer_email 'sethvargo@gmail.com'
4
- license 'Apache-2.0'
5
- description 'Installs chef-sugar. Please see the chef-sugar ' \
6
- 'Ruby gem for more information.'
7
- long_description <<-EOH
8
- Chef Sugar is a Gem & Chef Recipe that includes series of helpful syntactic
9
- sugars on top of the Chef core and other resources to make a cleaner, more lean
10
- recipe DSL, enforce DRY principles, and make writing Chef recipes an awesome and
11
- fun experience!
12
-
13
- For the most up-to-date information and documentation, please visit the [Chef
14
- Sugar project page on GitHub](https://github.com/sethvargo/chef-sugar).
15
- EOH
16
-
17
- require File.expand_path('../lib/chef/sugar/version', __FILE__)
18
- version Chef::Sugar::VERSION
19
-
20
- supports 'any'
21
- issues_url 'https://github.com/sethvargo/chef-sugar/issues'
22
- source_url 'https://github.com/sethvargo/chef-sugar'
23
- chef_version '>= 12.10.48' if respond_to?(:chef_version)
24
- gem 'chef-sugar'
@@ -1,20 +0,0 @@
1
- #
2
- # Cookbook Name:: chef-sugar
3
- # Recipe:: default
4
- #
5
- # Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com>
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
-
20
- Chef::Log.warn('chef-sugar::default no longer needs to be included in your runlist. Instead simply depend on the chef-sugar cookbook and the gem will be intalled and loaded automatically.')
@@ -1,25 +0,0 @@
1
- require 'rspec'
2
- require 'chefspec'
3
- require 'chef/sugar'
4
-
5
- require_relative 'support/shared_examples'
6
-
7
- RSpec.configure do |config|
8
- # Prohibit using the should syntax
9
- config.expect_with :rspec do |spec|
10
- spec.syntax = :expect
11
- end
12
-
13
- # Focus groups
14
- config.filter_run(focus: true)
15
- config.run_all_when_everything_filtered = true
16
-
17
- # Run specs in random order to surface order dependencies. If you find an
18
- # order dependency and want to debug it, you can fix the order by providing
19
- # the seed, which is printed after each run.
20
- # --seed 1234
21
- config.order = 'random'
22
-
23
- # ChefSpec configuration
24
- config.log_level = :fatal
25
- end
@@ -1,20 +0,0 @@
1
- module RSpec
2
- shared_examples 'a chef sugar' do
3
- it 'acts as a singleton' do
4
- described_class.module_eval("def foo; 'result'; end")
5
- klass = Class.new.tap { |k| k.send(:include, described_class) }
6
- expect(described_class.foo).to eq(klass.new.foo)
7
- end
8
-
9
- described_class.instance_methods.each do |name|
10
- it "defines a `#{name}` DSL method" do
11
- expect(Chef::Sugar::DSL).to be_method_defined(name)
12
- end
13
-
14
- it 'has n-1 arity from the parent method' do
15
- method = Chef::Sugar::DSL.instance_method(name)
16
- expect(method.arity).to eq(described_class.method(name).arity - 1)
17
- end
18
- end
19
- end
20
- end
@@ -1,129 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Chef::Sugar::Architecture do
4
- it_behaves_like 'a chef sugar'
5
-
6
- _64_bit_machines = %w(amd64 x86_64 ppc64 ppc64le s390x ia64 sparc64 aarch64 arch64 arm64 sun4u sun4v)
7
- _intel_machines = %w(i86pc i386 x86_64 amd64 i686)
8
-
9
- describe '#_64_bit?' do
10
- _64_bit_machines.each do |arch|
11
- it "returns true when the system is #{arch}" do
12
- node = { 'kernel' => { 'machine' => arch } }
13
- expect(described_class._64_bit?(node)).to be true
14
- end
15
- end
16
-
17
- it 'returns true when ohai provides the bittiness' do
18
- node = { 'kernel' => { 'bits' => '64' } }
19
- expect(described_class._64_bit?(node)).to be true
20
- end
21
-
22
- it 'returns false when ohai provides the bittiness' do
23
- node = { 'kernel' => { 'bits' => '32' } }
24
- expect(described_class._64_bit?(node)).to be false
25
- end
26
-
27
- it 'returns false when the system is not 64 bit' do
28
- node = { 'kernel' => { 'machine' => 'i386' } }
29
- expect(described_class._64_bit?(node)).to be false
30
- end
31
- end
32
-
33
- describe '#_32_bit?' do
34
- it 'returns true when the system is 32 bit' do
35
- node = { 'kernel' => { 'machine' => 'i386' } }
36
- expect(described_class._32_bit?(node)).to be true
37
- end
38
-
39
- _64_bit_machines.each do |arch|
40
- it "returns false when the system is #{arch}" do
41
- node = { 'kernel' => { 'machine' => arch } }
42
- expect(described_class._32_bit?(node)).to be false
43
- end
44
- end
45
- end
46
-
47
- describe '#i386?' do
48
- it 'returns true when the system is 32 bit' do
49
- node = { 'kernel' => { 'machine' => 'i386' } }
50
- expect(described_class.i386?(node)).to be true
51
- end
52
-
53
- _64_bit_machines.each do |arch|
54
- it "returns false when the system is #{arch}" do
55
- node = { 'kernel' => { 'machine' => arch } }
56
- expect(described_class.i386?(node)).to be false
57
- end
58
- end
59
- end
60
-
61
- describe '#intel?' do
62
- _intel_machines.each do |arch|
63
- it "returns true when the system is #{arch}" do
64
- node = { 'kernel' => { 'machine' => arch } }
65
- expect(described_class.intel?(node)).to be true
66
- end
67
-
68
- it 'returns false when the system is non Intel' do
69
- node = { 'kernel' => { 'machine' => 'sun4u' } }
70
- expect(described_class.intel?(node)).to be false
71
- end
72
- end
73
- end
74
-
75
- describe '#powerpc?' do
76
- it 'returns true when the system is IBM POWER or powerpc' do
77
- node = { 'kernel' => { 'machine' => 'powerpc' } }
78
- end
79
- end
80
-
81
- describe '#armhf?' do
82
- it 'returns true when the system is ARM' do
83
- node = { 'kernel' => { 'machine' => 'armv7l' } }
84
- expect(described_class.intel?(node)).to be false
85
- expect(described_class.armhf?(node)).to be true
86
- end
87
- end
88
-
89
- describe '#aarch64?' do
90
- it 'returns true when the system is AArch64' do
91
- node = { 'kernel' => { 'machine' => 'aarch64' } }
92
- expect(described_class.intel?(node)).to be false
93
- expect(described_class.aarch64?(node)).to be true
94
- end
95
- end
96
-
97
- describe '#sparc?' do
98
- it 'returns true when the system is SPARC sun4u' do
99
- node = { 'kernel' => { 'machine' => 'sun4u' } }
100
- expect(described_class.sparc?(node)).to be true
101
- end
102
-
103
- it 'returns true when the system is SPARC sun4v' do
104
- node = { 'kernel' => { 'machine' => 'sun4v' } }
105
- expect(described_class.sparc?(node)).to be true
106
- end
107
- end
108
-
109
- describe '#ppc64?' do
110
- it 'returns true when the system is PowerPC64 Big Endian' do
111
- node = { 'kernel' => { 'machine' => 'ppc64' } }
112
- expect(described_class.ppc64?(node)).to be true
113
- end
114
- end
115
-
116
- describe '#ppc64le?' do
117
- it 'returns true when the system is PowerPC64 Little Endian' do
118
- node = { 'kernel' => { 'machine' => 'ppc64le' } }
119
- expect(described_class.ppc64le?(node)).to be true
120
- end
121
- end
122
-
123
- describe '#s390x?' do
124
- it 'returns true when the system is s390x' do
125
- node = { 'kernel' => { 'machine' => 's390x' } }
126
- expect(described_class.s390x?(node)).to be true
127
- end
128
- end
129
- end
@@ -1,149 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Chef::Sugar::Cloud do
4
- it_behaves_like 'a chef sugar'
5
-
6
- describe '#cloud?' do
7
- it 'is true when the node is on cloud' do
8
- node = { 'cloud' => nil }
9
- expect(described_class.cloud?(node)).to be true
10
- end
11
-
12
- it 'is false when the node is not on cloud' do
13
- node = {}
14
- expect(described_class.cloud?(node)).to be false
15
- end
16
- end
17
-
18
- describe '#ec2?' do
19
- it 'is true when the node is on ec2' do
20
- node = { 'ec2' => nil }
21
- expect(described_class.ec2?(node)).to be true
22
- end
23
-
24
- it 'is false when the node is not on ec2' do
25
- node = {}
26
- expect(described_class.ec2?(node)).to be false
27
- end
28
- end
29
-
30
- describe '#gce?' do
31
- it 'is true when the node is on gce' do
32
- node = { 'gce' => nil }
33
- expect(described_class.gce?(node)).to be true
34
- end
35
-
36
- it 'is false when the node is not on gce' do
37
- node = {}
38
- expect(described_class.gce?(node)).to be false
39
- end
40
- end
41
-
42
- describe '#rackspace?' do
43
- it 'is true when the node is on rackspace' do
44
- node = { 'rackspace' => nil }
45
- expect(described_class.rackspace?(node)).to be true
46
- end
47
-
48
- it 'is false when the node is not on rackspace' do
49
- node = {}
50
- expect(described_class.rackspace?(node)).to be false
51
- end
52
- end
53
-
54
- describe '#eucalyptus?' do
55
- it 'is true when the node is on eucalyptus' do
56
- node = { 'eucalyptus' => nil }
57
- expect(described_class.eucalyptus?(node)).to be true
58
- end
59
-
60
- it 'is false when the node is not on eucalyptus' do
61
- node = {}
62
- expect(described_class.eucalyptus?(node)).to be false
63
- end
64
- end
65
-
66
- describe '#euca?' do
67
- it 'is true when the node is on eucalyptus' do
68
- node = { 'eucalyptus' => nil }
69
- expect(described_class.euca?(node)).to be true
70
- end
71
-
72
- it 'is false when the node is not on eucalyptus' do
73
- node = {}
74
- expect(described_class.euca?(node)).to be false
75
- end
76
- end
77
-
78
- describe '#linode?' do
79
- it 'is true when the node is on linode' do
80
- node = { 'linode' => nil }
81
- expect(described_class.linode?(node)).to be true
82
- end
83
-
84
- it 'is false when the node is not on linode' do
85
- node = {}
86
- expect(described_class.linode?(node)).to be false
87
- end
88
- end
89
-
90
- describe '#openstack?' do
91
- it 'is true when the node is on openstack' do
92
- node = { 'openstack' => nil }
93
- expect(described_class.openstack?(node)).to be true
94
- end
95
-
96
- it 'is false when the node is not on openstack' do
97
- node = {}
98
- expect(described_class.openstack?(node)).to be false
99
- end
100
- end
101
-
102
- describe '#cloudstack?' do
103
- it 'is true when the node is on cloudstack' do
104
- node = { 'cloudstack' => nil }
105
- expect(described_class.cloudstack?(node)).to be true
106
- end
107
-
108
- it 'is false when the node is not on cloudstack' do
109
- node = {}
110
- expect(described_class.cloudstack?(node)).to be false
111
- end
112
- end
113
-
114
- describe '#azure?' do
115
- it 'is true when the node is on azure' do
116
- node = { 'azure' => nil }
117
- expect(described_class.azure?(node)).to be true
118
- end
119
-
120
- it 'is false when the node is not on azure' do
121
- node = {}
122
- expect(described_class.azure?(node)).to be false
123
- end
124
- end
125
-
126
- describe '#digitalocean?' do
127
- it 'is true when the node is on digitalocean' do
128
- node = { 'digital_ocean' => nil }
129
- expect(described_class.digitalocean?(node)).to be true
130
- end
131
-
132
- it 'is false when the node is not on digitalocean' do
133
- node = {}
134
- expect(described_class.digitalocean?(node)).to be false
135
- end
136
- end
137
-
138
- describe '#softlayer?' do
139
- it 'is true when the node is on softlayer' do
140
- node = { 'softlayer' => nil }
141
- expect(described_class.softlayer?(node)).to be true
142
- end
143
-
144
- it 'is false when the node is not on softlayer' do
145
- node = {}
146
- expect(described_class.softlayer?(node)).to be false
147
- end
148
- end
149
- end
@@ -1,45 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Chef::Sugar::Constraints do
4
- describe '#version' do
5
- let(:version) { described_class.version('1.2.3') }
6
-
7
- it 'returns a new version object' do
8
- expect(version).to be_a(Chef::Sugar::Constraints::Version)
9
- end
10
-
11
- it 'behaves like a String' do
12
- expect(version).to be_a(String)
13
- end
14
-
15
- it 'returns true with the version is satisifed' do
16
- expect(version).to be_satisfies('~> 1.2.0')
17
- end
18
-
19
- it 'returns false when the version is not satisfed' do
20
- expect(version).to_not be_satisfies('~> 2.0.0')
21
- end
22
- end
23
-
24
- describe '#constraint' do
25
- let(:constraint) { described_class.constraint('~> 1.2.0') }
26
-
27
- it 'returns a new constraint object' do
28
- expect(constraint).to be_a(Chef::Sugar::Constraints::Constraint)
29
- end
30
-
31
- it 'returns true when the constraint is satisfied' do
32
- expect(constraint).to be_satisfied_by('1.2.3')
33
- end
34
-
35
- it 'returns false when the constraint is not satisfied' do
36
- expect(constraint).to_not be_satisfied_by('2.0.0')
37
- end
38
- end
39
-
40
- describe '#chef_version' do
41
- it 'is a DSL method' do
42
- expect(Chef::Sugar::DSL).to be_method_defined(:chef_version)
43
- end
44
- end
45
- end