cuken 0.1.4 → 0.1.7

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.
Files changed (41) hide show
  1. data/.relish +2 -0
  2. data/Gemfile +4 -4
  3. data/Gemfile.lock +17 -23
  4. data/VERSION +1 -1
  5. data/cuken.gems +108 -0
  6. data/cuken.gemspec +33 -10
  7. data/features/about.md +15 -2
  8. data/features/chef_examples/cookbooks_cookbook.feature +38 -3
  9. data/features/chef_examples/cookbooks_remote_repo.feature +10 -0
  10. data/features/chef_examples/cookbooks_repo.feature +5 -5
  11. data/features/{chef_steps → chef_examples}/knife_admin_client.feature +4 -4
  12. data/features/chef_examples/knife_client_create.feature +13 -0
  13. data/features/chef_steps/common_steps.feature +2 -2
  14. data/features/chef_steps/cookbook_steps.feature +12 -5
  15. data/features/chef_steps/node_steps.feature +1 -1
  16. data/features/file_steps/file_steps.feature +11 -11
  17. data/lib/cuken/all.rb +4 -0
  18. data/lib/cuken/api/chef/common.rb +46 -8
  19. data/lib/cuken/api/chef/knife.rb +107 -0
  20. data/lib/cuken/api/chef.rb +21 -13
  21. data/lib/cuken/api/common.rb +12 -0
  22. data/lib/cuken/api/rvm.rb +501 -0
  23. data/lib/cuken/api/ssh-forever.rb +237 -0
  24. data/lib/cuken/chef.rb +2 -0
  25. data/lib/cuken/common.rb +1 -0
  26. data/lib/cuken/cucumber/chef/common.rb +4 -2
  27. data/lib/cuken/cucumber/chef/cookbook.rb +87 -12
  28. data/lib/cuken/cucumber/chef/data_bag.rb +27 -0
  29. data/lib/cuken/cucumber/chef/knife.rb +10 -0
  30. data/lib/cuken/cucumber/chef/node.rb +20 -8
  31. data/lib/cuken/cucumber/chef/role.rb +18 -1
  32. data/lib/cuken/cucumber/chef.rb +5 -3
  33. data/lib/cuken/cucumber/cmd.rb +1 -1
  34. data/lib/cuken/cucumber/file.rb +18 -2
  35. data/lib/cuken/cucumber/rvm.rb +4 -0
  36. data/lib/cuken/rvm.rb +3 -0
  37. data/spec/api/knife_spec.rb +94 -0
  38. data/spec/api/rvm_spec.rb +274 -0
  39. data/spec/api/rvmrc_processor_spec.rb +288 -0
  40. data/spec/spec_helper.rb +58 -2
  41. metadata +67 -30
