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,19 +0,0 @@
|
|
1
|
-
module Halite
|
2
|
-
module Converter
|
3
|
-
module Other
|
4
|
-
|
5
|
-
def self.write(spec, base_path)
|
6
|
-
spec.each_file('chef') do |path, rel_path|
|
7
|
-
dir_path = File.dirname(rel_path)
|
8
|
-
FileUtils.mkdir_p(File.join(base_path, dir_path)) unless dir_path == '.'
|
9
|
-
File.open(path, 'rb') do |in_f|
|
10
|
-
File.open(File.join(base_path, rel_path), 'wb') do |out_f|
|
11
|
-
IO.copy_stream(in_f, out_f)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Halite
|
2
|
-
module Converter
|
3
|
-
module Readme
|
4
|
-
|
5
|
-
def self.write(spec, base_path)
|
6
|
-
readme_path = %w{README.md README README.txt readme.md readme readme.txt}.map do |name|
|
7
|
-
File.join(spec.full_gem_path, name)
|
8
|
-
end.find {|path| File.exists?(path) }
|
9
|
-
if readme_path
|
10
|
-
File.open(readme_path, 'rb') do |in_f|
|
11
|
-
File.open(File.join(base_path, File.basename(readme_path)), 'wb') do |out_f|
|
12
|
-
IO.copy_stream(in_f, out_f)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'halite/converter/other'
|
3
|
-
|
4
|
-
describe Halite::Converter::Other do
|
5
|
-
|
6
|
-
describe '#write' do
|
7
|
-
let(:files) { [] }
|
8
|
-
let(:input) { [] }
|
9
|
-
let(:output) { [] }
|
10
|
-
let(:spec) do
|
11
|
-
spec = double(name: 'mygem')
|
12
|
-
allow(spec).to receive(:each_file) do |&block|
|
13
|
-
files.each {|path| block.call(File.join('/source', path), path) }
|
14
|
-
end
|
15
|
-
spec
|
16
|
-
end
|
17
|
-
before do
|
18
|
-
files.each do |path|
|
19
|
-
input_sentinel = double("content of #{path}")
|
20
|
-
output_sentinel = double("generated output for #{path}")
|
21
|
-
allow(File).to receive(:open).with(File.join('/source', path), 'rb').and_yield(input_sentinel)
|
22
|
-
input << input_sentinel
|
23
|
-
output << output_sentinel
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context 'with a single file' do
|
28
|
-
let(:files) { ['recipes/default.rb'] }
|
29
|
-
|
30
|
-
it 'writes a single file' do
|
31
|
-
expect(FileUtils).to receive(:mkdir_p).with('/test/recipes')
|
32
|
-
expect(File).to receive(:open).with('/test/recipes/default.rb', 'wb').and_yield(output[0])
|
33
|
-
expect(IO).to receive(:copy_stream).with(input[0], output[0])
|
34
|
-
described_class.write(spec, '/test')
|
35
|
-
end
|
36
|
-
end # /context with a single file
|
37
|
-
|
38
|
-
context 'with multiple files' do
|
39
|
-
let(:files) { ['attributes.rb', 'recipes/default.rb', 'templates/default/conf.erb'] }
|
40
|
-
|
41
|
-
it 'writes multiple files' do
|
42
|
-
expect(FileUtils).to receive(:mkdir_p).with('/test/recipes')
|
43
|
-
expect(FileUtils).to receive(:mkdir_p).with('/test/templates/default')
|
44
|
-
expect(File).to receive(:open).with('/test/attributes.rb', 'wb').and_yield(output[0])
|
45
|
-
expect(IO).to receive(:copy_stream).with(input[0], output[0])
|
46
|
-
expect(File).to receive(:open).with('/test/recipes/default.rb', 'wb').and_yield(output[1])
|
47
|
-
expect(IO).to receive(:copy_stream).with(input[1], output[1])
|
48
|
-
expect(File).to receive(:open).with('/test/templates/default/conf.erb', 'wb').and_yield(output[2])
|
49
|
-
expect(IO).to receive(:copy_stream).with(input[2], output[2])
|
50
|
-
described_class.write(spec, '/test')
|
51
|
-
end
|
52
|
-
end # /context with a single file
|
53
|
-
|
54
|
-
end # /describe #write
|
55
|
-
|
56
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'halite/converter/readme'
|
3
|
-
|
4
|
-
describe Halite::Converter::Readme do
|
5
|
-
|
6
|
-
describe '#write' do
|
7
|
-
let(:spec) { double(full_gem_path: '/source') }
|
8
|
-
let(:readme_file) { }
|
9
|
-
let(:input) { [] }
|
10
|
-
let(:output) { [] }
|
11
|
-
before do
|
12
|
-
allow(File).to receive(:exists?).and_return(false)
|
13
|
-
Array(readme_file).each do |path|
|
14
|
-
input_sentinel = double("content of #{path}")
|
15
|
-
output_sentinel = double("generated output for #{path}")
|
16
|
-
allow(File).to receive(:exists?).with(File.join('/source', path)).and_return(true)
|
17
|
-
allow(File).to receive(:open).with(File.join('/source', path), 'rb').and_yield(input_sentinel)
|
18
|
-
input << input_sentinel
|
19
|
-
output << output_sentinel
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context 'with a README.md' do
|
24
|
-
let(:readme_file) { 'README.md' }
|
25
|
-
|
26
|
-
it 'writes out a README.md' do
|
27
|
-
expect(File).to receive(:open).with('/test/README.md', 'wb').and_yield(output[0])
|
28
|
-
expect(IO).to receive(:copy_stream).with(input[0], output[0])
|
29
|
-
described_class.write(spec, '/test')
|
30
|
-
end
|
31
|
-
end # /context with a README.md
|
32
|
-
|
33
|
-
context 'with a README' do
|
34
|
-
let(:readme_file) { 'README' }
|
35
|
-
|
36
|
-
it 'writes out a README' do
|
37
|
-
expect(File).to receive(:open).with('/test/README', 'wb').and_yield(output[0])
|
38
|
-
expect(IO).to receive(:copy_stream).with(input[0], output[0])
|
39
|
-
described_class.write(spec, '/test')
|
40
|
-
end
|
41
|
-
end # /context with a README
|
42
|
-
|
43
|
-
context 'with multiple files' do
|
44
|
-
let(:readme_file) { %w{README.txt readme.md} }
|
45
|
-
|
46
|
-
it 'writes out a README' do
|
47
|
-
expect(File).to receive(:open).with('/test/README.txt', 'wb').and_yield(output[0])
|
48
|
-
expect(IO).to receive(:copy_stream).with(input[0], output[0])
|
49
|
-
described_class.write(spec, '/test')
|
50
|
-
end
|
51
|
-
end # /context with multiple files
|
52
|
-
|
53
|
-
end # /describe #write
|
54
|
-
|
55
|
-
end
|