cuken 0.1.13 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/.rvmrc +61 -0
  2. data/Gemfile +17 -15
  3. data/Gemfile.lock +55 -63
  4. data/VERSION +1 -1
  5. data/cuken.gems +46 -0
  6. data/cuken.gemspec +85 -31
  7. data/features/about.md +4 -0
  8. data/features/avagrant_steps/vagrant_steps.feature +13 -0
  9. data/features/chef_examples/cookbooks_cookbook.feature +1 -1
  10. data/features/chef_examples/cookbooks_metadata.feature +5 -5
  11. data/features/chef_examples/cookbooks_repo.feature +1 -1
  12. data/features/chef_examples/knife_admin_client.feature +12 -12
  13. data/features/chef_examples/knife_client_create.feature +1 -1
  14. data/features/chef_examples/zenoss_example/01_chef_server_setup.feature +1 -1
  15. data/features/chef_examples/zenoss_example/02_monitor_vm_setup.feature +1 -1
  16. data/features/chef_steps/cookbook_steps.feature +6 -16
  17. data/features/command_examples/commands.feature +3 -3
  18. data/features/command_examples/exit_statuses.feature +49 -0
  19. data/features/command_examples/file_system_commands.feature +128 -0
  20. data/features/command_examples/flushing.feature +24 -0
  21. data/features/command_examples/interactive.feature +57 -0
  22. data/features/command_examples/no_clobber.feature +41 -0
  23. data/features/command_examples/output.feature +205 -0
  24. data/features/command_steps/command_steps.feature +49 -42
  25. data/features/file_examples/files.feature +5 -5
  26. data/features/git_examples/git_clone.feature +33 -0
  27. data/features/ssh_examples/ssh.feature +11 -2
  28. data/features/step_definitions/cuken_steps.rb +3 -2
  29. data/features/support/env.rb +2 -1
  30. data/lib/cuken/all.rb +1 -0
  31. data/lib/cuken/api/aruba/api.rb +342 -0
  32. data/lib/cuken/api/aruba/hooks.rb +63 -0
  33. data/lib/cuken/api/aruba/process.rb +74 -0
  34. data/lib/cuken/api/aruba.rb +5 -0
  35. data/lib/cuken/api/chef/common.rb +8 -1
  36. data/lib/cuken/api/chef/cookbook.rb +31 -5
  37. data/lib/cuken/api/chef/knife.rb +3 -3
  38. data/lib/cuken/api/chef/role.rb +3 -3
  39. data/lib/cuken/api/chef.rb +98 -9
  40. data/lib/cuken/api/cmd.rb +8 -8
  41. data/lib/cuken/api/common.rb +11 -23
  42. data/lib/cuken/api/file.rb +38 -38
  43. data/lib/cuken/api/git/clone.rb +25 -0
  44. data/lib/cuken/api/git/common.rb +37 -0
  45. data/lib/cuken/api/git/remote.rb +16 -0
  46. data/lib/cuken/api/git/repository.rb +62 -0
  47. data/lib/cuken/api/git.rb +69 -0
  48. data/lib/cuken/api/rvm/common.rb +10 -0
  49. data/lib/cuken/api/rvm/gemsets.rb +33 -0
  50. data/lib/cuken/api/rvm/wip.rb +554 -0
  51. data/lib/cuken/api/rvm.rb +25 -479
  52. data/lib/cuken/api/ssh.rb +85 -4
  53. data/lib/cuken/api/vagrant/common.rb +7 -4
  54. data/lib/cuken/api/vagrant/v_m.rb +2 -2
  55. data/lib/cuken/api/vagrant.rb +3 -3
  56. data/lib/cuken/common.rb +3 -1
  57. data/lib/cuken/cucumber/chef/common.rb +3 -3
  58. data/lib/cuken/cucumber/chef/cookbook/action.rb +81 -0
  59. data/lib/cuken/cucumber/chef/cookbook/local.rb +71 -0
  60. data/lib/cuken/cucumber/chef/cookbook/remote.rb +37 -0
  61. data/lib/cuken/cucumber/chef/cookbook.rb +3 -140
  62. data/lib/cuken/cucumber/chef/cookbook_steps.rb +1 -1
  63. data/lib/cuken/cucumber/chef/deploy_steps.rb +1 -1
  64. data/lib/cuken/cucumber/chef/done_directory_steps.rb +2 -2
  65. data/lib/cuken/cucumber/chef/done_file_steps.rb +5 -5
  66. data/lib/cuken/cucumber/chef/knife.rb +1 -1
  67. data/lib/cuken/cucumber/chef.rb +1 -1
  68. data/lib/cuken/cucumber/cmd/execution.rb +34 -0
  69. data/lib/cuken/cucumber/cmd/exit_status.rb +30 -0
  70. data/lib/cuken/cucumber/cmd.rb +2 -36
  71. data/lib/cuken/cucumber/common.rb +42 -6
  72. data/lib/cuken/cucumber/file.rb +42 -37
  73. data/lib/cuken/cucumber/git/clone.rb +51 -0
  74. data/lib/cuken/cucumber/git/common.rb +36 -0
  75. data/lib/cuken/cucumber/git/local.rb +19 -0
  76. data/lib/cuken/cucumber/git/remote.rb +22 -0
  77. data/lib/cuken/cucumber/git.rb +26 -0
  78. data/lib/cuken/cucumber/output/all.rb +41 -0
  79. data/lib/cuken/cucumber/output/cmd.rb +46 -0
  80. data/lib/cuken/cucumber/output/stderr.rb +33 -0
  81. data/lib/cuken/cucumber/output/stdout.rb +34 -0
  82. data/lib/cuken/cucumber/rvm/common.rb +0 -0
  83. data/lib/cuken/cucumber/rvm/gemsets.rb +32 -0
  84. data/lib/cuken/cucumber/rvm/hooks.rb +0 -0
  85. data/lib/cuken/cucumber/rvm.rb +3 -1
  86. data/lib/cuken/cucumber/ssh/common.rb +51 -0
  87. data/lib/cuken/cucumber/ssh.rb +3 -35
  88. data/lib/cuken/cucumber/vagrant.rb +1 -1
  89. data/lib/cuken/git.rb +21 -0
  90. data/spec/api/rvm/gemsets/api_spec.rb +41 -0
  91. data/spec/api/rvm/gemsets/helper_spec.rb +19 -0
  92. data/spec/api/rvm_spec.rb +63 -15
  93. data/spec/api/vagrant/v_m/Vagrantfile +82 -0
  94. data/spec/api/vagrant/v_m/api_spec.rb +37 -0
  95. data/spec/spec_helper.rb +39 -0
  96. metadata +123 -45
  97. data/spec/cuken_spec.rb +0 -7