@@ -0,0 +1,237 @@
1
+ require 'pathname'
2
+ require 'open4'
3
+
4
+ module SshForever
5
+ ::SshForever::VERSION = '0.4.0' unless defined? ::SshForever::VERSION
6
+
7
+ class SecureShellForever
8
+ def initialize(login, options = {})
9
+ @login = login
10
+ @options = options
11
+ @username, @hostname = @login.split("@")
12
+ cleanup_ssh_config
13
+ cleanup_identity_files
14
+ local_config_path
15
+ initialization_run
16
+ local_key_path
17
+ end
18
+
19
+ def initialization_run
20
+ unless File.exists?(config_file_path)
21
+ puts "You do not appear to have a config file. Expected one at #{config_file_path}" unless @options[:quiet]
22
+ existing_ssh_config? ? append_ssh_config : write_ssh_config
23
+ puts "Next: check for a public key." unless @options[:quiet]
24
+ unless File.exists?(public_key_path)
25
+ puts "You do not appear to have an identity file/public key. Expected one at #{public_key_path}" unless @options[:quiet]
26
+ confirm_keygen
27
+ generate_public_key
28
+ end
29
+ end
30
+ args = ssh_args()
31
+
32
+ copy_public_key(args)
33
+
34
+ puts "Success. From now on you can just use plain old 'ssh'. Logging you in..." unless @options[:quiet]
35
+ status = run_shell_cmd(ssh_login(args))
36
+ #cleanup_ssh_config
37
+ # exitstatus 2 is when ssh-add can't find an agent on local machine.
38
+ # We ought to switch to use Net::SSH libraries....
39
+ exit 1 unless status.exitstatus.to_i == 0 || status.exitstatus.to_i == 2
40
+ end
41
+
42
+ def run_interactive
43
+ system ssh_login_interactive(ssh_args)
44
+ #cleanup_ssh_config
45
+ end
46
+
47
+ private
48
+
49
+ def local_ssh_config_path
50
+ @local_ssh_config_path ||= Pathname('~/').expand_path.realpath
51
+ end
52
+
53
+ def authorized_keys
54
+ (local_ssh_config_path + '.ssh' + 'authorized_keys2').exist? ? 'authorized_keys2' : 'authorized_keys'
55
+ end
56
+
57
+ def append_ssh_config
58
+ puts "Appending host entry in local ssh config with name #{@options[:name]}" unless @options[:quiet]
59
+ Pathname(config_file_path).open("a") do |config|
60
+ config << ssh_config
61
+ end
62
+ end
63
+
64
+ def write_ssh_config
65
+ puts "Creating host entry in local ssh config with name #{@options[:name]||'ssh-forever'}" unless @options[:quiet]
66
+ Pathname(config_file_path).open("w") do |config|
67
+ config << ssh_config
68
+ end
69
+ @cleanup_ssh_config = config_file_path
70
+ end
71
+
72
+ def existing_ssh_config?
73
+ file = Pathname(config_file_path)
74
+ config = file.exist? ? file.read : ""
75
+ chk1 = config[/IdentityFile #{public_key_path}/] ? true : false
76
+ chk2 = config[/Host #{@options[:name]}/] ? true : false
77
+ chk1 && chk2 ? true : false
78
+ end
79
+
80
+ def ssh_config
81
+ host_config = <<-STUFF.gsub(/^ {6}/, '')
82
+
83
+ Host #{@options[:name]||'ssh-forever'}
84
+ HostName #{@hostname}
85
+ User #{@username}
86
+ Port #{@options[:port]||22}
87
+ IdentityFile #{public_key_path}
88
+ Protocol 2
89
+ PreferredAuthentications publickey
90
+ PubkeyAuthentication yes
91
+ Batchmode yes
92
+ ChallengeResponseAuthentication no
93
+ CheckHostIP yes
94
+ StrictHostKeyChecking #{@options[:strict] ? 'yes' : 'no'}
95
+ HostKeyAlias #{@options[:name] ? @options[:name] : @hostname}
96
+ ConnectionAttempts 3
97
+ ControlMaster auto
98
+ ControlPath #{local_ssh_config_path + '.ssh' + '%h_%p_%r'}
99
+ ForwardAgent no
100
+ ForwardX11Trusted no
101
+ GatewayPorts yes
102
+ GSSAPIAuthentication no
103
+ GSSAPIDelegateCredentials no
104
+ HashKnownHosts yes
105
+ HostbasedAuthentication no
106
+ IdentitiesOnly yes
107
+ LogLevel #{@options[:debug] ? 'DEBUG3' : (@options[:quiet] ? 'QUIET' : 'INFO')}
108
+ NoHostAuthenticationForLocalhost yes
109
+ PasswordAuthentication no
110
+ PermitLocalCommand no
111
+ RekeyLimit 2G
112
+ ServerAliveCountMax #{@options[:intense] ? '1' : '3'}
113
+ ServerAliveInterval #{@options[:intense] ? '1' : '15'}
114
+ TCPKeepAlive yes
115
+ Tunnel no
116
+
117
+ STUFF
118
+ end
119
+
120
+
121
+ def run_shell_cmd(cmd)
122
+ status = ::Open4::popen4('sh') do |pid, stdin, stdout, stderr|
123
+ puts "debug: #{cmd}" if @options[:debug]
124
+ stdin.puts cmd
125
+ stdin.close
126
+ puts "debug: #{stderr.read.strip}" if @options[:debug]
127
+ end
128
+ status
129
+ end
130
+
131
+ def cleanup_ssh_config
132
+ file = "#{local_ssh_config_path + '.ssh' + 'ssh-forever-config'}"
133
+ Pathname(file).delete if Pathname(file).exist?
134
+ end
135
+
136
+ def cleanup_identity_files
137
+ file = "#{local_ssh_config_path + '.ssh' + 'ssh-forever-id'}"
138
+ Pathname(file).delete if Pathname(file).exist?
139
+ Pathname(file + '.pub').delete if Pathname(file + '.pub').exist?
140
+ end
141
+
142
+ def confirm_keygen
143
+ unless @options[:auto]
144
+ STDERR.print "Would you like me to generate one? [Y/n]" unless @options[:quiet]
145
+ result = STDIN.gets.strip
146
+ unless result == '' or result == 'y' or result == 'Y'
147
+ cleanup_ssh_config()
148
+ flunk %Q{\nFair enough, I'll be off then. You can generate your own by hand using\n\n ssh-keygen -t rsa}
149
+ end
150
+ end
151
+ end
152
+
153
+
154
+ def generate_public_key
155
+ status = run_shell_cmd(ssh_keygen)
156
+ flunk("Oh dear. I was unable to generate your public key. Run the command 'ssh-keygen -t rsa' manually to find out why.") unless status.exitstatus.to_i == 0
157
+ end
158
+
159
+ def copy_public_key(args)
160
+ puts "Copying your public key to the remote server." unless @options[:quiet]
161
+ puts "Prepare to enter your password for the last time..." unless @options[:quiet]
162
+ status = run_shell_cmd(ssh_keycopy(args))
163
+ exit 1 unless status.exitstatus.to_i == 0
164
+ end
165
+
166
+ def ssh_args
167
+ [ ' ',
168
+ ("-F #{@options[:config_file]}" if @options[:config_file]),
169
+ ("-p #{@options[:port]}" if @options[:port] =~ /^\d+$/),
170
+ (@options[:strict] ? "-o stricthostkeychecking=yes" : "-o stricthostkeychecking=no"),
171
+ (@options[:debug] ? "-vvv" : "-q")
172
+ ].compact.join(' ')
173
+ end
174
+
175
+ def ssh_keygen
176
+ "ssh-keygen -t rsa #{@options[:debug] ? "-v" : "-q"} -C '#{local_key_path} created by ssh-forever #{Time.now.utc}' -N '' -f #{local_key_path.to_s}"
177
+ end
178
+
179
+ def ssh_keycopy(args)
180
+ "ssh-copy-id '-i #{@options[:identity_file]}.pub #{args} #{@login}'"
181
+ end
182
+
183
+ def ssh_login(args)
184
+ if @options[:name]
185
+ append_ssh_config unless existing_ssh_config?
186
+ #ssh-add #{@options[:identity_file]};
187
+ login_command = "ssh-add #{@options[:identity_file]}; #{ssh_keycopy(args)}; SSH_AUTH_SOCK=0 ssh #{@options[:name]}#{args} 'echo true;';"
188
+ else
189
+ login_command = "ssh-add #{@options[:identity_file]}; SSH_AUTH_SOCK=0 ssh #{@login}#{args} 'echo true;';"
190
+ end
191
+ login_command
192
+ end
193
+
194
+ def ssh_login_interactive(args)
195
+ if @options[:name]
196
+ append_ssh_config unless existing_ssh_config?
197
+ login_command = "ssh #{@options[:name]} #{args}"
198
+ else
199
+ login_command = "ssh #{@login}#{args}"
200
+ end
201
+ login_command
202
+ end
203
+
204
+ def flunk(message)
205
+ STDERR.puts message
206
+ exit 1
207
+ end
208
+
209
+ def local_key_path
210
+ @options[:identity_file] ||= public_key_path
211
+ if RUBY_VERSION =~ /^1\.8\.7/
212
+ @options[:identity_file] = Pathname(@options[:identity_file]).expand_path.to_s
213
+ else
214
+ @options[:identity_file] = Pathname(@options[:identity_file]).expand_path.realdirpath.to_s
215
+ end
216
+ end
217
+
218
+ def local_config_path
219
+ @options[:config_file] ||= config_file_path # public_key_path
220
+ if RUBY_VERSION =~ /^1\.8\.7/
221
+ @options[:config_file] = Pathname(@options[:config_file]).expand_path.to_s
222
+ else
223
+ @options[:config_file] = Pathname(@options[:config_file]).expand_path.realdirpath.to_s
224
+ @options[:config_file]
225
+ end
226
+ end
227
+
228
+ def public_key_path
229
+ File.expand_path(@options[:identity_file] || "#{local_ssh_config_path + '.ssh' + 'ssh-forever-id'}")
230
+ end
231
+
232
+ def config_file_path
233
+ File.expand_path(@options[:config_file] || "#{local_ssh_config_path + '.ssh' + 'ssh-forever-config'}")
234
+ end
235
+
236
+ end
237
+ end
data/lib/cuken/chef.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'grit'
2
+
1
3
  require 'cuken/common'
2
4
  require 'cuken/api/chef'
3
5
  require 'cuken/cucumber/chef'
data/lib/cuken/common.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'fileutils'
1
2
  require 'pathname'
2
3
  require 'aruba/cucumber' unless defined? Aruba
3
4
 
@@ -24,11 +24,12 @@ Given /^the Chef server URI "([^"]*)"$/ do |uri|
24
24
  chef.uri = uri
25
25
  end
26
26
 
27
- Given /^the Chef client "([^"]*)"$/ do |name|
27
+ Given /^the Chef client "([^"]*)" exists$/ do |name|
28
28
  chef.client_name = name
