codestrap 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +2 -2
  4. data/codestrap.gemspec +11 -2
  5. data/lib/codestrap.rb +96 -0
  6. data/lib/codestrap/cli.rb +11 -1
  7. data/lib/codestrap/config.rb +18 -8
  8. data/lib/codestrap/version.rb +1 -1
  9. metadata +47 -222
  10. data/.gitignore +0 -20
  11. data/.travis.yml +0 -4
  12. data/Gemfile +0 -6
  13. data/LICENSE.txt +0 -13
  14. data/Rakefile +0 -51
  15. data/config/projects/codestrap.rb +0 -22
  16. data/config/software/codestrap.rb +0 -20
  17. data/config/software/ruby.rb +0 -247
  18. data/config/software/zlib.rb +0 -86
  19. data/features/client.feature +0 -99
  20. data/features/fixtures/client/home/codestrap/bin/.empty +0 -0
  21. data/features/fixtures/client/home/codestrap/content/bash.erb +0 -3
  22. data/features/fixtures/client/home/codestrap/content/gem/dir/file +0 -0
  23. data/features/fixtures/client/home/codestrap/content/gem/dir/template +0 -3
  24. data/features/fixtures/client/home/codestrap/content/gem/file +0 -1
  25. data/features/fixtures/client/home/codestrap/content/gem/template +0 -3
  26. data/features/fixtures/client/home/codestrap/content/local_remote.erb +0 -1
  27. data/features/fixtures/client/home/codestrap/content/local_remote/dir/file +0 -0
  28. data/features/fixtures/client/home/codestrap/content/local_remote/dir/template +0 -3
  29. data/features/fixtures/client/home/codestrap/content/local_remote/file +0 -1
  30. data/features/fixtures/client/home/codestrap/content/local_remote/template +0 -3
  31. data/features/fixtures/client/home/codestrap/objects/local.json +0 -3
  32. data/features/fixtures/client/output/.empty +0 -0
  33. data/features/fixtures/client/var/lib/codestrap/bin/.empty +0 -0
  34. data/features/fixtures/client/var/lib/codestrap/content/bashremote.erb +0 -3
  35. data/features/fixtures/client/var/lib/codestrap/content/gemremote/dir/file +0 -0
  36. data/features/fixtures/client/var/lib/codestrap/content/gemremote/dir/template +0 -3
  37. data/features/fixtures/client/var/lib/codestrap/content/gemremote/file +0 -0
  38. data/features/fixtures/client/var/lib/codestrap/content/gemremote/template +0 -3
  39. data/features/fixtures/client/var/lib/codestrap/content/remote_local.erb +0 -1
  40. data/features/fixtures/client/var/lib/codestrap/content/remote_local/dir/file +0 -0
  41. data/features/fixtures/client/var/lib/codestrap/content/remote_local/dir/template +0 -3
  42. data/features/fixtures/client/var/lib/codestrap/content/remote_local/file +0 -1
  43. data/features/fixtures/client/var/lib/codestrap/content/remote_local/template +0 -3
  44. data/features/fixtures/client/var/lib/codestrap/content/remote_remote.erb +0 -1
  45. data/features/fixtures/client/var/lib/codestrap/content/remote_remote/dir/file +0 -0
  46. data/features/fixtures/client/var/lib/codestrap/content/remote_remote/dir/template +0 -3
  47. data/features/fixtures/client/var/lib/codestrap/content/remote_remote/file +0 -0
  48. data/features/fixtures/client/var/lib/codestrap/content/remote_remote/template +0 -3
  49. data/features/fixtures/client/var/lib/codestrap/objects/remote.json +0 -3
  50. data/features/fixtures/logging/home/logging/codestrap/bin/stubdirectory/.empty +0 -0
  51. data/features/fixtures/logging/home/logging/codestrap/bin/stubnotlink +0 -0
  52. data/features/fixtures/logging/home/logging/codestrap/content/.empty +0 -0
  53. data/features/fixtures/logging/home/logging/codestrap/objects/.empty +0 -0
  54. data/features/fixtures/server/mixed/var/lib/stub/content/address.erb +0 -3
  55. data/features/fixtures/server/mixed/var/lib/stub/content/cell.erb +0 -3
  56. data/features/fixtures/server/mixed/var/lib/stub/content/email.erb +0 -3
  57. data/features/fixtures/server/mixed/var/lib/stub/content/mobile.erb +0 -3
  58. data/features/fixtures/server/mixed/var/lib/stub/content/name.erb +0 -3
  59. data/features/fixtures/server/mixed/var/lib/stub/content/phone.erb +0 -3
  60. data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/Modulefile +0 -12
  61. data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/README +0 -17
  62. data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/manifests/init.pp +0 -42
  63. data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/spec/spec_helper.rb +0 -18
  64. data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/tests/init.pp +0 -13
  65. data/features/fixtures/server/mixed/var/lib/stub/objects/contact.json +0 -8
  66. data/features/fixtures/server/mixed/var/lib/stub/objects/shadow/contact.json +0 -8
  67. data/features/fixtures/strap/projects/etc/.empty +0 -0
  68. data/features/fixtures/strap/projects/home/user/dir/bin/.empty +0 -0
  69. data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/Modulefile +0 -12
  70. data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/README +0 -17
  71. data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/manifests/:stub:project.name:/subclass.pp +0 -3
  72. data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/manifests/init.pp +0 -42
  73. data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/spec/spec_helper.rb +0 -18
  74. data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/tests/init.pp +0 -13
  75. data/features/fixtures/strap/projects/home/user/dir/objects/contact.json +0 -8
  76. data/features/fixtures/strap/projects/home/user/dir/objects/shadow/contact.json +0 -8
  77. data/features/fixtures/strap/projects/output/.empty +0 -0
  78. data/features/fixtures/stub/contact/etc/.empty +0 -0
  79. data/features/fixtures/stub/contact/home/user/dir/bin/.empty +0 -0
  80. data/features/fixtures/stub/contact/home/user/dir/content/address.erb +0 -3
  81. data/features/fixtures/stub/contact/home/user/dir/content/cell.erb +0 -3
  82. data/features/fixtures/stub/contact/home/user/dir/content/email.erb +0 -3
  83. data/features/fixtures/stub/contact/home/user/dir/content/mobile.erb +0 -3
  84. data/features/fixtures/stub/contact/home/user/dir/content/name.erb +0 -3
  85. data/features/fixtures/stub/contact/home/user/dir/content/phone.erb +0 -3
  86. data/features/fixtures/stub/contact/home/user/dir/objects/contact.json +0 -8
  87. data/features/fixtures/stub/contact/home/user/dir/objects/shadow/contact.json +0 -8
  88. data/features/fixtures/stub/contact/output/.empty +0 -0
  89. data/features/fixtures/stub/date/etc/.empty +0 -0
  90. data/features/fixtures/stub/date/home/user/stub/bin/.empty +0 -0
  91. data/features/fixtures/stub/date/home/user/stub/content/day.erb +0 -3
  92. data/features/fixtures/stub/date/home/user/stub/content/hour.erb +0 -3
  93. data/features/fixtures/stub/date/home/user/stub/content/minute.erb +0 -3
  94. data/features/fixtures/stub/date/home/user/stub/content/month.erb +0 -3
  95. data/features/fixtures/stub/date/home/user/stub/content/second.erb +0 -3
  96. data/features/fixtures/stub/date/home/user/stub/content/year.erb +0 -3
  97. data/features/fixtures/stub/date/home/user/stub/objects/.empty +0 -0
  98. data/features/fixtures/stub/date/output/.empty +0 -0
  99. data/features/fixtures/stub/script/etc/.empty +0 -0
  100. data/features/fixtures/stub/script/home/user/stub/bin/.empty +0 -0
  101. data/features/fixtures/stub/script/home/user/stub/content/credentials.erb +0 -6
  102. data/features/fixtures/stub/script/home/user/stub/objects/credentials.rb +0 -11
  103. data/features/fixtures/stub/script/output/.empty +0 -0
  104. data/features/logging.feature +0 -39
  105. data/features/object_scripts.feature +0 -13
  106. data/features/server.feature +0 -36
  107. data/features/step_definitions/client_steps.rb +0 -99
  108. data/features/step_definitions/logging_steps.rb +0 -65
  109. data/features/step_definitions/object_scripts_steps.rb +0 -26
  110. data/features/step_definitions/server_steps.rb +0 -112
  111. data/features/step_definitions/strap_steps.rb +0 -69
  112. data/features/step_definitions/stub_option_simple_steps.rb +0 -31
  113. data/features/step_definitions/stub_steps.rb +0 -94
  114. data/features/strap.feature +0 -34
  115. data/features/stub.feature +0 -157
  116. data/features/stub_option_simple.feature +0 -14
  117. data/features/stub_packages.feature +0 -15
  118. data/features/support/env.rb +0 -197
  119. data/omnibus.rb +0 -53
  120. data/package-scripts/codestrap/postinst +0 -25
  121. data/package-scripts/codestrap/postrm +0 -17
  122. data/package-scripts/codestrap/preinst +0 -7
  123. data/package-scripts/codestrap/prerm +0 -15
  124. data/resources/codestrap/pkg/background.png +0 -0
  125. data/resources/codestrap/pkg/distribution.xml.erb +0 -22
  126. data/resources/codestrap/pkg/license.html.erb +0 -202
  127. data/resources/codestrap/pkg/welcome.html.erb +0 -7