@@ -14,7 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
  #
17
- require 'vagrant' unless defined? ::Vagrant
17
+ require 'vagrant' #unless defined? ::Vagrant
18
18
 
19
19
  require 'cuken/api/common'
20
20
  require 'cuken/api/vagrant/common'
@@ -67,7 +67,7 @@ module ::Vagrant
67
67
  # Command line options
68
68
  command_options = ["-p #{options[:port]}", "-o UserKnownHostsFile=/dev/null",
69
69
  "-o StrictHostKeyChecking=no", "-o IdentitiesOnly=yes",
70
- "-i #{options[:private_key_path]}"]
70
+ "-i #{options[:private_key_path]}", "-o LogLevel=ERROR"]
71
71
  command_options << "-o ForwardAgent=yes" if env.config.ssh.forward_agent
72
72
 
73
73
  if env.config.ssh.forward_x11
@@ -77,7 +77,7 @@ module ::Vagrant
77
77
  end
78
78
 
79
79
  "ssh #{command_options.join(" ")} #{options[:username]}@#{options[:host]}".strip
80
- end
80
+ end
81
81
 
82
82
  end
83
83
  end
data/lib/cuken/common.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  require 'fileutils'
2
2
  require 'pathname'
3
- require 'aruba/cucumber' unless defined? Aruba
3
+ require 'tempfile'
4
+ require 'cucumber'
5
+ #require 'aruba/cucumber' unless defined? Aruba
4
6
 
5
7
  require 'cuken/api/common'
6
8
  require 'cuken/cucumber/common'
@@ -50,13 +50,13 @@ Given /^the Chef admin client "([^"]*)" exists$/ do |name|
50
50
  end
51
51
 
52
52
  Given /^the Chef client private key path "([^"]*)"$/ do |path|
53
- in_current_dir do
53
+ in_dir do
54
54
  chef.client_private_key_path = Pathname(path)
55
55
  end
56
56
  end
57
57
 
58
58
  Given /^the remote Chef repository "([^"]*)"$/ do |chf_pth|
59
- in_current_dir do
59
+ in_dir do
60
60
  if Pathname(chf_pth).exist?