29
29
  end
30
30
 
31
- Given /^the Chef admin client "([^"]*)"$/ do |name|
31
+ Given /^the Chef admin client "([^"]*) exists"$/ do |name|
32
+ chef.show_client(:name => name)
32
33
  chef.admin_client_name = name
33
34
  end
34
35
 
@@ -61,6 +62,7 @@ end
61
62
 
62
63
  Given /^I clone the remote Chef repository branch "([^"]*)" to "([^"]*)"$/ do |brnch, path|
63
64
  chef.local_chef_repo = chef_clone_repo(path, false, chef.remote_chef_repo, brnch)
65
+ chef.local_chef_repo.exist?.should be_true
64
66
  end
65
67
 
66
68
  Given /^a default base Chef repository in "([^"]*)"$/ do |path|
@@ -25,13 +25,22 @@
25
25
 
26
26
  Given /^the remote Cookbook repository "([^"]*)"$/ do |ckbk_repo|
27
27
  in_current_dir do
28
- chef.remote_cookbook_repo = Pathname(ckbk_repo).expand_path.realdirpath
28
+ repo = Dir.exist?(ckbk_repo) ? Pathname(ckbk_repo).expand_path.realdirpath : ckbk_repo
29
+ chef.remote_cookbook_repo = repo
30
+ end
31
+ end
32
+
33
+ Given /^the remote Cookbooks URI "([^"]*)"$/ do |ckbk_uri|
34
+ in_current_dir do
35
+ repo = Dir.exist?(ckbk_uri) ? Pathname(ckbk_uri).expand_path.realdirpath : ckbk_uri
36
+ chef.cookbooks_uri = repo
29
37
  end
