cucumber-chef 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@ Feature: Perform test driven infrastructure with Cucumber-Chef
12
12
  * the chef-client has been run on "<%= @project %>"
13
13
  * I ssh to "<%= @project %>" with the following credentials:
14
14
  | username | keyfile |
15
- | root | ../.ssh/id_rsa |
15
+ | root | ./.cucumber-chef/id_rsa-ubuntu |
16
16
 
17
17
  Scenario: Can connect to the provisioned server via SSH authentication
18
18
  When I run "hostname"
@@ -85,7 +85,7 @@ module Cucumber
85
85
  if @server
86
86
  @stdout.print("Waiting for SSHD...")
87
87
  Cucumber::Chef.spinner do
88
- Cucumber::Chef::TCPSocket.new(@server.public_ip_address, 22).wait
88
+ ZTK::TCPSocketCheck.new(:host => @server.public_ip_address, :port => 22).wait
89
89
  end
90
90
  @stdout.puts("done.\n")
91
91
  end
@@ -131,7 +131,7 @@ module Cucumber
131
131
 
132
132
  @stdout.print("Waiting for SSHD...")
133
133
  Cucumber::Chef.spinner do
134
- Cucumber::Chef::TCPSocket.new(@server.public_ip_address, 22).wait
134
+ ZTK::TCPSocketCheck.new(:host => @server.public_ip_address, :port => 22).wait
135
135
  end
136
136
  @stdout.puts("done.\n")
137
137
 
@@ -323,10 +323,12 @@ module Cucumber
323
323
  security_group.authorize_port_range(22..22) if port_ranges.none?{ |port_range| port_range === 22 }
324
324
  security_group.authorize_port_range(4000..4000) if port_ranges.none?{ |port_range| port_range === 4000 }
325
325
  security_group.authorize_port_range(4040..4040) if port_ranges.none?{ |port_range| port_range === 4040 }
326
+ security_group.authorize_port_range(8787..8787) if port_ranges.none?{ |port_range| port_range === 8787 }
326
327
  elsif (security_group = @connection.security_groups.new(:name => security_group_name, :description => "cucumber-chef test lab")).save
327
328
  security_group.authorize_port_range(22..22)
328
329
  security_group.authorize_port_range(4000..4000)
329
330
  security_group.authorize_port_range(4040..4040)
331
+ security_group.authorize_port_range(8787..8787)
330
332
  else
331
333
  raise TestLabError, "Could not find an existing or create a new AWS security group."
332
334
  end
@@ -124,6 +124,18 @@ module Cucumber
124
124
  warning.join("\n")
125
125
  end
126
126
 