61
61
  chef.remote_chef_repo = Pathname(chf_pth).expand_path.realdirpath
62
62
  else
@@ -66,7 +66,7 @@ Given /^the remote Chef repository "([^"]*)"$/ do |chf_pth|
66
66
  end
67
67
 
68
68
  Given /^the local Chef repository "([^"]*)"$/ do |chf_pth|
69
- in_current_dir do
69
+ in_dir do
70
70
  chef.local_chef_repo = Pathname(chf_pth).expand_path.realdirpath
71
71
  end
72
72
  end
@@ -0,0 +1,81 @@
1
+ #
2
+ # Author:: Hedgehog (<hedgehogshiatus@gmail.com>)
3
+ # Copyright:: Copyright (c) 2011 Hedgehog.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ When /^I load the Cookbooks:$/ do |table|
19
+ cookbooks_load(table)
20
+ end
21
+
22
+ When /^I delete the Cookbooks:$/ do |table|
23
+ cookbooks_delete(table)
24
+ end
25
+
26
+ Given /^I clone the remote Cookbook repository branch "([^"]*)" to "([^"]*)"$/ do |brnch, ckbk_path|
27
+ if ckbk_path[/\/cookbooks\//]
28
+ chef.local_cookbook_repo = chef_clone_repo(ckbk_path, true, chef.remote_cookbook_repo, {'branch' => brnch})
29
+ elsif ckbk_path[/\/site-cookbooks\//]
30
+ chef.local_site_cookbook_repo = chef_clone_repo(ckbk_path, true, chef.remote_cookbook_repo, {'branch' => brnch})
31
+ end
32
+ end
33
+
34
+ Given /^I clone the Cookbook "([^"]*)" branch "([^"]*)" to "([^"]*)"$/ do |ckbk, brnch, ckbk_path|
35
+ if ckbk_path[/\/cookbooks\//]
36
+ chef.local_cookbook_repo = chef_clone_repo(ckbk_path, true, chef.cookbooks_uri + ckbk + '.git', {'branch' => brnch})
37
+ elsif ckbk_path[/\/site-cookbooks\//]
38
+ chef.local_site_cookbook_repo = chef_clone_repo(ckbk_path, true, chef.cookbooks_uri + ckbk + '.git', {'branch' => brnch})
39
+ end
40
+ end
41
+
42
+ When /^I clone the Cookbooks:$/ do |table|
43
+ table.hashes.each do |hsh|
44
+ src = {}
45
+ src['branch'] = hsh['branch'] if hsh['branch']
46
+ src['tag'] = hsh['tag'] if hsh['tag']
47
+ src['ref'] = hsh['ref'] if hsh['ref']
48
+ ckbk = hsh['cookbook'] if hsh['cookbook']
49
+ ckbk = hsh['site-cookbook'] if hsh['site-cookbook']
50
+ local_repo = chef_clone_repo(hsh['destination'], true, chef.cookbooks_uri + ckbk + '.git', src )
51
+ Pathname(local_repo).exist?.should be_true
52
+ end
53
+ end
54
+
55
+ When /^I submodule the Cookbooks:$/ do |table|
56
+ table.hashes.each do |hsh|
57
+ src = {}
58
+ src['branch'] = hsh['branch'] if hsh['branch']
59
+ src['tag'] = hsh['tag'] if hsh['tag']
60
+ src['ref'] = hsh['ref'] if hsh['ref']
61
+ ckbk = hsh['cookbook'] if hsh['cookbook']
62
+ local_repo = chef_submodule_repo(hsh['destination'], true, chef.cookbooks_uri + ckbk + '.git', src )
63
+ Pathname(local_repo).exist?.should be_true
64
+ end
65
+ end
66
+
67
+ When /^I successfully generate all Cookbook metadata$/ do
68
+ chef.cookbook_paths.each do |pn|
69
+ curr_ckbk = pn.basename.to_s
70
+ run_knife_command("cookbook metadata #{curr_ckbk}")
71
+ end
72
+ end
73
+
74
+ When /^I successfully generate Cookbook "([^"]*)" metadata$/ do |ckbk|
75
+ chef.cookbook_paths.each do |pn|
76
+ curr_ckbk = pn.basename.to_s
77
+ if curr_ckbk == ckbk
78
+ run_knife_command("cookbook metadata #{curr_ckbk}")
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,71 @@
1
+ Given /^a Cookbook path "([^"]*)"$/ do |dir_name|
2
+ create_dir(dir_name)
3
+ in_dir do
4
+ update_cookbook_paths(dir_name, true)
5
+ end
6
+ end
7
+
8
+ Given /^a Cookbooks path "([^"]*)"$/ do |dir_name|
9
+ create_dir(dir_name)
10
+ in_dir do
11
+ update_cookbook_paths(dir_name, false)
12
+ end
13
+ end
14
+
15
+ Then /^the local Cookbook "([^"]*)" exists$/ do |ckbk|
16
+ chef.cookbook_paths.each do |pn|
17
+ curr_ckbk = pn.basename.to_s
18
+ if curr_ckbk == ckbk
19
+ break true if curr_ckbk.should == ckbk
20
+ end
21
+ end
22
+ #TODO: check_file_presence([file], true), etc.
23
+ end
24
+
25
+ Given /^the local Cookbook repository "([^"]*)"$/ do |ckbk_repo|
26
+ in_dir do
27
+ repo = Dir.exist?(ckbk_repo) ? Pathname(ckbk_repo).expand_path.realdirpath : ckbk_repo
28
+ chef.local_cookbook_repo = repo
29
+ end
30
+ end
31
+
32
+ Then /^the local Cookbook repository exists$/ do
33
+ chef.local_cookbook_repo.exist?.should be_true
34
+ #TODO: check_file_presence([file], true), etc.
35
+ end
36
+
37
+ Then /^the local Site\-Cookbook "([^"]*)" exists$/ do |ckbk|
38
+ ckbk_path = 'site-cookbook'
39
+ chef.cookbook_paths.each do |pn|
40
+ curr_ckbk = pn.basename.to_s
41
+ if pn.to_s[/#{ckbk_path}}/] && curr_ckbk == ckbk
42
+ break true if curr_ckbk.should == ckbk
43
+ end
44
+ end
45
+ #TODO: check_file_presence([file], true), etc.
46
+ end
47
+
48
+ Then /^the local Site\-Cookbook repository exists$/ do
49
+ chef.local_site_cookbook_repo.exist?.should be_true
50
+ #TODO: check_file_presence([file], true), etc.
51
+ end
52
+
53
+ And /^these local Cookbooks exist:$/ do |table|
54
+ check_cookbook_table_presence(table)
55
+ end
56
+
57
+ And /^these local Cookbooks do not exist:$/ do |table|
58
+ check_cookbook_table_presence(table, false)
59
+ end
60
+
61
+ And /^these local Site\-Cookbooks exist:$/ do |table|
62
+ ckbk_path = 'site-cookbook'
63
+ table.hashes.each do |hsh|
64
+ chef.cookbook_paths.each do |pn|
65
+ curr_ckbk = pn.basename.to_s
66
+ if pn.to_s[/#{ckbk_path}}/] && curr_ckbk == hsh['cookbook']
67
+ break true if curr_ckbk.should == hsh['cookbook']
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,37 @@
1
+ #
2
+ # Author:: Hedgehog (<hedgehogshiatus@gmail.com>)
3
+ # Copyright:: Copyright (c) 2011 Hedgehog.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+ Then /^these remote Cookbooks exist:$/ do |table|
18
+ check_remote_cookbook_table_presence(table)
19
+ end
20
+
21
+ Then /^these remote Cookbooks do not exist:$/ do |table|
22
+ check_remote_cookbook_table_presence(table, false)
23
+ end
24
+
25
+ Given /^the remote Cookbook repository "([^"]*)"$/ do |ckbk_repo|
26
+ in_dir do
27
+ repo = Dir.exist?(ckbk_repo) ? Pathname(ckbk_repo).expand_path.realdirpath : ckbk_repo
28
+ chef.remote_cookbook_repo = repo
29
+ end
30
+ end
31
+
32
+ Given /^the remote Cookbooks URI "([^"]*)"$/ do |ckbk_uri|
33
+ in_dir do
34
+ repo = Dir.exist?(ckbk_uri) ? Pathname(ckbk_uri).expand_path.realdirpath : ckbk_uri
35
+ chef.cookbooks_uri = repo
36
+ end
37
+ end
@@ -24,146 +24,9 @@
24
24
  #
