chef-sugar 3.1.0 → 3.1.1
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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/chef/sugar/architecture.rb +11 -3
- data/lib/chef/sugar/platform.rb +1 -1
- data/lib/chef/sugar/version.rb +1 -1
- data/recipes/default.rb +11 -4
- data/spec/unit/chef/sugar/architecture_spec.rb +24 -11
- data/spec/unit/chef/sugar/platform_spec.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1c350bec3615fb748a196a3d32b0d1d41b4ba10
|
4
|
+
data.tar.gz: 61f7b084a157918874116324b02080e65492cac4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13baa00e6ceb58dac38479fd292234e791ef6ab594aadeb0cf5efd3daee4ac49c0f490003821c214eda68f1c862375ed4d005b0fac24f043cd59c4d35f1910a4
|
7
|
+
data.tar.gz: bb170b7fe5fb8aec96087c408b4ad13b67a302be94b5905fdca7834b71f9ef6bac6334bd24c4760ad4e1045f0aafbc801fb873267a940839409eaac7a1961ef6
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ Chef Sugar
|
|
4
4
|
[][travis]
|
5
5
|
|
6
6
|
[gem]: https://rubygems.org/gems/chef-sugar
|
7
|
-
[travis]: http://travis-ci.org/sethvargo/chef-
|
7
|
+
[travis]: http://travis-ci.org/sethvargo/chef-sugar
|
8
8
|
|
9
9
|
Chef Sugar is a Gem & Chef Recipe that includes series of helpful sugar of the Chef core and other resources to make a cleaner, more lean recipe DSL, enforce DRY principles, and make writing Chef recipes an awesome experience!
|
10
10
|
|
@@ -25,7 +25,7 @@ class Chef
|
|
25
25
|
# @return [Boolean]
|
26
26
|
#
|
27
27
|
def _64_bit?(node)
|
28
|
-
%w(amd64 x86_64 ppc64 ppc64le s390x ia64 sparc64 aarch64 arch64 arm64)
|
28
|
+
%w(amd64 x86_64 ppc64 ppc64le s390x ia64 sparc64 aarch64 arch64 arm64 sun4v sun4u)
|
29
29
|
.include?(node['kernel']['machine'])
|
30
30
|
end
|
31
31
|
|
@@ -39,7 +39,15 @@ class Chef
|
|
39
39
|
def _32_bit?(node)
|
40
40
|
!_64_bit?(node)
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
|
+
#
|
44
|
+
# Determine if the current architecture is i386
|
45
|
+
#
|
46
|
+
# @return [Boolean]
|
47
|
+
#
|
48
|
+
def i386?(node)
|
49
|
+
_32_bit?(node) && intel?(node)
|
50
|
+
end
|
43
51
|
|
44
52
|
#
|
45
53
|
# Determine if the current architecture is Intel.
|
@@ -47,7 +55,7 @@ class Chef
|
|
47
55
|
# @return [Boolean]
|
48
56
|
#
|
49
57
|
def intel?(node)
|
50
|
-
%w(i86pc)
|
58
|
+
%w(i86pc i386 x86_64 amd64 i686)
|
51
59
|
.include?(node['kernel']['machine'])
|
52
60
|
end
|
53
61
|
|
data/lib/chef/sugar/platform.rb
CHANGED
data/lib/chef/sugar/version.rb
CHANGED
data/recipes/default.rb
CHANGED
@@ -19,9 +19,16 @@
|
|
19
19
|
|
20
20
|
gem_version = run_context.cookbook_collection[cookbook_name].metadata.version
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
if Chef::Resource::ChefGem.instance_methods(false).include?(:compile_time)
|
23
|
+
chef_gem 'chef-sugar' do
|
24
|
+
version gem_version
|
25
|
+
compile_time true
|
26
|
+
end
|
27
|
+
else
|
28
|
+
chef_gem 'chef-sugar' do
|
29
|
+
version gem_version
|
30
|
+
action :nothing
|
31
|
+
end.run_action(:install)
|
32
|
+
end
|
26
33
|
|
27
34
|
require 'chef/sugar'
|
@@ -3,7 +3,8 @@ require 'spec_helper'
|
|
3
3
|
describe Chef::Sugar::Architecture do
|
4
4
|
it_behaves_like 'a chef sugar'
|
5
5
|
|
6
|
-
_64_bit_machines = %w(amd64 x86_64 ppc64 ppc64le s390x ia64 sparc64 aarch64 arch64 arm64)
|
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)
|
7
8
|
|
8
9
|
describe '#_64_bit?' do
|
9
10
|
_64_bit_machines.each do |arch|
|
@@ -33,31 +34,43 @@ describe Chef::Sugar::Architecture do
|
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
36
|
-
describe '#
|
37
|
-
it 'returns true when the system is
|
38
|
-
node = { 'kernel' => { 'machine' => '
|
39
|
-
expect(described_class.
|
37
|
+
describe '#i386?' do
|
38
|
+
it 'returns true when the system is 32 bit' do
|
39
|
+
node = { 'kernel' => { 'machine' => 'i386' } }
|
40
|
+
expect(described_class.i386?(node)).to be true
|
40
41
|
end
|
41
42
|
|
42
43
|
_64_bit_machines.each do |arch|
|
43
44
|
it "returns false when the system is #{arch}" do
|
44
45
|
node = { 'kernel' => { 'machine' => arch } }
|
46
|
+
expect(described_class.i386?(node)).to be false
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '#intel?' do
|
52
|
+
_intel_machines.each do |arch|
|
53
|
+
it "returns true when the system is #{arch}" do
|
54
|
+
node = { 'kernel' => { 'machine' => arch } }
|
55
|
+
expect(described_class.intel?(node)).to be true
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'returns false when the system is non Intel' do
|
59
|
+
node = { 'kernel' => { 'machine' => 'sun4u' } }
|
45
60
|
expect(described_class.intel?(node)).to be false
|
46
61
|
end
|
47
62
|
end
|
48
63
|
end
|
49
64
|
|
50
65
|
describe '#sparc?' do
|
51
|
-
it 'returns true when the system is SPARC' do
|
66
|
+
it 'returns true when the system is SPARC sun4u' do
|
52
67
|
node = { 'kernel' => { 'machine' => 'sun4u' } }
|
53
68
|
expect(described_class.sparc?(node)).to be true
|
54
69
|
end
|
55
70
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
expect(described_class.sparc?(node)).to be false
|
60
|
-
end
|
71
|
+
it 'returns true when the system is SPARC sun4v' do
|
72
|
+
node = { 'kernel' => { 'machine' => 'sun4v' } }
|
73
|
+
expect(described_class.sparc?(node)).to be true
|
61
74
|
end
|
62
75
|
end
|
63
76
|
|
@@ -77,12 +77,12 @@ describe Chef::Sugar::Platform do
|
|
77
77
|
|
78
78
|
describe '#redhat_enterprise_linux?' do
|
79
79
|
it 'returns true when the platform is redhat enterprise linux' do
|
80
|
-
node = { 'platform' => '
|
80
|
+
node = { 'platform' => 'redhat' }
|
81
81
|
expect(described_class.redhat_enterprise_linux?(node)).to be true
|
82
82
|
end
|
83
83
|
|
84
84
|
it 'returns false when the platform is not redhat enterprise linux' do
|
85
|
-
node = { 'platform' => '
|
85
|
+
node = { 'platform' => 'enterprise' }
|
86
86
|
expect(described_class.redhat_enterprise_linux?(node)).to be false
|
87
87
|
end
|
88
88
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-sugar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Vargo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
164
|
version: '0'
|
165
165
|
requirements: []
|
166
166
|
rubyforge_project:
|
167
|
-
rubygems_version: 2.
|
167
|
+
rubygems_version: 2.2.3
|
168
168
|
signing_key:
|
169
169
|
specification_version: 4
|
170
170
|
summary: A collection of helper methods and modules that make working with Chef recipes
|