30
38
  end
31
39
 
32
40
  Given /^the local Cookbook repository "([^"]*)"$/ do |ckbk_repo|
33
41
  in_current_dir do
34
- chef.local_cookbook_repo = Pathname(ckbk_repo).expand_path.realdirpath
42
+ repo = Dir.exist?(ckbk_repo) ? Pathname(ckbk_repo).expand_path.realdirpath : ckbk_repo
43
+ chef.local_cookbook_repo = repo
35
44
  end
36
45
  end
37
46
 
@@ -40,42 +49,108 @@ Then /^the local Cookbook repository exists$/ do
40
49
  #TODO: check_file_presence([file], true), etc.
41
50
  end
42
51
 
43
- Given /^a cookbook path "([^"]*)"$/ do |path|
52
+ Then /^the local Site\-Cookbook repository exists$/ do
53
+ chef.local_site_cookbook_repo.exist?.should be_true
54
+ #TODO: check_file_presence([file], true), etc.
55
+ end
56
+
57
+ Given /^a Cookbook path "([^"]*)"$/ do |dir_name|
58
+ create_dir(dir_name)
44
59
  in_current_dir do
45
- update_cookbook_paths(path, true)
60
+ update_cookbook_paths(dir_name, true)
46
61
  end
47
62
  end
48
63
 
