producer-core 0.1.17 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Guardfile CHANGED
@@ -1,10 +1,10 @@
1
- guard :cucumber, cli: '--format pretty --quiet' do
1
+ guard :cucumber, cli: '--format pretty --quiet', all_on_start: false do
2
2
  watch(%r{\Afeatures/.+\.feature\z})
3
3
  watch(%r{\Afeatures/support/.+\.rb\z}) { 'features' }
4
4
  watch(%r{\Afeatures/step_definitions/.+_steps\.rb\z}) { 'features' }
5
5
  end
6
6
 
7
- guard :rspec, cmd: 'rspec -f doc' do
7
+ guard :rspec, cmd: 'bundle exec rspec -f doc' do
8
8
  watch(%r{\Aspec/.+_spec\.rb\z})
9
9
  watch(%r{\Alib/(.+)\.rb\z}) { |m| "spec/#{m[1]}_spec.rb" }
10
10
  watch('spec/spec_helper.rb') { 'spec' }
@@ -14,3 +14,5 @@ module Cucumber
14
14
  end
15
15
 
16
16
  require 'aruba/cucumber'
17
+
18
+ require 'cucumber/sshd/cucumber'
@@ -1,5 +1,5 @@
1
1
  @sshd
2
- Feature: `has_dir' condition keyword
2
+ Feature: `dir?' condition keyword
3
3
 
4
4
  Background:
5
5
  Given a recipe with:
@@ -7,7 +7,7 @@ Feature: `has_dir' condition keyword
7
7
  target 'some_host.test'
8
8
 
9
9
  task :testing_directory_existence do
10
- condition { has_dir 'some_directory' }
10
+ condition { dir? 'some_directory' }
11
11
 
12
12
  echo 'evaluated'
13
13
  end
@@ -1,5 +1,5 @@
1
1
  @sshd
2
- Feature: `has_env' condition keyword
2
+ Feature: `env?' condition keyword
3
3
 
4
4
  Scenario: succeeds when remote environment variable is defined
5
5
  Given a recipe with:
@@ -7,7 +7,7 @@ Feature: `has_env' condition keyword
7
7
  target 'some_host.test'
8
8
 
9
9
  task :testing_env_var_definition do
10
- condition { has_env :shell }
10
+ condition { env? :shell }
11
11
 
12
12
  echo 'evaluated'
13
13
  end
@@ -21,7 +21,7 @@ Feature: `has_env' condition keyword
21
21
  target 'some_host.test'
22
22
 
23
23
  task :testing_env_var_definition do
24
- condition { has_env :inexistent_var }
24
+ condition { env? :inexistent_var }
25
25
 
26
26
  echo 'evaluated'
27
27
  end
@@ -1,5 +1,5 @@
1
1
  @sshd
2
- Feature: `has_executable' condition keyword
2
+ Feature: `executable?' condition keyword
3
3
 
4
4
  Scenario: succeeds when remote executable is available
5
5
  Given a recipe with:
@@ -7,7 +7,7 @@ Feature: `has_executable' condition keyword
7
7
  target 'some_host.test'
8
8
 
9
9
  task :testing_executable_availability do
10
- condition { has_executable 'true' }
10
+ condition { executable? 'true' }
11
11
 
12
12
  echo 'evaluated'
13
13
  end
@@ -21,7 +21,7 @@ Feature: `has_executable' condition keyword
21
21
  target 'some_host.test'
22
22
 
23
23
  task :testing_executable_availability do
24
- condition { has_executable 'some_non_existent_executable' }
24
+ condition { executable? 'some_non_existent_executable' }
25
25
 
26
26
  echo 'evaluated'
27
27
  end
@@ -1,5 +1,5 @@
1
1
  @sshd
2
- Feature: `has_file' condition keyword
2
+ Feature: `file?' condition keyword
3
3
 
4
4
  Background:
5
5
  Given a recipe with:
@@ -7,7 +7,7 @@ Feature: `has_file' condition keyword
7
7
  target 'some_host.test'
8
8
 
9
9
  task :testing_file_existence do
10
- condition { has_file 'some_file' }
10
+ condition { file? 'some_file' }
11
11
 
12
12
  echo 'evaluated'
13
13
  end
@@ -7,13 +7,13 @@ Feature: negated test prefix (no_)
7
7
  target 'some_host.test'
8
8
 
9
9
  task :successful_test do
10
- condition { has_env :shell }
10
+ condition { env? :shell }
11
11
 
12
12
  echo 'successful_test'
13
13
  end
14
14
 
15
15
  task :negated_test do
16
- condition { no_has_env :shell }
16
+ condition { no_env? :shell }
17
17
 
18
18
  echo 'negated_test'
