codestrap 0.1.0 → 0.2.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/README.md +2 -2
- data/codestrap.gemspec +11 -2
- data/lib/codestrap.rb +96 -0
- data/lib/codestrap/cli.rb +11 -1
- data/lib/codestrap/config.rb +18 -8
- data/lib/codestrap/version.rb +1 -1
- metadata +47 -222
- data/.gitignore +0 -20
- data/.travis.yml +0 -4
- data/Gemfile +0 -6
- data/LICENSE.txt +0 -13
- data/Rakefile +0 -51
- data/config/projects/codestrap.rb +0 -22
- data/config/software/codestrap.rb +0 -20
- data/config/software/ruby.rb +0 -247
- data/config/software/zlib.rb +0 -86
- data/features/client.feature +0 -99
- data/features/fixtures/client/home/codestrap/bin/.empty +0 -0
- data/features/fixtures/client/home/codestrap/content/bash.erb +0 -3
- data/features/fixtures/client/home/codestrap/content/gem/dir/file +0 -0
- data/features/fixtures/client/home/codestrap/content/gem/dir/template +0 -3
- data/features/fixtures/client/home/codestrap/content/gem/file +0 -1
- data/features/fixtures/client/home/codestrap/content/gem/template +0 -3
- data/features/fixtures/client/home/codestrap/content/local_remote.erb +0 -1
- data/features/fixtures/client/home/codestrap/content/local_remote/dir/file +0 -0
- data/features/fixtures/client/home/codestrap/content/local_remote/dir/template +0 -3
- data/features/fixtures/client/home/codestrap/content/local_remote/file +0 -1
- data/features/fixtures/client/home/codestrap/content/local_remote/template +0 -3
- data/features/fixtures/client/home/codestrap/objects/local.json +0 -3
- data/features/fixtures/client/output/.empty +0 -0
- data/features/fixtures/client/var/lib/codestrap/bin/.empty +0 -0
- data/features/fixtures/client/var/lib/codestrap/content/bashremote.erb +0 -3
- data/features/fixtures/client/var/lib/codestrap/content/gemremote/dir/file +0 -0
- data/features/fixtures/client/var/lib/codestrap/content/gemremote/dir/template +0 -3
- data/features/fixtures/client/var/lib/codestrap/content/gemremote/file +0 -0
- data/features/fixtures/client/var/lib/codestrap/content/gemremote/template +0 -3
- data/features/fixtures/client/var/lib/codestrap/content/remote_local.erb +0 -1
- data/features/fixtures/client/var/lib/codestrap/content/remote_local/dir/file +0 -0
- data/features/fixtures/client/var/lib/codestrap/content/remote_local/dir/template +0 -3
- data/features/fixtures/client/var/lib/codestrap/content/remote_local/file +0 -1
- data/features/fixtures/client/var/lib/codestrap/content/remote_local/template +0 -3
- data/features/fixtures/client/var/lib/codestrap/content/remote_remote.erb +0 -1
- data/features/fixtures/client/var/lib/codestrap/content/remote_remote/dir/file +0 -0
- data/features/fixtures/client/var/lib/codestrap/content/remote_remote/dir/template +0 -3
- data/features/fixtures/client/var/lib/codestrap/content/remote_remote/file +0 -0
- data/features/fixtures/client/var/lib/codestrap/content/remote_remote/template +0 -3
- data/features/fixtures/client/var/lib/codestrap/objects/remote.json +0 -3
- data/features/fixtures/logging/home/logging/codestrap/bin/stubdirectory/.empty +0 -0
- data/features/fixtures/logging/home/logging/codestrap/bin/stubnotlink +0 -0
- data/features/fixtures/logging/home/logging/codestrap/content/.empty +0 -0
- data/features/fixtures/logging/home/logging/codestrap/objects/.empty +0 -0
- data/features/fixtures/server/mixed/var/lib/stub/content/address.erb +0 -3
- data/features/fixtures/server/mixed/var/lib/stub/content/cell.erb +0 -3
- data/features/fixtures/server/mixed/var/lib/stub/content/email.erb +0 -3
- data/features/fixtures/server/mixed/var/lib/stub/content/mobile.erb +0 -3
- data/features/fixtures/server/mixed/var/lib/stub/content/name.erb +0 -3
- data/features/fixtures/server/mixed/var/lib/stub/content/phone.erb +0 -3
- data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/Modulefile +0 -12
- data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/README +0 -17
- data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/manifests/init.pp +0 -42
- data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/spec/spec_helper.rb +0 -18
- data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/tests/init.pp +0 -13
- data/features/fixtures/server/mixed/var/lib/stub/objects/contact.json +0 -8
- data/features/fixtures/server/mixed/var/lib/stub/objects/shadow/contact.json +0 -8
- data/features/fixtures/strap/projects/etc/.empty +0 -0
- data/features/fixtures/strap/projects/home/user/dir/bin/.empty +0 -0
- data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/Modulefile +0 -12
- data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/README +0 -17
- data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/manifests/:stub:project.name:/subclass.pp +0 -3
- data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/manifests/init.pp +0 -42
- data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/spec/spec_helper.rb +0 -18
- data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/tests/init.pp +0 -13
- data/features/fixtures/strap/projects/home/user/dir/objects/contact.json +0 -8
- data/features/fixtures/strap/projects/home/user/dir/objects/shadow/contact.json +0 -8
- data/features/fixtures/strap/projects/output/.empty +0 -0
- data/features/fixtures/stub/contact/etc/.empty +0 -0
- data/features/fixtures/stub/contact/home/user/dir/bin/.empty +0 -0
- data/features/fixtures/stub/contact/home/user/dir/content/address.erb +0 -3
- data/features/fixtures/stub/contact/home/user/dir/content/cell.erb +0 -3
- data/features/fixtures/stub/contact/home/user/dir/content/email.erb +0 -3
- data/features/fixtures/stub/contact/home/user/dir/content/mobile.erb +0 -3
- data/features/fixtures/stub/contact/home/user/dir/content/name.erb +0 -3
- data/features/fixtures/stub/contact/home/user/dir/content/phone.erb +0 -3
- data/features/fixtures/stub/contact/home/user/dir/objects/contact.json +0 -8
- data/features/fixtures/stub/contact/home/user/dir/objects/shadow/contact.json +0 -8
- data/features/fixtures/stub/contact/output/.empty +0 -0
- data/features/fixtures/stub/date/etc/.empty +0 -0
- data/features/fixtures/stub/date/home/user/stub/bin/.empty +0 -0
- data/features/fixtures/stub/date/home/user/stub/content/day.erb +0 -3
- data/features/fixtures/stub/date/home/user/stub/content/hour.erb +0 -3
- data/features/fixtures/stub/date/home/user/stub/content/minute.erb +0 -3
- data/features/fixtures/stub/date/home/user/stub/content/month.erb +0 -3
- data/features/fixtures/stub/date/home/user/stub/content/second.erb +0 -3
- data/features/fixtures/stub/date/home/user/stub/content/year.erb +0 -3
- data/features/fixtures/stub/date/home/user/stub/objects/.empty +0 -0
- data/features/fixtures/stub/date/output/.empty +0 -0
- data/features/fixtures/stub/script/etc/.empty +0 -0
- data/features/fixtures/stub/script/home/user/stub/bin/.empty +0 -0
- data/features/fixtures/stub/script/home/user/stub/content/credentials.erb +0 -6
- data/features/fixtures/stub/script/home/user/stub/objects/credentials.rb +0 -11
- data/features/fixtures/stub/script/output/.empty +0 -0
- data/features/logging.feature +0 -39
- data/features/object_scripts.feature +0 -13
- data/features/server.feature +0 -36
- data/features/step_definitions/client_steps.rb +0 -99
- data/features/step_definitions/logging_steps.rb +0 -65
- data/features/step_definitions/object_scripts_steps.rb +0 -26
- data/features/step_definitions/server_steps.rb +0 -112
- data/features/step_definitions/strap_steps.rb +0 -69
- data/features/step_definitions/stub_option_simple_steps.rb +0 -31
- data/features/step_definitions/stub_steps.rb +0 -94
- data/features/strap.feature +0 -34
- data/features/stub.feature +0 -157
- data/features/stub_option_simple.feature +0 -14
- data/features/stub_packages.feature +0 -15
- data/features/support/env.rb +0 -197
- data/omnibus.rb +0 -53
- data/package-scripts/codestrap/postinst +0 -25
- data/package-scripts/codestrap/postrm +0 -17
- data/package-scripts/codestrap/preinst +0 -7
- data/package-scripts/codestrap/prerm +0 -15
- data/resources/codestrap/pkg/background.png +0 -0
- data/resources/codestrap/pkg/distribution.xml.erb +0 -22
- data/resources/codestrap/pkg/license.html.erb +0 -202
- data/resources/codestrap/pkg/welcome.html.erb +0 -7
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
#Given(/^server environment variables "([^"]*)"$/) do |etc|
|
|
2
|
-
# ENV['CODESTRAP_ETC'] = @etc = etc
|
|
3
|
-
#end
|
|
4
|
-
|
|
5
|
-
Given(/^server tmp directory$/) do
|
|
6
|
-
unless @server_tmp
|
|
7
|
-
@server_tmp = Dir.mktmpdir
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
And(/^server fixtures file "([^"]*)" with:$/) do |yaml, text|
|
|
12
|
-
@server_fixture_file = File.join(@server_tmp, yaml)
|
|
13
|
-
file = File.open(@server_fixture_file, 'w')
|
|
14
|
-
file.write(text)
|
|
15
|
-
file.close
|
|
16
|
-
@fixture_hash = YAML.load(text)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
And(/^server fixture "([^"]+)"$/) do |number|
|
|
20
|
-
@fixture_idx = number.to_i
|
|
21
|
-
@fixture_cur = @fixture_hash[@fixture_idx]
|
|
22
|
-
@type = @fixture_cur['type']
|
|
23
|
-
@template = @fixture_cur['template']
|
|
24
|
-
sf_content = @fixture_cur['codestrapfile']
|
|
25
|
-
sf_path = File.join(@server_tmp, 'Codestrapfile')
|
|
26
|
-
sf_file = File.open(sf_path, 'w')
|
|
27
|
-
sf_file.write(sf_content)
|
|
28
|
-
sf_file.close
|
|
29
|
-
ENV['CODESTRAPFILE']=sf_path
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
And(/^server capbility rest "(\/rest\/capability\.json)" is valid$/) do |url|
|
|
33
|
-
get url
|
|
34
|
-
expect(last_response.ok?).to be_truthy
|
|
35
|
-
@capability = JSON.parse(last_response.body)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
And(/^server object rest "(\/rest\/objects\.json)" is valid$/) do |url|
|
|
39
|
-
get url
|
|
40
|
-
expect(last_response.ok?).to be_truthy
|
|
41
|
-
@codestrap_objects = JSON.parse(last_response.body)
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
And(/^server stub metadata rest "(\/rest\/stub\/metadata\.json)" is valid$/) do |url|
|
|
45
|
-
get url
|
|
46
|
-
expect(last_response.ok?).to be_truthy
|
|
47
|
-
@codestrap_metadata = JSON.parse(last_response.body)
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
And(/^server strap metadata rest "(\/rest\/strap\/metadata\.json)" is valid$/) do |url|
|
|
51
|
-
get url
|
|
52
|
-
expect(last_response.ok?).to be_truthy
|
|
53
|
-
@strap_metadata = JSON.parse(last_response.body)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
And(/^server list contains the correct keys$/) do
|
|
57
|
-
case @type
|
|
58
|
-
when 'stub'
|
|
59
|
-
expect(@codestrap_metadata).to have_key(@template)
|
|
60
|
-
when 'strap'
|
|
61
|
-
expect(@strap_metadata).to have_key(@template)
|
|
62
|
-
else
|
|
63
|
-
raise 'Error unknown type'
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
Then(/^server file should contain the correct content$/) do
|
|
68
|
-
if @type == 'stub'
|
|
69
|
-
get @capability['urls']['stub']['file'] + '/' + @template
|
|
70
|
-
|
|
71
|
-
potentials = Array(Codestrapfile.server.content).map { |dir| File.join(dir,@template + '.erb') }
|
|
72
|
-
file = potentials.select { |f| File.exist? f }.first
|
|
73
|
-
expect(file).to be_truthy
|
|
74
|
-
|
|
75
|
-
file_sum = File.read(file)
|
|
76
|
-
body_sum = last_response.body
|
|
77
|
-
|
|
78
|
-
expect(body_sum).to eql(file_sum)
|
|
79
|
-
end
|
|
80
|
-
if @type == 'strap'
|
|
81
|
-
# Fetch metadata
|
|
82
|
-
get @capability['urls']['strap']['metadata']
|
|
83
|
-
expect(last_response.ok?).to be_truthy
|
|
84
|
-
metadata = JSON.parse(last_response.body)[@template]
|
|
85
|
-
|
|
86
|
-
tmpdir = Dir.mktmpdir
|
|
87
|
-
|
|
88
|
-
# Make directories
|
|
89
|
-
metadata['files'].each do |file|
|
|
90
|
-
next unless file['ftype'].eql?('directory')
|
|
91
|
-
FileUtils.mkdir_p File.join(tmpdir, file['file'])
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
# Make files
|
|
95
|
-
metadata['files'].each do |file|
|
|
96
|
-
next unless file['ftype'] == 'file'
|
|
97
|
-
get @capability['urls']['strap']['project'] + "/#{@template}/" + file['file']
|
|
98
|
-
expect(last_response.ok?).to be_truthy
|
|
99
|
-
File.open(File.join(tmpdir, file['file']), 'w') do |fh|
|
|
100
|
-
fh.write last_response.body
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
potentials = Array(Codestrapfile.server.content).map { |dir| File.join(dir,@template) }
|
|
105
|
-
strap_dir = potentials.select { |f| File.directory? f }.first
|
|
106
|
-
expect(diff_tree?(strap_dir, tmpdir)).to eq(0)
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
And(/^server returns the right http code$/) do
|
|
111
|
-
expect(last_response.ok?).to be_truthy
|
|
112
|
-
end
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
Given(/^a boilerplate path directory "([^"]*)"$/) do |path|
|
|
2
|
-
@testtools.path_reset
|
|
3
|
-
@testtools.path_unshift(path)
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
And(/^a boilerplate fixture (\d+)$/) do |num|
|
|
7
|
-
@fixture_idx = num.to_i
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
And(/^a boilerplate tmp directory$/) do
|
|
11
|
-
unless @strap_tmpdir
|
|
12
|
-
@strap_tmpdir = Dir.mktmpdir
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
And(/^a boilerplate codestrapfile named "([^"]*)" with:$/) do |codestrapfile, text|
|
|
17
|
-
codestrapfile_path = File.join(@strap_tmpdir, codestrapfile)
|
|
18
|
-
unless File.exist? codestrapfile_path
|
|
19
|
-
file = File.new(codestrapfile_path, 'w')
|
|
20
|
-
file.write(text)
|
|
21
|
-
file.close
|
|
22
|
-
end
|
|
23
|
-
ENV['CODESTRAPFILE']=codestrapfile_path
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
And(/^a boilerplate fixtures file named "([^"]*)" with:$/) do |json, text|
|
|
27
|
-
@fixtures = File.join(@strap_tmpdir, json)
|
|
28
|
-
unless File.exist? @fixtures
|
|
29
|
-
file = File.open(@fixtures, 'w')
|
|
30
|
-
file.write(text)
|
|
31
|
-
file.close
|
|
32
|
-
end
|
|
33
|
-
@fixture_hash = YAML.load(File.read(@fixtures))[@fixture_idx]
|
|
34
|
-
@clear = @fixture_hash['clear'] == 'true'
|
|
35
|
-
@command = @fixture_hash['command']
|
|
36
|
-
@output = @fixture_hash['output']
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
When(/^boilerplate generate command is executed$/) do
|
|
40
|
-
capture = Capture::Cli.inline do
|
|
41
|
-
args = %w(strap --generate)
|
|
42
|
-
Codestrap::Core.new(args).execute!
|
|
43
|
-
end
|
|
44
|
-
expect(capture.object_exit.status).to eql(0)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
And(/^boilerplate command is run$/) do
|
|
48
|
-
if @clear
|
|
49
|
-
FileUtils.rm_rf @output
|
|
50
|
-
end
|
|
51
|
-
@capture = Capture::Cli.inline do
|
|
52
|
-
args = [@command, @output]
|
|
53
|
-
Codestrap::Core.new(args).execute!
|
|
54
|
-
end
|
|
55
|
-
expect(File.directory?(@output)).to be_truthy
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
Then(/^boilerplate contains interpolated values$/) do
|
|
59
|
-
Tools::Test.contents(@fixture_hash['test']) do |content, str, bool|
|
|
60
|
-
case bool
|
|
61
|
-
when 'true'
|
|
62
|
-
expect(content).to include(str)
|
|
63
|
-
when 'false'
|
|
64
|
-
expect(content).not_to include(str)
|
|
65
|
-
else
|
|
66
|
-
fail "Expecting boolean got #{bool.to_s}"
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
When(/^the command "(strap)" with option "([^"]+)" is executed/) do |cmd, opt|
|
|
2
|
-
@testtools.path_reset
|
|
3
|
-
@testtools.path_unshift(BINDIR)
|
|
4
|
-
@cap_simple = Capture::Cli.inline do
|
|
5
|
-
args = [cmd, opt]
|
|
6
|
-
Codestrap::Core.new(args).execute!
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
Then(/^the option output is greater then (\d+) bytes$/) do |size|
|
|
11
|
-
expect(@cap_simple.stdout.length).to be > size.to_i
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
And(/^the option option exit status should be (\d+)$/) do |status|
|
|
15
|
-
expect(@cap_simple.object_exit.status.to_i).to eq(status.to_i)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
When(/^the version is requested through the "(.*?)" option \-\-version is provided$/) do |cmd|
|
|
19
|
-
@cap_version = Capture::Cli.new(true, false).inline do
|
|
20
|
-
args = [cmd, '--version']
|
|
21
|
-
Codestrap::Core.new(args).execute!
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
Then(/^the version option exit status is (\d+)$/) do |status|
|
|
26
|
-
expect(@cap_version.object_exit.status).to eq(status.to_i)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
And(/^a version number is outputed$/) do
|
|
30
|
-
expect(@cap_version.stdout.chomp).to eql(Codestrap::VERSION)
|
|
31
|
-
end
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
Given(/^a stub tmp directory$/) do
|
|
2
|
-
unless @codestrap_tmp
|
|
3
|
-
@codestrap_tmp = Dir.mktmpdir
|
|
4
|
-
end
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
And(/^a stub fixtures file "([^"]*)" with:$/) do |yaml, text|
|
|
8
|
-
@codestrap_fixtures = File.join(@codestrap_tmp, yaml)
|
|
9
|
-
file = File.open(@codestrap_fixtures, 'w')
|
|
10
|
-
file.write(text)
|
|
11
|
-
file.close
|
|
12
|
-
@fixture_hash = YAML.load(text)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
And(/^a stub fixture "([^"]+)"$/) do |command|
|
|
16
|
-
@command = command
|
|
17
|
-
@fixture_cur = @fixture_hash[@command]
|
|
18
|
-
@links = @fixture_cur['links']
|
|
19
|
-
@clear = @fixture_cur['clear']
|
|
20
|
-
@output = @fixture_cur['output']
|
|
21
|
-
@test = @fixture_cur['test']
|
|
22
|
-
sf_content = @fixture_cur['codestrapfile']
|
|
23
|
-
sf_path = File.join(@codestrap_tmp, 'Codestrapfile')
|
|
24
|
-
sf_file = File.open(sf_path, 'w')
|
|
25
|
-
sf_file.write sf_content
|
|
26
|
-
sf_file.close
|
|
27
|
-
ENV['CODESTRAPFILE']=sf_path
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
And(/^stub env variable for PATH$/) do
|
|
31
|
-
@testtools.path_reset
|
|
32
|
-
@testtools.path_unshift(@links)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
#And(/^codestrap env variable CODESTRAP_CONF="([^"]*)"$/) do |codestrapconf|
|
|
36
|
-
# ENV['CODESTRAP_CONF'] = codestrapconf
|
|
37
|
-
#end
|
|
38
|
-
#
|
|
39
|
-
#And(/^codestrap env variable CODESTRAP_ETC="([^"]+)"$/) do |codestrapetc|
|
|
40
|
-
# ENV['CODESTRAP_ETC'] = @codestrapetc = codestrapetc
|
|
41
|
-
#end
|
|
42
|
-
#
|
|
43
|
-
#And(/^codestrap env variable HOME="(codestrap\/contact\/home\/user)"$/) do |home|
|
|
44
|
-
# ENV['HOME'] = @codestraphome = home
|
|
45
|
-
#end
|
|
46
|
-
#
|
|
47
|
-
#And(/^a interpolation template named "([^"]*)"$/) do |templatefile|
|
|
48
|
-
# templatefile =~ /(.erb)$/
|
|
49
|
-
# suffix = $1 if $1
|
|
50
|
-
# @basename = File.basename(templatefile)
|
|
51
|
-
# FileUtils.install File.join(FIXTURES, templatefile), File.join(@codestrapetc, @basename)
|
|
52
|
-
# if suffix
|
|
53
|
-
# @cmd = 'codestrap' + File.basename(templatefile, suffix)
|
|
54
|
-
# else
|
|
55
|
-
# @cmd = 'codestrap' + File.basename(templatefile)
|
|
56
|
-
# end
|
|
57
|
-
#end
|
|
58
|
-
|
|
59
|
-
When(/^generate$/) do
|
|
60
|
-
@cap_generate_interpolate_links = Capture::Cli.inline do
|
|
61
|
-
args = %w(strap --generate)
|
|
62
|
-
Codestrap::Core.new(args).execute!
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
And(/^clear previous files$/) do
|
|
67
|
-
if @clear and File.exist? @output
|
|
68
|
-
File.unlink @output
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
And(/^template is run with output$/) do
|
|
73
|
-
@cap_interpolate_contact_output = Capture::Cli.inline do
|
|
74
|
-
args = [@command, @output]
|
|
75
|
-
Codestrap::Core.new(args).execute!
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
Then(/^contains interpolated values$/) do
|
|
80
|
-
@test.each_pair do |str, bool|
|
|
81
|
-
case bool
|
|
82
|
-
when true
|
|
83
|
-
expect(File.read(@output)).to include(str)
|
|
84
|
-
when false
|
|
85
|
-
expect(File.read(@output)).not_to include(str)
|
|
86
|
-
else
|
|
87
|
-
fail 'Invalid check'
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
And(/^the exit status is (\d+)$/) do |status|
|
|
93
|
-
expect(@cap_interpolate_contact_output.object_exit.status.to_i).to eq(status.to_i)
|
|
94
|
-
end
|
data/features/strap.feature
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
Feature: Supports straps
|
|
2
|
-
As a user I want a command that supports creation
|
|
3
|
-
of a software project structure containing template output
|
|
4
|
-
that has interpolated objects
|
|
5
|
-
|
|
6
|
-
Scenario Outline: create a new project
|
|
7
|
-
Given a boilerplate path directory "strap/projects/home/user/dir/bin"
|
|
8
|
-
And a boilerplate fixture <number>
|
|
9
|
-
And a boilerplate tmp directory
|
|
10
|
-
And a boilerplate codestrapfile named "Codestrapfile" with:
|
|
11
|
-
"""
|
|
12
|
-
Codestrapfile.config do |conf|
|
|
13
|
-
conf.local.base = ['strap/projects/home/user/dir']
|
|
14
|
-
end
|
|
15
|
-
"""
|
|
16
|
-
And a boilerplate fixtures file named "fixtures.yaml" with:
|
|
17
|
-
"""
|
|
18
|
-
---
|
|
19
|
-
- clear: 'true'
|
|
20
|
-
command: strappuppetmodule
|
|
21
|
-
output: strap/projects/output/newpuppet
|
|
22
|
-
test:
|
|
23
|
-
strap/projects/output/newpuppet/Modulefile:
|
|
24
|
-
Michonne: 'true'
|
|
25
|
-
strap/projects/output/newpuppet/manifests/init.pp:
|
|
26
|
-
Michonne: 'true'
|
|
27
|
-
dpgrps@gmail.com: 'true'
|
|
28
|
-
"""
|
|
29
|
-
When boilerplate generate command is executed
|
|
30
|
-
And boilerplate command is run
|
|
31
|
-
Then boilerplate contains interpolated values
|
|
32
|
-
Examples:
|
|
33
|
-
| number |
|
|
34
|
-
| 0 |
|
data/features/stub.feature
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
Feature: Supports stubs
|
|
2
|
-
As a user I want a command that supports file stubs
|
|
3
|
-
of text files
|
|
4
|
-
that contain interpolated objects
|
|
5
|
-
|
|
6
|
-
Scenario Outline: stub creation
|
|
7
|
-
Given a stub tmp directory
|
|
8
|
-
And a stub fixtures file "fixtures.yaml" with:
|
|
9
|
-
"""
|
|
10
|
-
stubaddress:
|
|
11
|
-
clear: true
|
|
12
|
-
links: stub/contact/home/user/dir/bin
|
|
13
|
-
output: stub/contact/output/address
|
|
14
|
-
codestrapfile: |
|
|
15
|
-
Codestrapfile.config do |conf|
|
|
16
|
-
conf.local.base = ['stub/contact/home/user/dir']
|
|
17
|
-
end
|
|
18
|
-
test:
|
|
19
|
-
'10 Downing Street': true
|
|
20
|
-
stubcell:
|
|
21
|
-
clear: true
|
|
22
|
-
links: stub/contact/home/user/dir/bin
|
|
23
|
-
output: stub/contact/output/cell
|
|
24
|
-
codestrapfile: |
|
|
25
|
-
Codestrapfile.config do |conf|
|
|
26
|
-
conf.local.base = ['stub/contact/home/user/dir']
|
|
27
|
-
end
|
|
28
|
-
test:
|
|
29
|
-
'0555 5555 5555': true
|
|
30
|
-
stubemail:
|
|
31
|
-
clear: true
|
|
32
|
-
links: stub/contact/home/user/dir/bin
|
|
33
|
-
output: stub/contact/output/email
|
|
34
|
-
codestrapfile: |
|
|
35
|
-
Codestrapfile.config do |conf|
|
|
36
|
-
conf.local.base = ['stub/contact/home/user/dir']
|
|
37
|
-
end
|
|
38
|
-
test:
|
|
39
|
-
'dpgrps@gmail.com': true
|
|
40
|
-
stubmobile:
|
|
41
|
-
clear: true
|
|
42
|
-
links: stub/contact/home/user/dir/bin
|
|
43
|
-
output: stub/contact/output/mobile
|
|
44
|
-
codestrapfile: |
|
|
45
|
-
Codestrapfile.config do |conf|
|
|
46
|
-
conf.local.base = ['stub/contact/home/user/dir']
|
|
47
|
-
end
|
|
48
|
-
test:
|
|
49
|
-
'0444 4444 4444': true
|
|
50
|
-
stubname:
|
|
51
|
-
clear: true
|
|
52
|
-
links: stub/contact/home/user/dir/bin
|
|
53
|
-
output: stub/contact/output/name
|
|
54
|
-
codestrapfile: |
|
|
55
|
-
Codestrapfile.config do |conf|
|
|
56
|
-
conf.local.base = ['stub/contact/home/user/dir']
|
|
57
|
-
end
|
|
58
|
-
test:
|
|
59
|
-
'Full Name': true
|
|
60
|
-
stubphone:
|
|
61
|
-
clear: true
|
|
62
|
-
links: stub/contact/home/user/dir/bin
|
|
63
|
-
output: stub/contact/output/phone
|
|
64
|
-
codestrapfile: |
|
|
65
|
-
Codestrapfile.config do |conf|
|
|
66
|
-
conf.local.base = ['stub/contact/home/user/dir']
|
|
67
|
-
end
|
|
68
|
-
test:
|
|
69
|
-
'7777 7777': true
|
|
70
|
-
stubyear:
|
|
71
|
-
clear: true
|
|
72
|
-
links: stub/date/home/user/stub/bin
|
|
73
|
-
output: stub/date/output/year
|
|
74
|
-
codestrapfile: |
|
|
75
|
-
Codestrapfile.config do |conf|
|
|
76
|
-
conf.local.base = ['stub/date/home/user/stub']
|
|
77
|
-
end
|
|
78
|
-
test: {}
|
|
79
|
-
stubmonth:
|
|
80
|
-
clear: true
|
|
81
|
-
links: stub/date/home/user/stub/bin
|
|
82
|
-
output: stub/date/output/month
|
|
83
|
-
codestrapfile: |
|
|
84
|
-
Codestrapfile.config do |conf|
|
|
85
|
-
conf.local.base = ['stub/date/home/user/stub']
|
|
86
|
-
end
|
|
87
|
-
test: {}
|
|
88
|
-
stubday:
|
|
89
|
-
clear: true
|
|
90
|
-
links: stub/date/home/user/stub/bin
|
|
91
|
-
output: stub/date/output/day
|
|
92
|
-
codestrapfile: |
|
|
93
|
-
Codestrapfile.config do |conf|
|
|
94
|
-
conf.local.base = ['stub/date/home/user/stub']
|
|
95
|
-
end
|
|
96
|
-
test: {}
|
|
97
|
-
stubhour:
|
|
98
|
-
clear: true
|
|
99
|
-
links: stub/date/home/user/stub/bin
|
|
100
|
-
output: stub/date/output/hour
|
|
101
|
-
codestrapfile: |
|
|
102
|
-
Codestrapfile.config do |conf|
|
|
103
|
-
conf.local.base = ['stub/date/home/user/stub']
|
|
104
|
-
end
|
|
105
|
-
test: {}
|
|
106
|
-
stubminute:
|
|
107
|
-
clear: true
|
|
108
|
-
links: stub/date/home/user/stub/bin
|
|
109
|
-
output: stub/date/output/minute
|
|
110
|
-
codestrapfile: |
|
|
111
|
-
Codestrapfile.config do |conf|
|
|
112
|
-
conf.local.base = ['stub/date/home/user/stub']
|
|
113
|
-
end
|
|
114
|
-
test: {}
|
|
115
|
-
stubsecond:
|
|
116
|
-
clear: true
|
|
117
|
-
links: stub/date/home/user/stub/bin
|
|
118
|
-
output: stub/date/output/second
|
|
119
|
-
codestrapfile: |
|
|
120
|
-
Codestrapfile.config do |conf|
|
|
121
|
-
conf.local.base = ['stub/date/home/user/stub']
|
|
122
|
-
end
|
|
123
|
-
test: {}
|
|
124
|
-
stubcredentials:
|
|
125
|
-
clear: true
|
|
126
|
-
links: stub/script/home/user/stub/bin
|
|
127
|
-
output: stub/script/output/credentials
|
|
128
|
-
codestrapfile: |
|
|
129
|
-
Codestrapfile.config do |conf|
|
|
130
|
-
conf.local.base = ['stub/script/home/user/stub']
|
|
131
|
-
end
|
|
132
|
-
test:
|
|
133
|
-
'noreply@nodomain.com': true
|
|
134
|
-
'secret': true
|
|
135
|
-
"""
|
|
136
|
-
And a stub fixture "<command>"
|
|
137
|
-
And stub env variable for PATH
|
|
138
|
-
When generate
|
|
139
|
-
And clear previous files
|
|
140
|
-
And template is run with output
|
|
141
|
-
Then contains interpolated values
|
|
142
|
-
And the exit status is 0
|
|
143
|
-
Examples:
|
|
144
|
-
| command |
|
|
145
|
-
| stubaddress |
|
|
146
|
-
| stubcell |
|
|
147
|
-
| stubemail |
|
|
148
|
-
| stubmobile |
|
|
149
|
-
| stubname |
|
|
150
|
-
| stubphone |
|
|
151
|
-
| stubyear |
|
|
152
|
-
| stubmonth |
|
|
153
|
-
| stubday |
|
|
154
|
-
| stubhour |
|
|
155
|
-
| stubminute |
|
|
156
|
-
| stubsecond |
|
|
157
|
-
| stubcredentials |
|