49
- Given /^a cookbooks path "([^"]*)"$/ do |path|
64
+ Given /^a Cookbooks path "([^"]*)"$/ do |dir_name|
65
+ create_dir(dir_name)
50
66
  in_current_dir do
51
- update_cookbook_paths(path, false)
67
+ update_cookbook_paths(dir_name, false)
68
+ end
69
+ end
70
+
71
+ Then /^the local Cookbook "([^"]*)" exists$/ do |ckbk|
72
+ chef.cookbook_paths.each do |pn|
73
+ curr_ckbk = pn.basename.to_s
74
+ if curr_ckbk == ckbk
75
+ break true if curr_ckbk.should == ckbk
76
+ end
52
77
  end
78
+ #TODO: check_file_presence([file], true), etc.
53
79
  end
54
80
 
55
- Then /^the local cookbook "([^"]*)" exists$/ do |ckbk|
81
+ Then /^the local Site\-Cookbook "([^"]*)" exists$/ do |ckbk|
82
+ ckbk_path = 'site-cookbook'
56
83
  chef.cookbook_paths.each do |pn|
57
84
  curr_ckbk = pn.basename.to_s
58
- curr_ckbk.should == ckbk if curr_ckbk == ckbk
85
+ if pn.to_s[/#{ckbk_path}}/] && curr_ckbk == ckbk
86
+ break true if curr_ckbk.should == ckbk
87
+ end
59
88
  end
60
89
  #TODO: check_file_presence([file], true), etc.
61
90
  end
62
91
 
92
+ And /^these local Cookbooks exist:$/ do |table|
93
+ # table is a Cucumber::Ast::Table
94
+ table.hashes.each do |hsh|
95
+ chef.cookbook_paths.each do |pn|
96
+ curr_ckbk = pn.basename.to_s
97
+ if curr_ckbk == hsh['cookbook']
98
+ break true if curr_ckbk.should == hsh['cookbook']
99
+ end
100
+ end
101
+ end
102
+ end
103
+
104
+ And /^these local Site\-Cookbooks exist:$/ do |table|
105
+ # table is a Cucumber::Ast::Table
106
+ ckbk_path = 'site-cookbook'
107
+ table.hashes.each do |hsh|
108
+ chef.cookbook_paths.each do |pn|
109
+ curr_ckbk = pn.basename.to_s
110
+ if pn.to_s[/#{ckbk_path}}/] && curr_ckbk == hsh['cookbook']
111
+ break true if curr_ckbk.should == hsh['cookbook']
112
+ end
113
+ end
114
+ end
115
+ end
116
+
63
117
  Given /^I clone the remote Cookbook repository branch "([^"]*)" to "([^"]*)"$/ do |brnch, ckbk_path|
64
- chef.local_cookbook_repo = chef_clone_repo(ckbk_path, true, chef.remote_cookbook_repo, brnch)
118
+ if ckbk_path[/\/cookbooks\//]
119
+ chef.local_cookbook_repo = chef_clone_repo(ckbk_path, true, chef.remote_cookbook_repo, brnch)
120
+ elsif ckbk_path[/\/site-cookbooks\//]
121
+ chef.local_site_cookbook_repo = chef_clone_repo(ckbk_path, true, chef.remote_cookbook_repo, brnch)
122
+ end
123
+ end
124
+
125
+ Given /^I clone the Cookbook "([^"]*)" branch "([^"]*)" to "([^"]*)"$/ do |ckbk, brnch, ckbk_path|
126
+ if ckbk_path[/\/cookbooks\//]
127
+ chef.local_cookbook_repo = chef_clone_repo(ckbk_path, true, chef.cookbooks_uri + ckbk + '.git', brnch)
128
+ elsif ckbk_path[/\/site-cookbooks\//]
129
+ chef.local_site_cookbook_repo = chef_clone_repo(ckbk_path, true, chef.cookbooks_uri + ckbk + '.git', brnch)
130
+ end
65
131
  end
66
132
 
67
- When /^I successfully generate all cookbook metadata$/ do
133
+ When /^I clone the Cookbooks:$/ do |table|
134
+ # table is a Cucumber::Ast::Table
135
+ table.hashes.each do |hsh|
136
+ #TODO: Accept cloning from tag and reference
137
+ local_repo = chef_clone_repo(hsh['destination'], true, chef.cookbooks_uri + hsh['cookbook'] + '.git', hsh['branch'])
138
+ Pathname(local_repo).exist?.should be_true
139
+ end
140
+ end
141
+
142
+ When /^I successfully generate all Cookbook metadata$/ do
68
143
  chef.cookbook_paths.each do |pn|
69
144
  curr_ckbk = pn.basename.to_s
70
145
  run_knife_command("cookbook metadata #{curr_ckbk}")
71
146
  end
72
147
  end
73
148
 
74
- When /^I successfully generate cookbook "([^"]*)" metadata$/ do |ckbk|
149
+ When /^I successfully generate Cookbook "([^"]*)" metadata$/ do |ckbk|
75
150
  chef.cookbook_paths.each do |pn|