@@ -1,18 +0,0 @@
1
- ## strap:erb
2
- #dir = File.expand_path(File.dirname(__FILE__))
3
- #$LOAD_PATH.unshift File.join(dir, 'lib')
4
- #
5
- #require 'mocha'
6
- #require 'puppet'
7
- #require 'rspec'
8
- #require 'spec/autorun'
9
- #
10
- #Spec::Runner.configure do |config|
11
- # config.mock_with :mocha
12
- #end
13
- #
14
- ## We need this because the RAL uses 'should' as a method. This
15
- ## allows us the same behaviour but with a different method name.
16
- #class Object
17
- # alias :must :should
18
- #end
@@ -1,13 +0,0 @@
1
- # strap:erb
2
- # The baseline for module testing used by Puppet Labs is that each manifest
3
- # should have a corresponding test manifest that declares that class or defined
4
- # type.
5
- #
6
- # Tests are then run by using puppet apply --noop (to check for compilation
7
- # errors and view a log of events) or by fully applying the test in a virtual
8
- # environment (to compare the resulting system state to the desired state).
9
- #
10
- # Learn more about module testing here:
11
- # http://docs.puppetlabs.com/guides/tests_smoke.html
12
- #
13
- include foobar
@@ -1,8 +0,0 @@
1
- {
2
- "name": "Michonne",
3
- "email": "dpgrps@gmail.com",
4
- "phone": "7777 7777",
5
- "mobile": "0444 4444 4444",
6
- "cell": "0555 5555 5555",
7
- "address": "10 Downing Street"
8
- }
@@ -1,8 +0,0 @@
1
- {
2
- "name": "",
3
- "email": "",
4
- "phone": "",
5
- "mobile": "",
6
- "cell": "",
7
- "address": ""
8
- }
File without changes
@@ -1,3 +0,0 @@
1
- # Interpolate
2
-
3
- <%= contact.address %>
@@ -1,3 +0,0 @@
1
- # Interpolate
2
-
3
- <%= contact.cell %>
@@ -1,3 +0,0 @@
1
- # Interpolate
2
-
3
- <%= contact.email %>
@@ -1,3 +0,0 @@
1
- # Interpolate
2
-
3
- <%= contact.mobile %>
@@ -1,3 +0,0 @@
1
- # Interpolate
2
-
3
- <%= contact.name %>
@@ -1,3 +0,0 @@
1
- # Interpolate
2
-
3
- <%= contact.phone %>
@@ -1,8 +0,0 @@
1
- {
2
- "name": "Full Name",
3
- "email": "dpgrps@gmail.com",
4
- "phone": "7777 7777",
5
- "mobile": "0444 4444 4444",
6
- "cell": "0555 5555 5555",
7
- "address": "10 Downing Street"
8
- }
@@ -1,8 +0,0 @@
1
- {
2
- "name": "",
3
- "email": "",
4
- "phone": "",
5
- "mobile": "",
6
- "cell": "",
7
- "address": ""
8
- }
File without changes
@@ -1,3 +0,0 @@
1
- # Interpolate
2
-
3
- <%= datetime.day %>
@@ -1,3 +0,0 @@
1
- # Interpolate
2
-
3
- <%= datetime.hour %>
@@ -1,3 +0,0 @@
1
- # Interpolate
2
-
3
- <%= datetime.minute %>
@@ -1,3 +0,0 @@
1
- # Interpolate
2
-
3
- <%= datetime.month %>
@@ -1,3 +0,0 @@
1
- # Interpolate
2
-
3
- <%= datetime.second %>
@@ -1,3 +0,0 @@
1
- # Interpolate
2
-
3
- <%= datetime.year %>
File without changes
File without changes
@@ -1,6 +0,0 @@
1
- #
2
-
3
- Username: <%= credentials.name %>
4
- Email: <%= credentials.email %>
5
- Password: <%= credentials.password %>
6
-
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'json'
4
-
5
- object = {
6
- 'username' => 'username',
7
- 'email' => 'noreply@nodomain.com',
8
- 'password' => 'secret',
9
- }
10
-
11
- print JSON.pretty_generate(object)
@@ -1,39 +0,0 @@
1
- Feature: Programing supports logging
2
- If an exception occurs in order to receive a meaningful message
3
- as a command line user
4
- the command needs to support adequate logging
5
-
6
- Scenario Outline: Logging
7
- Given logging tmp directory
8
- And logging fixtures file "fixtures.yaml" with:
9
- """
10
- links: logging/home/logging/codestrap/bin
11
- codestrapfile: |
12
- Codestrapfile.config do |conf|
13
- conf.local.base = [ 'logging/home/logging/codestrap' ]
14
- conf.local.urls = 'http://127.0.0.1:4567/rest/capability.json'
15
- end
16
- commands:
17
- stubcommand:
18
- output: logging/output/command
19
- output?: false
20
- stderr:
21
- - Could not find template "command".
22
- exit: 1
23
- strapproject:
24
- output: logging/output/project
25
- output?: false
26
- stderr:
27
- - Could not find project "project".
28
- exit: 1
29
- """
30
- And logging fixture "<command>"
31
- And logging file linking
32
- When logging command is executed
33
- Then logging output may be generated
34
- And logging STDERR contains a message
35
- And logging exits
36
- Examples:
37
- | command |
38
- | stubcommand |
39
- | strapproject |
@@ -1,13 +0,0 @@
1
- Feature: Supports script object creation
2
- The command supports objects created from JSON. The objects
3
- can be used in the template.
4
-
5
- Scenario Outline: creating a script object
6
- Given a script directory "<dir>"
7
- And a script "<script>"
8
- When a script run to create an object
9
- Then the objects JSON syntax is valid
10
- And a object is created
11
- Examples:
12
- | dir | script |
13
- | features/fixtures/stub/script/home/user/stub/objects | credentials.rb |
@@ -1,36 +0,0 @@
1
- Feature: Remotely serve straps and stubs
2
- In order to serve stubs and straps remotely
3
- As a user
4
- I want a server that supports both types
5
-
6
- Scenario Outline: Serve a stub or strap
7
- Given server tmp directory
8
- And server fixtures file "fixtures.yaml" with:
9
- """
10
- - type: stub
11
- template: email
12
- codestrapfile: |
13
- Codestrapfile.config do |conf|
14
- conf.server.base = ['server/mixed/var/lib/stub']
15
- conf.local.urls = 'http://127.0.0.1:4567/rest/capability.json'
16
- end
17
- - type: strap
18
- template: puppetmodule
19
- codestrapfile: |
20
- Codestrapfile.config do |conf|
21
- conf.server.base = ['server/mixed/var/lib/stub']
22
- conf.local.urls = 'http://127.0.0.1:4567/rest/capability.json'
23
- end
24
- """
25
- And server fixture "<number>"
26
- And server capbility rest "/rest/capability.json" is valid
27
- And server object rest "/rest/objects.json" is valid
28
- And server stub metadata rest "/rest/stub/metadata.json" is valid
29
- And server strap metadata rest "/rest/strap/metadata.json" is valid
30
- And server list contains the correct keys
31
- Then server file should contain the correct content
32
- And server returns the right http code
33
- Examples:
34
- | number |
35
- | 0 |
36
- | 1 |
@@ -1,99 +0,0 @@
1
- Given(/^client tmp directory$/) do
2
- unless @client_tmp
3
- @client_tmp = Dir.mktmpdir
4
- end
5
- end
6
-
7
- And(/^client fixtures file "([^"]*)" with:$/) do |yaml, text|
8
- @client_fixture_file = File.join(@client_tmp, yaml)
9
- file = File.open(@client_fixture_file, 'w')
10
- file.write(text)
11
- file.close
12
- @fixture_hash = YAML.load(text)
13
- sf_data = @fixture_hash['codestrapfile']
14
- sf_path = File.join(@client_tmp, 'Codestrapfile')
15
- file = File.open(sf_path, 'w')
16
- file.write(sf_data)
17
- file.close
18
- ENV['CODESTRAPFILE'] = sf_path
19
- @links = @fixture_hash['links']
20
- @testtools.path_reset
21
- @testtools.path_unshift(@links)
22
- end
23
-
24
- And(/^client fixture "([^"]+)"$/) do |command|
25
- @command = command
26
- @fixture_cur = @fixture_hash['commands'][command]
27
- @output = @fixture_cur['output']
28
- @test = @fixture_cur['test']
29
- end
30
-
31
- And(/^client generate command is called$/) do
32
- capture = Capture::Cli.inline do
33
- args = %w[strap --generate]
34
- Codestrap::Core.new(args).execute!
35
- end
36
- expect(capture.object_exit.status).to eql(0)
37
- end
38
-
39
- Then(/^client runs "stub output"$/) do
40
- if @command =~ /^stub/
41
- FileUtils.rm_rf(@output) if File.exist?(@output)
42
- @client_capture = Capture::Cli.inline do
43
- args = [@command, @output]
44
- Codestrap::Core.new(args).execute!
45
- end
46
- end
47
- end
48
-
49
- And(/^client runs "strap output"$/) do
50
- if @command =~ /^strap/
51
- FileUtils.rm_rf(@output) if File.exist?(@output)
52
- args = [@command, @output]
53
- @client_capture = Capture::Cli.inline do
54
- Codestrap::Core.new(args).execute!
55
- end
56
- end
57
- end
58
-
59
- And(/^client stub exit code is (\d+)$/) do |exit_code|
60
- if @command =~ /^stub/
61
- expect(@client_capture.object_exit.status).to eql(exit_code.to_i)
62
- end
63
- end
64
-
65
- And(/^client strap exit code is (\d+)$/) do |exit_code|
66
- if @command =~ /^stub/
67
- expect(@client_capture.object_exit.status).to eql(exit_code.to_i)
68
- end
69
- end
70
-
71
- And(/^client stub has the correct interpolated values$/) do
72
- if @command =~ /^stub/
73
- Tools::Test.contents(@test) do |content, str, bool|
74
- case bool
75
- when 'true'
76
- expect(content).to include(str)
77
- when 'false'
78
- expect(content).not_to include(str)
79
- else
80
- fail "Expecting boolean got #{bool.to_s}"
81
- end
82
- end
83
- end
84
- end
85
-
86
- And(/^client boilerplate has the correct interpolated values$/) do
87
- if @command =~ /^strap/
88
- Tools::Test.contents(@test) do |content, str, bool|
89
- case bool
90
- when 'true'
91
- expect(content).to include(str)
92
- when 'false'
93
- expect(content).not_to include(str)
94
- else
95
- fail "Expecting boolean got #{bool.to_s}"
96
- end
97
- end
98
- end
99
- end
@@ -1,65 +0,0 @@
1
- Given(/^logging tmp directory$/) do
2
- unless @logging_tmp
3
- @logging_tmp = Dir.mktmpdir
4
- end
5
- end
6
-
7
- And(/^logging fixtures file "([^"]*)" with:$/) do |yaml, text|
8
- @logging_fixture_file = File.join(@logging_tmp, yaml)
9
- file = File.open(@logging_fixture_file, 'w')
10
- file.write(text)
11
- file.close
12
- @fixture_hash = YAML.load(text)
13
- sf_data = @fixture_hash['codestrapfile']
14
- sf_path = File.join(@logging_tmp, 'Codestrapfile')
15
- file = File.open(sf_path, 'w')
16
- file.write(sf_data)
17
- file.close
18
- ENV['CODESTRAPFILE'] = sf_path
19
- @links = @fixture_hash['links']
20
- @testtools.path_reset
21
- @testtools.path_unshift(@links)
22
- end
23
-
24
- And(/^logging fixture "([^"]*)"$/) do |command|
25
- @command = command
26
- @fixture_cur = @fixture_hash['commands'][command]
27
- @output = @fixture_cur['output']
28
- @has_output = @fixture_cur['output?']
29
- @test = @fixture_cur['test']
30
- @stderr = @fixture_cur['stderr']
31
- @exit = @fixture_cur['exit'].to_i
32
- end
33
-
34
- And(/^logging file linking$/) do
35
- %W[stubcommand strapproject stubexists strapexists].each do |cmd|
36
- link = "logging/home/logging/codestrap/bin/#{cmd}"
37
- next if File.exist? link
38
- FileUtils.ln_s(File.expand_path('logging/home/logging/codestrap/bin/strap'), link)
39
- end
40
- end
41
-
42
- When(/^logging command is executed$/) do
43
- args = @command.split(/\s+/)
44
- args << @output if @output
45
- @logging_capture = Capture::Cli.inline do
46
- cs = Codestrap::Core.new(args)
47
- cs.execute!
48
- end
49
- end
50
-
51
- Then(/^logging output may be generated$/) do
52
- if @has_output and @has_output.eql?('true')
53
- expect(File.exist? @output).to be_truthy
54
- end
55
- end
56
-
57
- And(/^logging STDERR contains a message$/) do
58
- Array(@stderr).each do |err|
59
- expect(@logging_capture.stdout).to include(err)
60
- end
61
- end
62
-
63
- And(/^logging exits$/) do
64
- expect(@logging_capture.object_exit.status).to eql(@exit)
65
- end
@@ -1,26 +0,0 @@
1
- # Feature: Supports script object creation
2
- Given(/^a script directory "([^"]*)"$/) do |dir|
3
- @dir = dir
4
- end
5
-
6
- And(/^a script "([^"]*)"$/) do |script|
7
- @script = script
8
- end
9
-
10
- When(/^a script run to create an object$/) do
11
- @output = `#{File.join(@curdir, @dir, @script)}`
12
- @status = $?
13
- end
14
-
15
- Then(/^the objects JSON syntax is valid$/) do
16
- expect(JSON.is_json?(@output)).to be true
17
- end
18
-
19
- And(/^a object is created$/) do
20
- object = nil
21
- Dir.chdir @curdir do
22
- object = Codestrap::Object::Factory.new
23
- object.dirs = 'test/fixtures/objects'
24
- end
25
- expect(object.nil?).to be false
26
- end