19
19
  end
@@ -28,13 +28,13 @@ Feature: negated test prefix (no_)
28
28
  target 'some_host.test'
29
29
 
30
30
  task :failing_test do
31
- condition { has_env :inexistent_var }
31
+ condition { env? :inexistent_var }
32
32
 
33
33
  echo 'failing_test'
34
34
  end
35
35
 
36
36
  task :negated_test do
37
- condition { no_has_env :inexistent_var }
37
+ condition { no_env? :inexistent_var }
38
38
 
39
39
  echo 'negated_test'
40
40
  end
@@ -16,10 +16,10 @@ module Producer
16
16
  define_test :`, Tests::ShellCommandStatus
17
17
  define_test :sh, Tests::ShellCommandStatus
18
18
  define_test :file_contains, Tests::FileContains
19
- define_test :has_env, Tests::HasEnv
20
- define_test :has_executable, Tests::HasExecutable
21
- define_test :has_dir, Tests::HasDir
22
- define_test :has_file, Tests::HasFile
19
+ define_test :env?, Tests::HasEnv
20
+ define_test :executable?, Tests::HasExecutable
21
+ define_test :dir?, Tests::HasDir
22
+ define_test :file?, Tests::HasFile
23
23
 
24
24
  attr_reader :block, :env, :tests
25
25
 
@@ -1,5 +1,5 @@
1
1
  module Producer
2
2
  module Core
3
- VERSION = '0.1.17'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
@@ -20,8 +20,9 @@ Gem::Specification.new do |s|
20
20
  s.add_dependency 'net-ssh', '~> 2.7'
21
21
  s.add_dependency 'net-sftp', '~> 2.1'
22
22
 
23
- s.add_development_dependency 'rspec', '~> 2.14'
24
- s.add_development_dependency 'cucumber', '~> 1.3'
25
- s.add_development_dependency 'aruba', '~> 0.5'
26
- s.add_development_dependency 'rake', '~> 10.1'
23
+ s.add_development_dependency 'rspec', '~> 2.14'
24
+ s.add_development_dependency 'cucumber', '~> 1.3'
25
+ s.add_development_dependency 'aruba', '~> 0.5'
26
+ s.add_development_dependency 'cucumber-sshd', '~> 0.1'
27
+ s.add_development_dependency 'rake', '~> 10.1'
27
28
  end
@@ -11,10 +11,10 @@ module Producer::Core
11
11
  `
12
12
  sh
13
13
  file_contains
14
- has_dir
15
- has_env
16
- has_executable
17
- has_file
14
+ dir?
15
+ env?
16
+ executable?
17
+ file?
18
18
  ].each do |test|
19
19
  it "has `#{test}' test defined" do
20
20
  expect(dsl).to respond_to test.to_sym
@@ -1,6 +1,21 @@
1
- module NetSSHStoryHelpers
2
- require 'net/ssh/test'
1
+ require 'net/ssh/test'
2
+
3
+ if Net::SSH::Version::CURRENT >= Net::SSH::Version[2, 8, 0]
4
+ module Net
5
+ module SSH
6
+ module Test
7
+ class Socket
8
+ def open(host, port, connections_options = nil)
9
+ @host, @port = host, port
10
+ self
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
3
17
 
18
+ module NetSSHStoryHelpers
4
19
  include Net::SSH::Test
5
20
 
6
21
  def story_with_new_channel
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: producer-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.17
4
+ version: 0.2.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Thibault Jouan
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-03-08 00:00:00.000000000 Z
12
+ date: 2014-04-23 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: net-ssh
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - "~>"
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: net-sftp
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - "~>"
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - "~>"
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: rspec
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - "~>"
53
60
  - !ruby/object:Gem::Version
@@ -55,6 +62,7 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: cucumber
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - "~>"
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,7 @@ dependencies:
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
75
  - - "~>"
67
76
  - !ruby/object:Gem::Version
@@ -69,6 +78,7 @@ dependencies:
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: aruba
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
83
  - - "~>"
74
84
  - !ruby/object:Gem::Version
@@ -76,13 +86,31 @@ dependencies:
76
86
  type: :development
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
91
  - - "~>"
81
92
  - !ruby/object:Gem::Version
82
93
  version: '0.5'
94
+ - !ruby/object:Gem::Dependency
95
+ name: cucumber-sshd
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '0.1'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '0.1'
83
110
  - !ruby/object:Gem::Dependency
84
111
  name: rake
85
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
86
114
  requirements:
87
115
  - - "~>"
88
116
  - !ruby/object:Gem::Version
@@ -90,6 +118,7 @@ dependencies:
90
118
  type: :development
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
93
122
  requirements:
94
123
  - - "~>"