76
151
  curr_ckbk = pn.basename.to_s
77
152
  if curr_ckbk == ckbk
78
153
  run_knife_command("cookbook metadata #{curr_ckbk}")
79
154
  end
80
155
  end
81
- end
156
+ end
@@ -0,0 +1,27 @@
1
+ ###
2
+ # Given
3
+ ###
4
+ #Given /^I create the "([^"]*)" Data Bag$/ do |arg1|
5
+ # pending # express the regexp above with the code you wish you had
6
+ #end
7
+
8
+ ###
9
+ # When
10
+ ###
11
+ #When /^I add these Cookbook Data Bag items:$/ do |table|
12
+ # # table is a Cucumber::Ast::Table
13
+ # pending # express the regexp above with the code you wish you had
14
+ #end
15
+
16
+ ###
17
+ # Then
18
+ ###
19
+ #Then /^these Data Bags exist:$/ do |table|
20
+ # # table is a Cucumber::Ast::Table
21
+ # pending # express the regexp above with the code you wish you had
22
+ #end
23
+ #
24
+ #Then /^the Data Bags contain:$/ do |table|
25
+ # # table is a Cucumber::Ast::Table
26
+ # pending # express the regexp above with the code you wish you had
27
+ #end
@@ -19,12 +19,22 @@
19
19
  # See the License for the specific language governing permissions and
20
20
  # limitations under the License.
21
21
  #
22
+ World(::Cuken::Api::Chef::Knife)
23
+
22
24
  Given /^the Knife file "([^"]*)"$/ do |path|
23
25
  in_current_dir do
24
26
  chef.client_knife_path = Pathname(path).expand_path.realdirpath
25
27
  end
26
28
  end
27
29
 
30
+ When /^I delete the Chef admin client "([^"]*)"$/ do |client_name|
31
+ delete_client(client_name)
32
+ end
33
+
34
+ When /^I create the Chef admin client "([^"]*)"$/ do |client_name|
35
+ create_client(client_name)
36
+ end
37
+
28
38
  When /^I successfully run Knife's "([^"]*)"$/ do |cmd|
29
39
  run_knife_command(cmd, false)
30
40
  end
@@ -19,17 +19,29 @@
19
19
  ###
20
20
  # Given
21
21
  ###
22
- Given /^a validated node$/ do
22
+ Given /^a validated Node$/ do
23
23
  # client should have cached ohai assigned to it
24
24
  client.register
25
25
  client.build_node
26
26
  client.node.run_list << "integration_setup"
27
27
  end
28
28
 
29
- ###
30
- # Then
31
- ###
32
- Then /^the nodes are:$/ do |partial_output|
33
- run_knife_command('node list')
34
- all_stdout.should include(partial_output)
35
- end
29
+ #Given /^a Node "([^"]*)"$/ do |arg1|
30
+ # pending # express the regexp above with the code you wish you had
31
+ #end
32
+ #
33
+ ####
34
+ ## When
35
+ ####
36
+ #When /^I add these Node Roles to the Run Lists:$/ do |table|
37
+ # # table is a Cucumber::Ast::Table
38
+ # pending # express the regexp above with the code you wish you had
39
+ #end
40
+ #
41
+ ####
42
+ ## Then
43
+ ####
44
+ #Then /^the Chef nodes are:$/ do |partial_output|
45
+ # run_knife_command('node list')
46
+ # all_stdout.should include(partial_output)
47
+ #end
@@ -1,7 +1,24 @@
1
+ ###
2
+ # Given
3
+ ###
4
+
5
+ ###
6
+ # When
7
+ ###
8
+ #When /^I load the Cookbook Roles:$/ do |table|
9
+ # # table is a Cucumber::Ast::Table
10
+ # pending # express the regexp above with the code you wish you had
11
+ #end
12
+
1
13
  ###