127
+ ################################################################################
128
+
129
+ def external_ip
130
+ %x( wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//' ).chomp
131
+ end
132
+
133
+ def log_file
134
+ config_path = File.join(Cucumber::Chef.locate_parent(".chef"), ".cucumber-chef")
135
+ FileUtils.mkdir_p(config_path)
136
+ File.join(config_path, "cucumber-chef.log")
137
+ end
138
+
127
139
  ################################################################################
128
140
 
129
141
  end
@@ -24,7 +24,7 @@ module Cucumber
24
24
 
25
25
  ################################################################################
26
26
 
27
- VERSION = "2.0.4" unless const_defined?(:VERSION)
27
+ VERSION = "2.0.5" unless const_defined?(:VERSION)
28
28
 
29
29
  ################################################################################
30
30
 
@@ -22,7 +22,7 @@
22
22
  require 'cucumber-chef'
23
23
 
24
24
  dev_null = File.open("/dev/null", "w")
25
- $logger = Cucumber::Chef::Logger.new(dev_null)
25
+ $logger = ZTK::Logger.new(dev_null)
26
26
 
27
27
  require 'simplecov'
28
28
  SimpleCov.start do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-09-16 00:00:00.000000000 Z
13
+ date: 2012-10-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: chef
@@ -45,13 +45,13 @@ dependencies:
45
45
  - !ruby/object:Gem::Version
46
46
  version: 1.2.0
47
47
  - !ruby/object:Gem::Dependency
48
- name: erubis
48
+ name: fog
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
- version: 2.7.0
54
+ version: 1.3.1
55
55
  type: :runtime
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
@@ -59,15 +59,15 @@ dependencies:
59
59
  requirements:
60
60
  - - ! '>='
61
61
  - !ruby/object:Gem::Version
62
- version: 2.7.0
62
+ version: 1.3.1
63
63
  - !ruby/object:Gem::Dependency
64
- name: fog
64
+ name: mixlib-config
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  none: false
67
67
  requirements:
68
68
  - - ! '>='
69
69
  - !ruby/object:Gem::Version
70
- version: 1.3.1
70
+ version: 1.1.2
71
71
  type: :runtime
72
72
  prerelease: false
73
73
  version_requirements: !ruby/object:Gem::Requirement
@@ -75,15 +75,15 @@ dependencies:
75
75
  requirements:
76
76
  - - ! '>='
77
77
  - !ruby/object:Gem::Version
78
- version: 1.3.1
78
+ version: 1.1.2
79
79
  - !ruby/object:Gem::Dependency
80
- name: net-sftp
80
+ name: thor
81
81
  requirement: !ruby/object:Gem::Requirement
82
82
  none: false
83
83
  requirements:
84
84
  - - ! '>='
85
85
  - !ruby/object:Gem::Version
86
- version: 2.0.5
86
+ version: 0.15.2
87
87
  type: :runtime
88
88
  prerelease: false
89
89
  version_requirements: !ruby/object:Gem::Requirement
@@ -91,15 +91,15 @@ dependencies:
91
91
  requirements:
92
92
  - - ! '>='
93
93
  - !ruby/object:Gem::Version
94
- version: 2.0.5
94
+ version: 0.15.2
95
95
  - !ruby/object:Gem::Dependency
96
- name: net-ssh
96
+ name: rake
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  none: false
99
99
  requirements:
100
100
  - - ! '>='
101
101
  - !ruby/object:Gem::Version
102
- version: 2.2.2
102
+ version: 0.9.2
103
103
  type: :runtime
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
@@ -107,15 +107,15 @@ dependencies:
107
107
  requirements:
108
108
  - - ! '>='
109
109
  - !ruby/object:Gem::Version
110
- version: 2.2.2
110
+ version: 0.9.2
111
111
  - !ruby/object:Gem::Dependency
112
- name: mixlib-config
112
+ name: ubuntu_ami
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  none: false
115
115
  requirements:
116
116
  - - ! '>='
117
117
  - !ruby/object:Gem::Version
118
- version: 1.1.2
118
+ version: 0.4.0
119
119
  type: :runtime
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
@@ -123,15 +123,15 @@ dependencies:
123
123
  requirements:
124
124
  - - ! '>='
125
125
  - !ruby/object:Gem::Version
126
- version: 1.1.2
126
+ version: 0.4.0
127
127
  - !ruby/object:Gem::Dependency
128
- name: thor
128
+ name: rspec
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  none: false
131
131
  requirements:
132
132
  - - ! '>='
133
133
  - !ruby/object:Gem::Version
134
- version: 0.15.2
134
+ version: 2.10.0
135
135
  type: :runtime
136
136
  prerelease: false
137
137
  version_requirements: !ruby/object:Gem::Requirement
@@ -139,15 +139,15 @@ dependencies:
139
139
  requirements:
140
140
  - - ! '>='
141
141
  - !ruby/object:Gem::Version
142
- version: 0.15.2
142
+ version: 2.10.0
143
143
  - !ruby/object:Gem::Dependency
144
- name: rake
144
+ name: ztk
145
145
  requirement: !ruby/object:Gem::Requirement
146
146
  none: false
147
147
  requirements:
148
148
  - - ! '>='
149
149
  - !ruby/object:Gem::Version
150
- version: 0.9.2
150
+ version: '0'
151
151
  type: :runtime
152
152
  prerelease: false
153
153
  version_requirements: !ruby/object:Gem::Requirement
@@ -155,31 +155,31 @@ dependencies:
155
155
  requirements:
156
156
  - - ! '>='
157
157
  - !ruby/object:Gem::Version
158
- version: 0.9.2
158
+ version: '0'
159
159
  - !ruby/object:Gem::Dependency
160
- name: ubuntu_ami
160
+ name: simplecov
161
161
  requirement: !ruby/object:Gem::Requirement
162
162
  none: false
163
163
  requirements:
164
164
  - - ! '>='
165
165
  - !ruby/object:Gem::Version
166
- version: 0.4.0
167
- type: :runtime
166
+ version: 0.6.4
167
+ type: :development
168
168
  prerelease: false
169
169
  version_requirements: !ruby/object:Gem::Requirement
170
170
  none: false
171
171
  requirements:
172
172
  - - ! '>='
173
173
  - !ruby/object:Gem::Version
174
- version: 0.4.0
174
+ version: 0.6.4
175
175
  - !ruby/object:Gem::Dependency
176
- name: rspec
176
+ name: pry
177
177
  requirement: !ruby/object:Gem::Requirement
178
178
  none: false
179
179
  requirements:
180
180
  - - ! '>='
181
181
  - !ruby/object:Gem::Version
182
- version: 2.10.0
182
+ version: '0'
183
183
  type: :development
184
184
  prerelease: false
185
185
  version_requirements: !ruby/object:Gem::Requirement
@@ -187,15 +187,15 @@ dependencies:
187
187
  requirements:
188
188
  - - ! '>='
189
189
  - !ruby/object:Gem::Version
190
- version: 2.10.0
190
+ version: '0'
191
191
  - !ruby/object:Gem::Dependency
192
- name: simplecov
192
+ name: yard
193
193
  requirement: !ruby/object:Gem::Requirement
194
194
  none: false
195
195
  requirements:
196
196
  - - ! '>='
197
197
  - !ruby/object:Gem::Version
198
- version: 0.6.4
198
+ version: '0'
199
199
  type: :development
200
200
  prerelease: false
201
201
  version_requirements: !ruby/object:Gem::Requirement
@@ -203,9 +203,9 @@ dependencies:
203
203
  requirements:
204
204
  - - ! '>='
205
205
  - !ruby/object:Gem::Version
206
- version: 0.6.4
206
+ version: '0'
207
207
  - !ruby/object:Gem::Dependency
208
- name: pry
208
+ name: redcarpet
209
209
  requirement: !ruby/object:Gem::Requirement
210
210
  none: false
211
211
  requirements:
@@ -227,8 +227,9 @@ email:
227
227
  executables:
228
228
  - cc-console
229
229
  - cc-knife
230
+ - cc-push
231
+ - cc-server
230
232
  - cucumber-chef
231
- - push-cucumber-chef
232
233
  extensions: []
233
234
  extra_rdoc_files: []
234
235
  files:
@@ -244,8 +245,9 @@ files:
244
245
  - TODO.md
245
246
  - bin/cc-console
246
247
  - bin/cc-knife
248
+ - bin/cc-push
249
+ - bin/cc-server
247
250
  - bin/cucumber-chef
248
- - bin/push-cucumber-chef
249
251
  - chef_repo/cookbooks/cucumber-chef/LICENSE
250
252
  - chef_repo/cookbooks/cucumber-chef/README.md
251
253
  - chef_repo/cookbooks/cucumber-chef/attributes/default.rb
@@ -279,7 +281,6 @@ files:
279
281
  - lib/cucumber-chef.rb
280
282
  - lib/cucumber/chef.rb
281
283
  - lib/cucumber/chef/bootstrap.rb
282
- - lib/cucumber/chef/command.rb
283
284
  - lib/cucumber/chef/config.rb
284
285
  - lib/cucumber/chef/helpers.rb
285
286
  - lib/cucumber/chef/helpers/chef_client.rb
@@ -290,16 +291,12 @@ files:
290
291
  - lib/cucumber/chef/helpers/server.rb
291
292
  - lib/cucumber/chef/helpers/test_lab.rb
292
293
  - lib/cucumber/chef/helpers/utility.rb
293
- - lib/cucumber/chef/logger.rb
294
294
  - lib/cucumber/chef/provisioner.rb
295
- - lib/cucumber/chef/ssh.rb
296
295
  - lib/cucumber/chef/steps.rb
297
296
  - lib/cucumber/chef/steps/chef_steps.rb
298
297
  - lib/cucumber/chef/steps/minitest_steps.rb
299
298
  - lib/cucumber/chef/steps/provision_steps.rb
300
299
  - lib/cucumber/chef/steps/ssh_steps.rb
301
- - lib/cucumber/chef/tcp_socket.rb
302
- - lib/cucumber/chef/template.rb
303
300
  - lib/cucumber/chef/templates/bootstrap/ubuntu-precise-test-lab.erb
304
301
  - lib/cucumber/chef/templates/cucumber-chef/config-rb.erb
305
302
  - lib/cucumber/chef/templates/cucumber-chef/cucumber-yml.erb
@@ -312,7 +309,6 @@ files:
312
309
  - lib/cucumber/chef/templates/cucumber/readme-roles.erb
313
310
  - lib/cucumber/chef/templates/cucumber/readme.erb
314
311
  - lib/cucumber/chef/test_lab.rb
315
- - lib/cucumber/chef/test_runner.rb
316
312
  - lib/cucumber/chef/utility.rb
317
313
  - lib/cucumber/chef/version.rb
318
314
  - spec/cucumber/chef/config_spec.rb
@@ -358,3 +354,4 @@ test_files:
358
354
  - spec/cucumber/chef/provisioner_spec.rb
359
355
  - spec/cucumber/chef/test_lab_spec.rb
360
356
  - spec/spec_helper.rb
357
+ has_rdoc:
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'cucumber-chef'
3
-
4
- def run(command)
5
- puts "Executing: '#{command}'"
6
- @ssh.exec(command)
7
- end
8
-
9
- $logger = Cucumber::Chef::Logger.new
10
- $logger.level = (Cucumber::Chef.is_rc? ? Cucumber::Chef::Logger::DEBUG : Cucumber::Chef::Logger::INFO)
11
-
12
- message = "push-cucumber-chef v#{Cucumber::Chef::VERSION}"
13
- puts(message)
14
- $logger.info { message }
15
-
16
- Cucumber::Chef::Config.load
17
- if (test_lab = Cucumber::Chef::TestLab.new) && (test_lab.labs_running.count > 0)
18
- @ssh = Cucumber::Chef::SSH.new
19
- @ssh.config[:host] = test_lab.labs_running.first.public_ip_address
20
- @ssh.config[:ssh_user] = "ubuntu"
21
- @ssh.config[:identity_file] = Cucumber::Chef.locate(:file, ".cucumber-chef", "id_rsa-#{@ssh.config[:ssh_user]}")
22
-
23
- gem_name = "cucumber-chef-#{Cucumber::Chef::VERSION}.gem"
24
-
25
- puts %x(cd #{Cucumber::Chef.root} && gem build cucumber-chef.gemspec -V)
26
-
27
- local_file = File.join(Cucumber::Chef.root, gem_name)
28
- remote_file = File.join("/", "home", @ssh.config[:ssh_user], gem_name)
29
- puts("#{local_file} -> #{@ssh.config[:ssh_user]}@#{test_lab.labs_running.first.public_ip_address}:#{remote_file}")
30
- @ssh.upload(local_file, remote_file)
31
- FileUtils.rm_f(File.join(Cucumber::Chef.root, "*.gem"))
32
-
33
- run("cd #{File.dirname(remote_file)}; ls -la | grep 'cucumber-chef-'; sudo gem uninstall cucumber-chef -a -I -x -V; sudo gem install #{gem_name} -l -V; rm -f *.gem")
34
-
35
- else
36
- puts("No running cucumber-chef test labs to connect to!")
37
- exit(1)
38
- end
@@ -1,78 +0,0 @@
1
- ################################################################################
2
- #
3
- # Author: Stephen Nelson-Smith <stephen@atalanta-systems.com>
4
- # Author: Zachary Patten <zachary@jovelabs.com>
5
- # Copyright: Copyright (c) 2011-2012 Atalanta Systems Ltd
6
- # License: Apache License, Version 2.0
7
- #
8
- # Licensed under the Apache License, Version 2.0 (the "License");
9
- # you may not use this file except in compliance with the License.
10
- # You may obtain a copy of the License at
11
- #
12
- # http://www.apache.org/licenses/LICENSE-2.0
13
- #
14
- # Unless required by applicable law or agreed to in writing, software
15
- # distributed under the License is distributed on an "AS IS" BASIS,
16
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- # See the License for the specific language governing permissions and
18
- # limitations under the License.
19
- #
20
- ################################################################################
21
-
22
- module Cucumber
23
- module Chef
24
-
25
- class CommandError < Error; end
26
-
27
- class Command
28
- attr_accessor :stdout, :stderr, :stdin
29
-
30
- ################################################################################
31
-
32
- def initialize(stdout=STDOUT, stderr=STDERR, stdin=STDIN)
33
- @stdout, @stderr, @stdin = stdout, stderr, stdin
34
- @stdout.sync = true if @stdout.respond_to?(:sync=)
35
-
36
- @knife = (Cucumber::Chef.locate(:file, "bin", "knife") rescue nil)
37
- @knife = "/usr/bin/env knife" unless @knife
38
- end
39
-
40
- ################################################################################
41
-
42
- def run(command, options={})
43
- options = { :exit_code => 0, :silence => false }.merge(options)
44
- exit_code = options[:exit_code]
45
- silence = options[:silence]
46
- $logger.debug { "options(#{options.inspect})" }
47
-
48
- command = "#{command} 2>&1"
49
- $logger.debug { "command(#{command})" }
50
- output = %x( #{command} )
51
- $logger.debug { "exit_code(#{$?})" }
52
-
53
- $logger.debug { "--------------------------------------------------------------------------------" }
54
- $logger.debug { output }
55
- $logger.debug { "--------------------------------------------------------------------------------" }
56
-
57
- @stdout.puts(output) if !silence
58
-
59
- raise CommandError, "run(#{command}) failed! [#{$?}]" if ($? != exit_code)
60
-
61
- output
62
- end
63
-
64
- ################################################################################
65
-
66
- def knife(command, options={})
67
- knife_rb = File.expand_path(File.join(Dir.pwd, ".cucumber-chef", "knife.rb"))
68
- run("#{@knife} #{command.flatten.compact.join(" ")} -c #{knife_rb} --color -n", options)
69
- end
70
-
71
- ################################################################################
72
-
73
- end
74
-
75
- end
76
- end
77
-
78
- ################################################################################