25
25
  World(::Cuken::Api::Chef::Cookbook)
26
26
 
27
- When /^I load the Cookbooks:$/ do |table|
28
- cookbooks_load(table)
29
- end
27
+ require 'cuken/cucumber/chef/cookbook/action'
28
+ require 'cuken/cucumber/chef/cookbook/local'
29
+ require 'cuken/cucumber/chef/cookbook/remote'
30
30
 
31
- Then /^these remote Cookbooks exist:$/ do |table|
32
- check_remote_cookbook_table_presence(table)
33
- end
34
31
 
35
- Then /^these remote Cookbooks do not exist:$/ do |table|
36
- check_remote_cookbook_table_presence(table, false)
37
- end
38
32
 
39
- Given /^the remote Cookbook repository "([^"]*)"$/ do |ckbk_repo|
40
- in_current_dir do
41
- repo = Dir.exist?(ckbk_repo) ? Pathname(ckbk_repo).expand_path.realdirpath : ckbk_repo
42
- chef.remote_cookbook_repo = repo
43
- end
44
- end
45
-
46
- Given /^the remote Cookbooks URI "([^"]*)"$/ do |ckbk_uri|
47
- in_current_dir do
48
- repo = Dir.exist?(ckbk_uri) ? Pathname(ckbk_uri).expand_path.realdirpath : ckbk_uri
49
- chef.cookbooks_uri = repo
50
- end
51
- end
52
-
53
- Given /^the local Cookbook repository "([^"]*)"$/ do |ckbk_repo|
54
- in_current_dir do
55
- repo = Dir.exist?(ckbk_repo) ? Pathname(ckbk_repo).expand_path.realdirpath : ckbk_repo
56
- chef.local_cookbook_repo = repo
57
- end
58
- end
59
-
60
- Then /^the local Cookbook repository exists$/ do
61
- chef.local_cookbook_repo.exist?.should be_true
62
- #TODO: check_file_presence([file], true), etc.
63
- end
64
-
65
- Then /^the local Site\-Cookbook repository exists$/ do
66
- chef.local_site_cookbook_repo.exist?.should be_true
67
- #TODO: check_file_presence([file], true), etc.
68
- end
69
-
70
- Given /^a Cookbook path "([^"]*)"$/ do |dir_name|
71
- create_dir(dir_name)
72
- in_current_dir do
73
- update_cookbook_paths(dir_name, true)
74
- end
75
- end
76
-
77
- Given /^a Cookbooks path "([^"]*)"$/ do |dir_name|
78
- create_dir(dir_name)
79
- in_current_dir do
80
- update_cookbook_paths(dir_name, false)
81
- end
82
- end
83
-
84
- Then /^the local Cookbook "([^"]*)" exists$/ do |ckbk|
85
- chef.cookbook_paths.each do |pn|
86
- curr_ckbk = pn.basename.to_s
87
- if curr_ckbk == ckbk
88
- break true if curr_ckbk.should == ckbk
89
- end
90
- end
91
- #TODO: check_file_presence([file], true), etc.
92
- end
93
-
94
- Then /^the local Site\-Cookbook "([^"]*)" exists$/ do |ckbk|
95
- ckbk_path = 'site-cookbook'
96
- chef.cookbook_paths.each do |pn|
97
- curr_ckbk = pn.basename.to_s
98
- if pn.to_s[/#{ckbk_path}}/] && curr_ckbk == ckbk
99
- break true if curr_ckbk.should == ckbk
100
- end
101
- end
102
- #TODO: check_file_presence([file], true), etc.
103
- end
104
-
105
- And /^these local Cookbooks exist:$/ do |table|
106
- check_cookbook_table_presence(table)
107
- end
108
-
109
- And /^these local Cookbooks do not exist:$/ do |table|
110
- check_cookbook_table_presence(table, false)
111
- end
112
-
113
- And /^these local Site\-Cookbooks exist:$/ do |table|
114
- # table is a Cucumber::Ast::Table
115
- ckbk_path = 'site-cookbook'
116
- table.hashes.each do |hsh|
117
- chef.cookbook_paths.each do |pn|
118
- curr_ckbk = pn.basename.to_s
119
- if pn.to_s[/#{ckbk_path}}/] && curr_ckbk == hsh['cookbook']
120
- break true if curr_ckbk.should == hsh['cookbook']
121
- end
122
- end
123
- end
124
- end
125
-
126
- Given /^I clone the remote Cookbook repository branch "([^"]*)" to "([^"]*)"$/ do |brnch, ckbk_path|
127
- if ckbk_path[/\/cookbooks\//]
128
- chef.local_cookbook_repo = chef_clone_repo(ckbk_path, true, chef.remote_cookbook_repo, {'branch' => brnch})
129
- elsif ckbk_path[/\/site-cookbooks\//]
130
- chef.local_site_cookbook_repo = chef_clone_repo(ckbk_path, true, chef.remote_cookbook_repo, {'branch' => brnch})
131
- end
132
- end
133
-
134
- Given /^I clone the Cookbook "([^"]*)" branch "([^"]*)" to "([^"]*)"$/ do |ckbk, brnch, ckbk_path|
135
- if ckbk_path[/\/cookbooks\//]
136
- chef.local_cookbook_repo = chef_clone_repo(ckbk_path, true, chef.cookbooks_uri + ckbk + '.git', {'branch' => brnch})
137
- elsif ckbk_path[/\/site-cookbooks\//]
138
- chef.local_site_cookbook_repo = chef_clone_repo(ckbk_path, true, chef.cookbooks_uri + ckbk + '.git', {'branch' => brnch})
139
- end
140
- end
141
-
142
- When /^I clone the Cookbooks:$/ do |table|
143
- table.hashes.each do |hsh|
144
- src = {}
145
- src['branch'] = hsh['branch'] if hsh['branch']
146
- src['tag'] = hsh['tag'] if hsh['tag']
147
- src['ref'] = hsh['ref'] if hsh['ref']
148
- ckbk = hsh['cookbook'] if hsh['cookbook']
149
- ckbk = hsh['site-cookbook'] if hsh['site-cookbook']
150
- local_repo = chef_clone_repo(hsh['destination'], true, chef.cookbooks_uri + ckbk + '.git', src )
151
- Pathname(local_repo).exist?.should be_true
152
- end
153
- end
154
-
155
- When /^I successfully generate all Cookbook metadata$/ do
156
- chef.cookbook_paths.each do |pn|
157
- curr_ckbk = pn.basename.to_s
158
- run_knife_command("cookbook metadata #{curr_ckbk}")
159
- end
160
- end
161
-
162
- When /^I successfully generate Cookbook "([^"]*)" metadata$/ do |ckbk|
163
- chef.cookbook_paths.each do |pn|
164
- curr_ckbk = pn.basename.to_s
165
- if curr_ckbk == ckbk
166
- run_knife_command("cookbook metadata #{curr_ckbk}")
167
- end
168
- end
169
- end
@@ -170,7 +170,7 @@ When /^I create a sandbox named '(.+)' for cookbook '([^\']+)'(?: minus files '(
170
170
  end
171
171
  end
172
172
 
173
- Then /^I upload a file named '(.+)' from cookbook '(.+)' to the sandbox/ do |path, cookbook_name|
173
+ Then /^I upload the file'(.+)' from cookbook '(.+)' to the sandbox/ do |path, cookbook_name|
174
174
  cookbook = @cookbook_loader_not_uploaded_at_feature_start[cookbook_name]
175
175
  raise ArgumentError, "no such cookbook in cookbooks_not_uploaded_at_feature_start: #{cookbook_name}" unless cookbook
176
176
 
@@ -63,7 +63,7 @@ end
63
63
  Then /^a callback named <callback_file> should exist$/ do |callback_files|
64
64
  callback_files.raw.each do |file|
65
65
  want_file = "deploy/current/deploy/#{file.first}"
66
- Then "a file named '#{want_file}' should exist"
66
+ Then "the file'#{want_file}' should exist"
67
67
  end
68
68
  end
69
69
 
@@ -16,11 +16,11 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- #Then /^a directory named '(.+)' should exist$/ do |dir|
19
+ #Then /^the directory'(.+)' should exist$/ do |dir|
20
20
  # File.directory?(File.join(tmpdir, dir)).should be(true)
21
21
  #end
22
22
  #
23
- #Then /^a directory named '(.+)' should not exist$/ do |dir|
23
+ #Then /^the directory'(.+)' should not exist$/ do |dir|
24
24
  # File.directory?(File.join(tmpdir, dir)).should be(false)
25
25
  #end
26
26
 
@@ -42,11 +42,11 @@ require 'etc'
42
42
  # Then
43
43
  ####
44
44
 
45
- #Then /^a file named '(.+)' should exist$/ do |filename|
45
+ #Then /^the file'(.+)' should exist$/ do |filename|
46
46
  # File.exists?(File.join(tmpdir, filename)).should be(true)
47
47
  #end
48
48
 
49
- #Then /^a file named '(.+)' should not exist$/ do |filename|
49
+ #Then /^the file'(.+)' should not exist$/ do |filename|
50
50
  # File.exists?(File.join(tmpdir, filename)).should be(false)
51
51
  #end
52
52
 
@@ -69,17 +69,17 @@ require 'etc'
69
69
  # end
70
70
  #end
71
71
 
72
- #Then /^a file named '(.+)' should contain '(.+)'$/ do |filename, contents|
72
+ #Then /^the file'(.+)' contains '(.+)'$/ do |filename, contents|
73
73
  # file = IO.read(File.join(tmpdir, filename))
74
74
  # file.should =~ /#{contents}/m
75
75
  #end
76
76
 
77
- #Then /^a file named '(.+)' should be from the '(.+)' specific directory$/ do |filename, specificity|
77
+ #Then /^the file'(.+)' should be from the '(.+)' specific directory$/ do |filename, specificity|
78
78
  # file = IO.read(File.join(tmpdir, filename))
79
79
  # file.should == "#{specificity}\n"
80
80
  #end
81
81
 
82
- #Then /^a file named '(.+)' should contain '(.+)' only '(.+)' time$/ do |filename, string, count|
82
+ #Then /^the file'(.+)' contains '(.+)' only '(.+)' time$/ do |filename, string, count|
83
83
  # seen_count = 0
84
84
  # IO.foreach(File.join(tmpdir, filename)) do |line|
85
85
  # if line =~ /#{string}/
@@ -22,7 +22,7 @@
22
22
  World(::Cuken::Api::Chef::Knife)
23
23
 
24
24
  Given /^the Knife file "([^"]*)"$/ do |path|
25
- in_current_dir do
25
+ in_dir do
26
26
  chef.knife_config_file = Pathname(path).expand_path.realdirpath
27
27
  end
28
28
  end
@@ -14,7 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
  #
17
- load 'aruba/cucumber.rb' unless defined? ::Aruba
17
+ #load 'aruba/cucumber.rb' unless defined? ::Aruba
18
18
  require 'grit'
19
19
 
20
20
  World(::Cuken::Api::Chef)
@@ -0,0 +1,34 @@
1
+ #
2
+ World(::Cuken::Api::Aruba::Api)
3
+
4
+ When /^I run `([^`]*)`$/ do |cmd|
5
+ run_simple(unescape(cmd), current_dir, false)
6
+ end
7
+
8
+ When /^I run `([^`]*)` in "([^"]*)"$/ do |cmd, dir|
9
+ run_simple(unescape(cmd), dir, false)
10
+ end
11
+
12
+ When /^I successfully run `([^`]*)`$/ do |cmd|
13
+ run_simple(unescape(cmd))
14
+ end
15
+
16
+ When /^I successfully run `([^`]*)` in "([^"]*)"$/ do |cmd, dir|
17
+ run_simple(unescape(cmd), dir)
18
+ end
19
+
20
+ When /^I interactively run `([^`]*)`$/ do |cmd|
21
+ run_interactive(unescape(cmd))
22
+ end
23
+
24
+ When /^I interactively run `([^`]*)` in "([^"]*)"$/ do |cmd, dir|
25
+ run_interactive(unescape(cmd), dir)
26
+ end
27
+
28
+ When /^I type "([^"]*)"$/ do |input|
29
+ type(input)
30
+ end
31
+
32
+ And /^I set the environment variable "([^"]*)" to "([^"]*)"$/ do |variable, value|
33
+ ENV[variable] = value
34
+ end
@@ -0,0 +1,30 @@
1
+ ########################################################################################################################
2
+ #
3
+ # Variation on Aruba's output steps
4
+ #
5
+ ########################################################################################################################
6
+
7
+ Then /^the exit status should be (\d+)$/ do |exit_status|
8
+ @last_exit_status.should == exit_status.to_i
9
+ end
10
+
11
+ Then /^the exit status does not be (\d+)$/ do |exit_status|
12
+ @last_exit_status.should_not == exit_status.to_i
13
+ end
14
+
15
+ Then /^it should (pass|fail) with:$/ do |pass_fail, partial_output|
16
+ self.__send__("assert_#{pass_fail}ing_with", partial_output)
17
+ end
18
+
19
+ Then /^it should (pass|fail) with exactly:$/ do |pass_fail, exact_output|
20
+ assert_exit_status_and_output(pass_fail == "pass", exact_output, true)
21
+ end
22
+
23
+ Then /^it should (pass|fail) with regexp?:$/ do |pass_fail, partial_output|
24
+ Then "the output matches:", partial_output
25
+ if pass_fail == 'pass'
26
+ @last_exit_status.should == 0
27
+ else
28
+ @last_exit_status.should_not == 0
29
+ end
30
+ end
@@ -1,36 +1,2 @@
1
- #
2
- # Author:: Hedgehog (<hedgehogshiatus@gmail.com>)
3
- # Copyright:: Copyright (c) 2011 Hedgehog.
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
- #
17
- load 'aruba/cucumber.rb' unless defined? ::Aruba
18
-
19
- World(::Cuken::Api::Cmd)
20
-
21
- #
22
- # These ought be submitted to Aruba...
23
- #
24
- Then /^the output from "(.*)" contains exactly:$/ do |cmd, exact_output|
25
- output_from(unescape(cmd)).should == exact_output
26
- end
27
- Then /^the output from "([^"]*)" does not contain exactly:$/ do |cmd, exact_output|
28
- output_from(unescape(cmd)).should_not == exact_output
29
- end
30
- Then /^the output from "([^"]*)" contains:$/ do |cmd, partial_output|
31
- output_from(unescape(cmd)).should =~ regexp(partial_output)
32
- end
33
- Then /^the output from "([^"]*)" does not contain:$/ do |cmd, partial_output|
34
- output_from(unescape(cmd)).should_not =~ regexp(partial_output)
35
- end
36
-
1
+ require 'cuken/cucumber/cmd/execution'
2
+ require 'cuken/cucumber/cmd/exit_status'
@@ -15,6 +15,48 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
+ World(::Cuken::Api::Common)
19
+
20
+ require 'cuken/cucumber/output/all'
21
+ require 'cuken/cucumber/output/cmd'
22
+ require 'cuken/cucumber/output/stderr'
23
+ require 'cuken/cucumber/output/stdout'
24
+
25
+ Before('@fast') do
26
+ @aruba_timeout_seconds.nil? || @aruba_timeout_seconds < 6 ? @aruba_timeout_seconds = 6 : @aruba_timeout_seconds
27
+ end
28
+ Before('@quick') do
29
+ @aruba_timeout_seconds.nil? || @aruba_timeout_seconds < 20 ? @aruba_timeout_seconds = 20 : @aruba_timeout_seconds
30
+ end
31
+ Before('@slow') do
32
+ @aruba_timeout_seconds.nil? || @aruba_timeout_seconds < 60 ? @aruba_timeout_seconds = 60 : @aruba_timeout_seconds
33
+ end
34
+ Before('@glacial') do
35
+ @aruba_timeout_seconds.nil? || @aruba_timeout_seconds < 600 ? @aruba_timeout_seconds = 600 : @aruba_timeout_seconds
36
+ end
37
+ # Some VM builds can take a while, depending on package repository speeds etc.
38
+ # Note:
39
+ # In a genuine disaster scenario you are more likely to, eventually, trying throwing this at the top of a feature file :(
40
+ Before('@cosmic') do
41
+ @aruba_timeout_seconds.nil? || @aruba_timeout_seconds < 3600 ? @aruba_timeout_seconds = 3600 : @aruba_timeout_seconds
42
+ end
43
+
44
+ When /^I cd to "([^"]*)"$/ do |dir|
45
+ cd(dir)
46
+ end
47
+
48
+ Given /^the working directory is "([^"]*)"$/ do |path|
49
+ @dirs = [path]
50
+ end
51
+
52
+ And /^wait "([^"]*)" seconds$/ do |delay|
53
+ ::Kernel.sleep(delay.to_f)
54
+ end
55
+
56
+ Given /^I'm using a clean gemset "([^"]*)"$/ do |gemset|
57
+ use_clean_gemset(gemset)
58
+ end
59
+
18
60
  Given /^Assumption: (.*)$/ do |msg|
19
61
  announce_or_puts(msg)
20
62
  end
@@ -27,10 +69,4 @@ Given /^Instruction: (.*)$/ do |msg|
27
69
  announce_or_puts(msg)
28
70
  end
29
71
 
30
- And /^wait "([^"]*)" seconds$/ do |delay|
31
- ::Kernel.sleep(delay.to_f)
32
- end
33
72
 
34
- Given /^the working directory is "([^"]*)"$/ do |path|
35
- @dirs = [path]
36
- end