2
14
  # Then
3
15
  ###
4
- Then /^the roles are:$/ do |partial_output|
16
+ Then /^the Roles are:$/ do |partial_output|
5
17
  run_knife_command('role list')
6
18
  all_stdout.should include(partial_output)
7
19
  end
20
+
21
+ #Then /^these Roles exist:$/ do |table|
22
+ # run_knife_command('role list')
23
+ # pending # express the regexp above with the code you wish you had
24
+ #end
@@ -5,14 +5,16 @@ World(::Cuken::Api::Chef)
5
5
 
6
6
  Before do
7
7
  @aruba_timeout_seconds.nil? || @aruba_timeout_seconds < 20 ? @aruba_timeout_seconds = 20 : @aruba_timeout_seconds
8
+ ::Grit::Git.git_timeout = 3610
8
9
  end
9
10
 
10
- Before('@work_in_cwd') do
11
- @dirs = [Pathname.getwd.expand_path.realpath.to_s]
12
- end
11
+ #Before('@work_in_cwd') do
12
+ # @dirs = [Pathname.getwd.expand_path.realpath.to_s]
13
+ #end
13
14
 
14
15
  require 'cuken/cucumber/chef/common'
15
16
  require 'cuken/cucumber/chef/knife'
16
17
  require 'cuken/cucumber/chef/cookbook'
17
18
  require 'cuken/cucumber/chef/node'
18
19
  require 'cuken/cucumber/chef/role'
20
+ require 'cuken/cucumber/chef/data_bag'
@@ -3,7 +3,7 @@ load 'aruba/cucumber.rb' unless defined? ::Aruba
3
3
  World(::Cuken::Api::Cmd)
4
4
 
5
5
  #
6
- # These have been submitted to Aruba - awaiting release...
6
+ # These ought be submitted to Aruba...
7
7
  #
8
8
  Then /^the output from "(.*)" contains exactly:$/ do |cmd, exact_output|
9
9
  output_from(unescape(cmd)).should == exact_output
@@ -4,14 +4,30 @@ World(::Cuken::Api::File)
4
4
  #
5
5
  # Refactorings, yet to be submitted to Aruba:
6
6
  #
7
- Given /^the empty file "([^"]*)"$/ do |file_name|
7
+ Given /^the directory "([^"]*)"$/ do |arg1|
8
+ Then %Q{a directory named \"#{arg1}\"}
9
+ end
10
+
11
+ Given /^the file "([^"]*)" contains nothing$/ do |file_name|
8
12
  Given %Q{an empty file named "#{file_name}"}
9
13
  end
10
14
 
11
- Given /^the file "([^"]*)" with:$/ do |file_name, file_content|
15
+ Given /^the file "([^"]*)" contains:$/ do |file_name, file_content|
12
16
  Given %Q{a file named "#{file_name}" with:}, file_content
13
17
  end
14
18
 
19
+ When /^I write to "([^"]*)":$/ do |file_name, file_content|
20
+ When %Q{I write to "#{file_name}" with:}, file_content
21
+ end
22
+
23
+ When /^I overwrite "([^"]*)":$/ do |file_name, file_content|
24
+ When %Q{I overwrite "#{file_name}" with:}, file_content
25
+ end
26
+
27
+ When /^I append to "([^"]*)":$/ do |file_name, file_content|
28
+ When %Q{I append to "#{file_name}" with:}, file_content
29
+ end
30
+
15
31
  Then /^the file "([^"]*)" exists$/ do |arg1|
16
32
  Then %Q{a file named \"#{arg1}\" should exist}
17
33
  end
@@ -0,0 +1,4 @@
1
+ load 'aruba/cucumber.rb' unless defined? ::Aruba
2
+
3
+ World(::Cuken::Api::Rvm)
4
+
data/lib/cuken/rvm.rb ADDED
@@ -0,0 +1,3 @@
1
+ require 'cuken/common'
2
+ require 'cuken/api/rvm'
3
+ require 'cuken/cucumber/rvm'