95
124
  - !ruby/object:Gem::Version
@@ -126,17 +155,16 @@ files:
126
155
  - features/steps/recipe_steps.rb
127
156
  - features/steps/remote_steps.rb
128
157
  - features/steps/ssh_steps.rb
129
- - features/support/env_aruba.rb
158
+ - features/support/env.rb
130
159
  - features/support/env_cucumber-doc_string.rb
131
- - features/support/ssh.rb
132
160
  - features/tasks/condition.feature
133
161
  - features/tasks/evaluation.feature
134
162
  - features/tasks/registry.feature
163
+ - features/tests/dir.feature
164
+ - features/tests/env.feature
165
+ - features/tests/executable.feature
166
+ - features/tests/file.feature
135
167
  - features/tests/file_contains.feature
136
- - features/tests/has_dir.feature
137
- - features/tests/has_env.feature
138
- - features/tests/has_executable.feature
139
- - features/tests/has_file.feature
140
168
  - features/tests/negated_test.feature
141
169
  - features/tests/shell_command_status.feature
142
170
  - lib/producer/core.rb
@@ -212,26 +240,27 @@ files:
212
240
  - spec/support/test_env_helpers.rb
213
241
  homepage: https://rubygems.org/gems/producer-core
214
242
  licenses: []
215
- metadata: {}
216
243
  post_install_message:
217
244
  rdoc_options: []
218
245
  require_paths:
219
246
  - lib
220
247
  required_ruby_version: !ruby/object:Gem::Requirement
248
+ none: false
221
249
  requirements:
222
250
  - - ">="
223
251
  - !ruby/object:Gem::Version
224
252
  version: '0'
225
253
  required_rubygems_version: !ruby/object:Gem::Requirement
254
+ none: false
226
255
  requirements:
227
256
  - - ">="
228
257
  - !ruby/object:Gem::Version
229
258
  version: '0'
230
259
  requirements: []
231
260
  rubyforge_project:
232
- rubygems_version: 2.2.2
261
+ rubygems_version: 1.8.29
233
262
  signing_key:
234
- specification_version: 4
263
+ specification_version: 3
235
264
  summary: Provisioning tool
236
265
  test_files:
237
266
  - features/actions/echo.feature
@@ -252,17 +281,16 @@ test_files:
252
281
  - features/steps/recipe_steps.rb
253
282
  - features/steps/remote_steps.rb
254
283
  - features/steps/ssh_steps.rb
255
- - features/support/env_aruba.rb
284
+ - features/support/env.rb
256
285
  - features/support/env_cucumber-doc_string.rb
257
- - features/support/ssh.rb
258
286
  - features/tasks/condition.feature
259
287
  - features/tasks/evaluation.feature
260
288
  - features/tasks/registry.feature
289
+ - features/tests/dir.feature
290
+ - features/tests/env.feature
291
+ - features/tests/executable.feature
292
+ - features/tests/file.feature
261
293
  - features/tests/file_contains.feature
262
- - features/tests/has_dir.feature
263
- - features/tests/has_env.feature
264
- - features/tests/has_executable.feature
265
- - features/tests/has_file.feature
266
294
  - features/tests/negated_test.feature
267
295
  - features/tests/shell_command_status.feature
268
296
  - spec/fixtures/recipes/empty.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 30fb89006ff65ccf133c3ba8169115217d1331f3
