halite 1.0.0.rc.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +20 -0
- data/.travis.yml +14 -4
- data/.yardopts +7 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +30 -8
- data/LICENSE +202 -202
- data/README.md +104 -2
- data/Rakefile +25 -5
- data/gemfiles/default.gemfile +17 -0
- data/gemfiles/master.gemfile +21 -0
- data/halite.gemspec +21 -10
- data/lib/berkshelf/halite.rb +25 -0
- data/lib/berkshelf/locations/gem.rb +84 -0
- data/lib/halite.rb +34 -4
- data/lib/halite/berkshelf/helper.rb +8 -2
- data/lib/halite/berkshelf/source.rb +9 -1
- data/lib/halite/converter.rb +34 -10
- data/lib/halite/converter/chef.rb +43 -0
- data/lib/halite/converter/libraries.rb +93 -26
- data/lib/halite/converter/metadata.rb +48 -10
- data/lib/halite/converter/misc.rb +43 -0
- data/lib/halite/dependencies.rb +48 -8
- data/lib/halite/error.rb +20 -0
- data/lib/halite/gem.rb +106 -21
- data/lib/halite/helper_base.rb +129 -0
- data/lib/halite/rake_helper.rb +46 -60
- data/lib/halite/rake_tasks.rb +17 -1
- data/lib/halite/spec_helper.rb +403 -54
- data/lib/halite/spec_helper/patcher.rb +130 -0
- data/lib/halite/spec_helper/runner.rb +57 -9
- data/lib/halite/version.rb +19 -1
- data/spec/converter/chef_spec.rb +54 -0
- data/spec/converter/libraries_spec.rb +131 -123
- data/spec/converter/metadata_spec.rb +61 -8
- data/spec/converter/misc_spec.rb +61 -0
- data/spec/converter_spec.rb +21 -6
- data/spec/dependencies_spec.rb +64 -10
- data/spec/example_resources/poise.rb +42 -0
- data/spec/example_resources/simple.rb +48 -0
- data/spec/{data/gems/test1/lib → fixtures/cookbooks/test1/files/halite_gem}/test1.rb +0 -0
- data/spec/{data/gems/test1/lib → fixtures/cookbooks/test1/files/halite_gem}/test1/version.rb +0 -0
- data/spec/fixtures/cookbooks/test1/libraries/default.rb +4 -0
- data/spec/{data/integration_cookbooks → fixtures/cookbooks}/test1/metadata.rb +0 -0
- data/spec/{data/gems/test2/chef → fixtures/cookbooks/test2}/attributes.rb +0 -0
- data/spec/{data/gems/test2/lib → fixtures/cookbooks/test2/files/halite_gem}/test2.rb +0 -0
- data/spec/{data/gems/test2/lib → fixtures/cookbooks/test2/files/halite_gem}/test2/resource.rb +0 -0
- data/spec/{data/gems/test2/lib → fixtures/cookbooks/test2/files/halite_gem}/test2/version.rb +0 -0
- data/spec/fixtures/cookbooks/test2/libraries/default.rb +3 -0
- data/spec/{data/integration_cookbooks → fixtures/cookbooks}/test2/metadata.rb +1 -1
- data/spec/{data/gems/test2/chef → fixtures/cookbooks/test2}/recipes/default.rb +0 -0
- data/spec/{data/gems/test2/chef → fixtures/cookbooks/test2}/templates/default/conf.erb +0 -0
- data/spec/{data/gems/test3/lib → fixtures/cookbooks/test3/files/halite_gem}/test3.rb +0 -0
- data/spec/{data/gems/test3/lib → fixtures/cookbooks/test3/files/halite_gem}/test3/dsl.rb +0 -0
- data/spec/{data/gems/test3/lib → fixtures/cookbooks/test3/files/halite_gem}/test3/version.rb +0 -0
- data/spec/fixtures/cookbooks/test3/libraries/default.rb +4 -0
- data/spec/{data/integration_cookbooks → fixtures/cookbooks}/test3/metadata.rb +0 -0
- data/spec/{data/gems/test3/chef → fixtures/cookbooks/test3}/recipes/default.rb +0 -0
- data/spec/{data → fixtures}/gems/test1/Rakefile +0 -0
- data/spec/fixtures/gems/test1/lib/test1.rb +2 -0
- data/spec/fixtures/gems/test1/lib/test1/version.rb +3 -0
- data/spec/{data → fixtures}/gems/test1/test1.gemspec +0 -0
- data/spec/{data → fixtures}/gems/test2/Rakefile +0 -0
- data/spec/{data/integration_cookbooks/test2 → fixtures/gems/test2/chef}/attributes.rb +0 -0
- data/spec/{data/integration_cookbooks/test2 → fixtures/gems/test2/chef}/recipes/default.rb +0 -0
- data/spec/{data/integration_cookbooks/test2 → fixtures/gems/test2/chef}/templates/default/conf.erb +0 -0
- data/spec/fixtures/gems/test2/lib/test2.rb +4 -0
- data/spec/{data/integration_cookbooks/test2/libraries/test2__resource.rb → fixtures/gems/test2/lib/test2/resource.rb} +1 -2
- data/spec/fixtures/gems/test2/lib/test2/version.rb +3 -0
- data/spec/{data → fixtures}/gems/test2/test2.gemspec +0 -0
- data/spec/{data → fixtures}/gems/test3/Rakefile +0 -0
- data/spec/{data/integration_cookbooks/test3 → fixtures/gems/test3/chef}/recipes/default.rb +0 -0
- data/spec/fixtures/gems/test3/lib/test3.rb +4 -0
- data/spec/{data/integration_cookbooks/test3/libraries/test3__dsl.rb → fixtures/gems/test3/lib/test3/dsl.rb} +1 -2
- data/spec/fixtures/gems/test3/lib/test3/version.rb +3 -0
- data/spec/{data → fixtures}/gems/test3/test3.gemspec +1 -0
- data/spec/gem_spec.rb +41 -31
- data/spec/integration_spec.rb +58 -82
- data/spec/runner_spec.rb +108 -0
- data/spec/spec_helper.rb +19 -26
- data/spec/spec_helper_spec.rb +238 -0
- metadata +124 -151
- data/lib/halite/converter/other.rb +0 -19
- data/lib/halite/converter/readme.rb +0 -20
- data/spec/converter/other_spec.rb +0 -56
- data/spec/converter/readme_spec.rb +0 -55
- data/spec/data/integration_cookbooks/test1/libraries/test1.rb +0 -3
- data/spec/data/integration_cookbooks/test1/libraries/test1__version.rb +0 -4
- data/spec/data/integration_cookbooks/test2/libraries/test2.rb +0 -5
- data/spec/data/integration_cookbooks/test2/libraries/test2__version.rb +0 -4
- data/spec/data/integration_cookbooks/test3/libraries/test3.rb +0 -5
- data/spec/data/integration_cookbooks/test3/libraries/test3__version.rb +0 -4
@@ -1,16 +1,42 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
1
17
|
require 'spec_helper'
|
2
|
-
require 'halite/converter/metadata'
|
3
|
-
require 'halite/dependencies'
|
4
18
|
|
5
19
|
describe Halite::Converter::Metadata do
|
6
20
|
describe '#generate' do
|
7
21
|
let(:gem_name) { 'mygem' }
|
8
22
|
let(:cookbook_name) { gem_name }
|
9
23
|
let(:version) { '1.0.0' }
|
10
|
-
let(:license_header) { '' }
|
11
24
|
let(:cookbook_dependencies) { [] }
|
12
|
-
let(:spec)
|
13
|
-
|
25
|
+
let(:spec) do
|
26
|
+
instance_double('Gem::Specification', description: '')
|
27
|
+
end
|
28
|
+
let(:gem_data) do
|
29
|
+
instance_double('Halite::Gem',
|
30
|
+
cookbook_dependencies: cookbook_dependencies.map {|dep| Halite::Dependencies::Dependency.new(*dep) },
|
31
|
+
cookbook_name: cookbook_name,
|
32
|
+
find_misc_path: nil,
|
33
|
+
license_header: '',
|
34
|
+
name: gem_name,
|
35
|
+
spec: spec,
|
36
|
+
version: version,
|
37
|
+
)
|
38
|
+
end
|
39
|
+
subject { described_class.generate(gem_data) }
|
14
40
|
|
15
41
|
context 'with simple data' do
|
16
42
|
it { is_expected.to eq <<-EOH }
|
@@ -20,7 +46,9 @@ EOH
|
|
20
46
|
end # /context with simple data
|
21
47
|
|
22
48
|
context 'with a license header' do
|
23
|
-
|
49
|
+
before do
|
50
|
+
allow(gem_data).to receive(:license_header).and_return("# header\n")
|
51
|
+
end
|
24
52
|
it { is_expected.to eq <<-EOH }
|
25
53
|
# header
|
26
54
|
name "mygem"
|
@@ -33,7 +61,7 @@ EOH
|
|
33
61
|
it { is_expected.to eq <<-EOH }
|
34
62
|
name "mygem"
|
35
63
|
version "1.0.0"
|
36
|
-
depends "other"
|
64
|
+
depends "other"
|
37
65
|
EOH
|
38
66
|
end # /context with one dependency
|
39
67
|
|
@@ -46,10 +74,35 @@ depends "other", "~> 1.0"
|
|
46
74
|
depends "another", "~> 2.0.0"
|
47
75
|
EOH
|
48
76
|
end # /context with two dependencies
|
77
|
+
|
78
|
+
context 'with a description' do
|
79
|
+
before do
|
80
|
+
allow(spec).to receive(:description).and_return('My awesome library!')
|
81
|
+
end
|
82
|
+
|
83
|
+
it { is_expected.to eq <<-EOH }
|
84
|
+
name "mygem"
|
85
|
+
version "1.0.0"
|
86
|
+
description "My awesome library!"
|
87
|
+
EOH
|
88
|
+
end # /context with a description
|
89
|
+
|
90
|
+
context 'with a readme' do
|
91
|
+
before do
|
92
|
+
allow(gem_data).to receive(:find_misc_path).and_return('/source/README.md')
|
93
|
+
allow(IO).to receive(:read).with('/source/README.md').and_return("My awesome readme!\nCopyright me.\n")
|
94
|
+
end
|
95
|
+
|
96
|
+
it { is_expected.to eq <<-'EOH' }
|
97
|
+
name "mygem"
|
98
|
+
version "1.0.0"
|
99
|
+
long_description "My awesome readme!\nCopyright me.\n"
|
100
|
+
EOH
|
101
|
+
end # /context with a readme
|
49
102
|
end # /describe #generate
|
50
103
|
|
51
104
|
describe '#write' do
|
52
|
-
let(:output) { double('output') }
|
105
|
+
let(:output) { double('output sentinel') }
|
53
106
|
before { allow(described_class).to receive(:generate).and_return(output) }
|
54
107
|
|
55
108
|
it 'should write out metadata' do
|
@@ -0,0 +1,61 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'spec_helper'
|
18
|
+
|
19
|
+
describe Halite::Converter::Misc do
|
20
|
+
describe '#write' do
|
21
|
+
let(:files) { [] }
|
22
|
+
let(:gem_data) do
|
23
|
+
instance_double('Halite::Gem').tap do |d|
|
24
|
+
allow(d).to receive(:find_misc_path) do |name|
|
25
|
+
if files.include?(name)
|
26
|
+
"/source/#{name}"
|
27
|
+
else
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
subject { described_class.write(gem_data, '/test') }
|
34
|
+
|
35
|
+
context 'with no files' do
|
36
|
+
it do
|
37
|
+
expect(FileUtils).to_not receive(:copy)
|
38
|
+
subject
|
39
|
+
end
|
40
|
+
end # /context with no files
|
41
|
+
|
42
|
+
context 'with a Readme' do
|
43
|
+
let(:files) { 'Readme' }
|
44
|
+
|
45
|
+
it do
|
46
|
+
expect(FileUtils).to receive(:copy).with('/source/Readme', '/test/Readme', preserve: true)
|
47
|
+
subject
|
48
|
+
end
|
49
|
+
end # /context with a Readme
|
50
|
+
|
51
|
+
context 'with multiple files' do
|
52
|
+
let(:files) { %w{Readme License} }
|
53
|
+
|
54
|
+
it 'writes out a README' do
|
55
|
+
expect(FileUtils).to receive(:copy).with('/source/Readme', '/test/Readme', preserve: true)
|
56
|
+
expect(FileUtils).to receive(:copy).with('/source/License', '/test/License', preserve: true)
|
57
|
+
subject
|
58
|
+
end
|
59
|
+
end # /context with multiple files
|
60
|
+
end # /describe #write
|
61
|
+
end
|
data/spec/converter_spec.rb
CHANGED
@@ -1,13 +1,28 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
1
17
|
require 'spec_helper'
|
2
|
-
require 'halite/converter'
|
3
18
|
|
4
19
|
describe Halite::Converter do
|
5
20
|
describe '#write' do
|
6
|
-
it
|
7
|
-
expect(Halite::Converter::Metadata).to receive(:write)
|
8
|
-
expect(Halite::Converter::Libraries).to receive(:write)
|
9
|
-
expect(Halite::Converter::
|
10
|
-
expect(Halite::Converter::
|
21
|
+
it do
|
22
|
+
expect(Halite::Converter::Metadata).to receive(:write)
|
23
|
+
expect(Halite::Converter::Libraries).to receive(:write)
|
24
|
+
expect(Halite::Converter::Chef).to receive(:write)
|
25
|
+
expect(Halite::Converter::Misc).to receive(:write)
|
11
26
|
described_class.write(nil, '/test')
|
12
27
|
end
|
13
28
|
end
|
data/spec/dependencies_spec.rb
CHANGED
@@ -1,17 +1,46 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
1
17
|
require 'spec_helper'
|
2
18
|
require 'halite/dependencies'
|
3
19
|
|
4
20
|
describe Halite::Dependencies do
|
21
|
+
def fake_gem(name='name', version='1.0.0', &block)
|
22
|
+
Gem::Specification.new do |s|
|
23
|
+
s.name = name
|
24
|
+
s.version = Gem::Version.new(version)
|
25
|
+
block.call(s) if block
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
let(:gem_stubs) do
|
30
|
+
[
|
31
|
+
fake_gem('gem1'),
|
32
|
+
fake_gem('gem2') {|s| s.requirements << 'dep2' },
|
33
|
+
fake_gem('gem3') {|s| s.add_dependency 'halite' },
|
34
|
+
]
|
35
|
+
end
|
36
|
+
|
5
37
|
before do
|
6
|
-
allow(Gem::Specification).to receive(:stubs).and_return(
|
7
|
-
Gem::Specification.new {|s| s.name = 'gem1'; s.version = Gem::Version.new('1.0.0') },
|
8
|
-
Gem::Specification.new {|s| s.name = 'gem2'; s.version = Gem::Version.new('1.0.0'); s.requirements << 'dep2' },
|
9
|
-
])
|
38
|
+
allow(Gem::Specification).to receive(:stubs).and_return(gem_stubs)
|
10
39
|
end
|
11
40
|
|
12
41
|
describe '#extract_from_requirements' do
|
13
42
|
let(:requirements) { [] }
|
14
|
-
subject { described_class.extract_from_requirements(
|
43
|
+
subject { described_class.extract_from_requirements(fake_gem {|s| s.requirements += requirements }) }
|
15
44
|
|
16
45
|
context 'with []' do
|
17
46
|
it { is_expected.to eq [] }
|
@@ -31,7 +60,7 @@ describe Halite::Dependencies do
|
|
31
60
|
|
32
61
|
describe '#extract_from_metadata' do
|
33
62
|
let(:metadata) { nil }
|
34
|
-
subject { described_class.extract_from_metadata(
|
63
|
+
subject { described_class.extract_from_metadata(fake_gem {|s| s.metadata = {'halite_dependencies' => metadata} if metadata }) }
|
35
64
|
|
36
65
|
context 'with no metadata' do
|
37
66
|
it { is_expected.to eq [] }
|
@@ -48,6 +77,26 @@ describe Halite::Dependencies do
|
|
48
77
|
end
|
49
78
|
end # /describe #extract_from_metadata
|
50
79
|
|
80
|
+
describe '#extract_from_dependencies' do
|
81
|
+
let(:gemspec) { }
|
82
|
+
subject { described_class.extract_from_dependencies(gemspec) }
|
83
|
+
|
84
|
+
context 'with a halite-ish dependency' do
|
85
|
+
let(:gemspec) { fake_gem {|s| s.add_dependency 'gem3' } }
|
86
|
+
it { is_expected.to eq [['gem3', '>= 0', gem_stubs[2]]] }
|
87
|
+
end
|
88
|
+
|
89
|
+
context 'with a development dependency' do
|
90
|
+
let(:gemspec) { fake_gem {|s| s.add_development_dependency 'gem3' } }
|
91
|
+
it { is_expected.to eq [] }
|
92
|
+
end
|
93
|
+
|
94
|
+
context 'with a non-halite dependency' do
|
95
|
+
let(:gemspec) { fake_gem {|s| s.add_development_dependency 'gem1' } }
|
96
|
+
it { is_expected.to eq [] }
|
97
|
+
end
|
98
|
+
end # /describe #extract_from_dependencies
|
99
|
+
|
51
100
|
describe '#clean' do
|
52
101
|
let(:dependency) { nil }
|
53
102
|
subject { described_class.clean(dependency) }
|
@@ -80,7 +129,7 @@ describe Halite::Dependencies do
|
|
80
129
|
|
81
130
|
context 'with [name, = 1.0.0, = 1.0.0]' do
|
82
131
|
let(:dependency) { ['name', '= 1.0.0', '= 1.0.0'] }
|
83
|
-
it { expect { subject }.to raise_error Halite::
|
132
|
+
it { expect { subject }.to raise_error Halite::InvalidDependencyError }
|
84
133
|
end
|
85
134
|
end # /describe #clean
|
86
135
|
|
@@ -146,17 +195,22 @@ describe Halite::Dependencies do
|
|
146
195
|
|
147
196
|
context 'with 0' do
|
148
197
|
let(:version) { '0' }
|
149
|
-
it { is_expected.to eq '0
|
198
|
+
it { is_expected.to eq '0' }
|
199
|
+
end
|
200
|
+
|
201
|
+
context 'with 0.0' do
|
202
|
+
let(:version) { '0.0' }
|
203
|
+
it { is_expected.to eq '0' }
|
150
204
|
end
|
151
205
|
|
152
206
|
context 'with 1.0.a' do
|
153
207
|
let(:version) { '1.0.a' }
|
154
|
-
it { expect { subject }.to raise_error Halite::
|
208
|
+
it { expect { subject }.to raise_error Halite::InvalidDependencyError }
|
155
209
|
end
|
156
210
|
|
157
211
|
context 'with 1.2.3.4' do
|
158
212
|
let(:version) { '1.2.3.4' }
|
159
|
-
it { expect { subject }.to raise_error Halite::
|
213
|
+
it { expect { subject }.to raise_error Halite::InvalidDependencyError }
|
160
214
|
end
|
161
215
|
|
162
216
|
context 'with 1.2.3' do
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'chef/resource'
|
18
|
+
require 'chef/provider'
|
19
|
+
require 'poise'
|
20
|
+
|
21
|
+
|
22
|
+
# A `halite_test_poise` resource for use in Halite's unit tests.
|
23
|
+
module HaliteTestPoise
|
24
|
+
class Resource < Chef::Resource
|
25
|
+
include Poise
|
26
|
+
provides(:halite_test_poise)
|
27
|
+
actions(:run)
|
28
|
+
end
|
29
|
+
|
30
|
+
class Provider < Chef::Provider
|
31
|
+
include Poise
|
32
|
+
provides(:halite_test_poise)
|
33
|
+
|
34
|
+
def action_run
|
35
|
+
notifying_block do
|
36
|
+
ruby_block new_resource.name do
|
37
|
+
block { }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'chef/resource'
|
18
|
+
require 'chef/provider'
|
19
|
+
|
20
|
+
|
21
|
+
# A `halite_test_simple` resource for use in Halite's unit tests.
|
22
|
+
class Chef
|
23
|
+
class Resource::HaliteTestSimple < Resource
|
24
|
+
provides(:halite_test_simple) # For Chef >= 12.4
|
25
|
+
|
26
|
+
def initialize(*args)
|
27
|
+
super
|
28
|
+
@resource_name = :halite_test_simple
|
29
|
+
@action = :run
|
30
|
+
@allowed_actions << :run
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class Provider::HaliteTestSimple < Provider
|
35
|
+
include Chef::DSL::Recipe
|
36
|
+
|
37
|
+
provides(:halite_test_simple) # For Chef >= 12.4
|
38
|
+
|
39
|
+
def load_current_resource
|
40
|
+
end
|
41
|
+
|
42
|
+
def action_run
|
43
|
+
ruby_block new_resource.name do
|
44
|
+
block { }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
File without changes
|
data/spec/{data/gems/test1/lib → fixtures/cookbooks/test1/files/halite_gem}/test1/version.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/{data/gems/test2/lib → fixtures/cookbooks/test2/files/halite_gem}/test2/resource.rb
RENAMED
File without changes
|
data/spec/{data/gems/test2/lib → fixtures/cookbooks/test2/files/halite_gem}/test2/version.rb
RENAMED
File without changes
|