4
- data.tar.gz: 5ca30ada198418333e91f5d7b5eabf7c13d95e9f
5
- SHA512:
6
- metadata.gz: 494eedfa740e3628b1b7d145dd7bfbfa96fb3f055661d243f0069b36e0b53bdb19282f1c93284dcd5fd3244af5e686fbac9b82592b45d81541a1970793e3adae
7
- data.tar.gz: 1639982191a5860d744055dabb87192e800ad93fc450cb392492d355a9be1781da3e41e43040ba279aa3a689f53323a8c59c3b3c6291897064c4fc888b822c5d
@@ -1,107 +0,0 @@
1
- # FIXME: should be extracted as a separate gem `cucumber-sshd?'.
2
- class SSHServer
3
- include Aruba::Api
4
-
5
- DEFAULT_LISTEN_PORT = 2222
6
- KEY_PATH = 'etc/ssh_host_rsa_key'
7
- KEY_PUB_PATH = KEY_PATH.dup << '.pub'
8
- SSHD_CONFIG_PATH = 'etc/sshd_config'
9
- SSH_CONFIG_PATH = '.ssh/config'
10
-
11
- attr_accessor :listen_port
12
-
13
- def initialize(base_path)
14
- @base_path = base_path
15
- @listen_port = ENV['PRODUCER_TEST_SSHD_PORT'] ?
16
- ENV['PRODUCER_TEST_SSHD_PORT'] :
17
- DEFAULT_LISTEN_PORT
18
- end
19
-
20
- def start
21
- in_current_dir do
22
- @pid = fork do
23
- $stderr.reopen '/dev/null'
24
- exec "/usr/sbin/sshd -f etc/sshd_config -Deq"
25
- end
26
- end
27
- end
28
-
29
- def stop
30
- Process.kill('TERM', @pid)
31
- Process.wait(@pid)
32
- end
33
-
34
- def make_env
35
- %w[etc .ssh].map { |e| create_dir e }
36
-
37
- write_file KEY_PATH, <<-eoh
38
- -----BEGIN RSA PRIVATE KEY-----
39
- MIIEpAIBAAKCAQEA7EVDKeM7NYCGGVJw0wWLGCoptMFSR7DobhbEx2bAQbWDLFBF
40
- 7S9bXpW/ddebFA4GBkHVriNPwu/IGjIgO3tivVcy6iguNKdYRABlSfpeAs+OdCzK
41
- hyEWhmKnFMZs2MhPiJg/KUep2gFZLoEcs9vkk37+cLcuUVkXVOSPXlYCuHjgkwaN
42
- 9ij/KvCcLP4tw83H3Pyh1Wn/Y4k1+3nWN2S3RgRHF9RjEx7nm2FmXcZq1wygPe5G
43
- 2bQNvZKykL+wlKIHwKiM4AWpVClczOiljNv9KROhGWanIZNNBIDTnikxFvY0FyoP
44
- 1qvRrE8BlqxNeyG/vYNmXsv8xpO0MOF65z3d2QIDAQABAoIBAHL8dmZxX0R3i0vR
45
- knUwsnQNOQTuPPQFBelmDViaCiEwjGlJm+6F6KrMqERarO+Cr63l5m98YfoWJkWR
46
- dZxdPT22rWHGMk6PzuYxZxoszgoCJ2skzWAcW1EFvBjhROHwAr0Qk1Ssut4NX/DB
47
- B04FS2X5HS2QCOuwNymqnpejtmk+A2hv9bGVzj0X614gX3h5+0dImGrYE0Lu+Abf
48
- 5fvWhN5nxgK5CVlU7WM09WxyHj9lBXI+W2dgTl6w3QJfBBQTkarLmDpwIeErq9xc
49
- al2qHj60nYC+RdFopuLfJWKiObdKRFpuPFYKbTA9nJz9T61zAF+LaDZ1mvdTuQmz
50
- jJEJ0nECgYEA+o2uJcDOCD2LBp2LqeQc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sUDgYGQdWuI0/C78gaMiA7e2K9VzLqKC40p1hEAGVJ+l4Cz450LMqHIRaGYqcUxmzYyE+ImD8pR6naAVkugRyz2+STfv5wty5RWRdU5I9eVgK4eOCTBo32KP8q8Jws/i3Dzcfc/KHVaf9jiTX7edY3ZLdGBEcX1GMTHuebYWZdxmrXDKA97kbZtA29krKQv7CUogfAqIzgBalUKVzM6KWM2/0pE6EZZqchk00EgNOeKTEW9jQXKg/Wq9GsTwGWrE17Ib+9g2Zey/zGk7Qw4XrnPd3Z
69
- eoh
70
-
71
- write_file SSHD_CONFIG_PATH, <<-eoh
72
- Port #{listen_port}
73
- ListenAddress ::1
74
-
75
- Protocol 2
76
- HostKey #{File.expand_path @base_path}/#{KEY_PATH}
77
- PidFile /dev/null
78
- UsePrivilegeSeparation no
79
- Subsystem sftp /usr/lib/openssh/sftp-server
80
- ForceCommand HOME=#{File.expand_path @base_path} sh -c "cd ~; $SSH_ORIGINAL_COMMAND"
81
- eoh
82
-
83
- write_file SSH_CONFIG_PATH, <<-eoh
84
- Host some_host.test
85
- HostName localhost
86
- Port #{listen_port}
87
- eoh
88
- end
89
- end
90
-
91
-
92
- Before('@sshd') do
93
- @_sshd = SSHServer.new(current_dir)
94
- @_sshd.make_env
95
- @_sshd.start
96
-
97
- ENV['HOME'] = File.expand_path current_dir
98
-
99
- # FIXME: we might need to wait until sshd accepts connections, polling isn't
100
- # really acceptable, another workaround might be to execute sshd with
101
- # LD_PRELOAD and a hook, so we could block here until the hook release the
102
- # blocking call.
103
- end
104
-
105
- After('@sshd') do
106
- @_sshd.stop
107
- end