cuke4php 0.9.3 → 0.9.4
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.
- data/Gemfile +1 -2
- data/HISTORY +6 -1
- data/README.md +1 -6
- data/VERSION +1 -1
- data/bin/cuke4php +40 -8
- data/cuke4php.gemspec +4 -4
- data/features/step_definitions/Cuke4Php.wire +1 -1
- metadata +7 -5
data/Gemfile
CHANGED
data/HISTORY
CHANGED
@@ -12,4 +12,9 @@
|
|
12
12
|
|
13
13
|
2011-01-30
|
14
14
|
* use magic setters and getters to allow assignment and retrieval of properties on steps
|
15
|
-
* implement step argument transformations
|
15
|
+
* implement step argument transformations
|
16
|
+
|
17
|
+
2011-03-23 -- 0.9.3
|
18
|
+
* utilizes cucumber 0.10.2's ability to use erb templates in .wire files to listen to a specific port
|
19
|
+
* release 0.9.3
|
20
|
+
* modify cuke4php runner script to dynamically pick an unused port
|
data/README.md
CHANGED
@@ -21,7 +21,7 @@ Usage
|
|
21
21
|
* make sure your cucumber features has a 'Cuke4Php.wire' file in step_definitions containing something like:
|
22
22
|
|
23
23
|
host: localhost
|
24
|
-
port:
|
24
|
+
port: <%= ENV['CUKE4PHP_PORT'] %>
|
25
25
|
|
26
26
|
* you can write both Ruby and PHP steps
|
27
27
|
* you __must__ require the PHPUnit library from a file in your features/support/ directory (e.g., features/support/Env.php) for cuke4php to work
|
@@ -32,13 +32,8 @@ Roadmap
|
|
32
32
|
### bin/cuke4php
|
33
33
|
|
34
34
|
* support an option like 'cuke4php --init' which will generate the directory structure and support files necessary to use cuke4php with a php project.
|
35
|
-
* autodetect an available port and then use it to run the cuke4php server pass this on to cucumber by setting an environment variable (requires a modification to cucumber)
|
36
35
|
* lint check all php files in features directory before starting the cuke4php server
|
37
36
|
|
38
|
-
### Gemfile
|
39
|
-
|
40
|
-
* once the patch for erb templating in .wire files in cucumber is released, we should set a minimum version for it
|
41
|
-
|
42
37
|
Dependencies
|
43
38
|
------------
|
44
39
|
* PHPUnit >= 3.0 (see http://www.phpunit.de/)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.4
|
data/bin/cuke4php
CHANGED
@@ -2,21 +2,53 @@
|
|
2
2
|
|
3
3
|
# TODO: support an option like 'cuke4php --init' which will generate the directory structure and support files necessary to use cuke4php with a php project.
|
4
4
|
|
5
|
-
# TODO: autodetect an available port and then use it to run the cuke4php server pass this on to cucumber by setting an environment variable (requires a modification to cucumber)
|
6
|
-
# see https://github.com/olbrich/cucumber/commit/0c11d206e08e8d5647e03bf78be93723d59529ef
|
7
|
-
|
8
5
|
# TODO: lint check all php files before starting the cuke4php server
|
9
6
|
|
10
|
-
#
|
11
|
-
#
|
12
|
-
|
7
|
+
# This script will autodetect the first free port starting at 16816 and pass it to cucumber in the
|
8
|
+
# CUKE4PHP_PORT environment variable. Versions of cucumber > 0.10.2 can use erb in the .wire protocol file
|
9
|
+
# to dynamically pick up this port number at runtime, which allows multiple instances of a cuke4php server
|
10
|
+
# to be run on the same machine without conflicting
|
11
|
+
|
12
|
+
require 'socket'
|
13
|
+
require 'timeout'
|
14
|
+
|
15
|
+
def port_in_use?(_port)
|
16
|
+
begin
|
17
|
+
Timeout::timeout(1) do
|
18
|
+
|
19
|
+
begin
|
20
|
+
s = TCPSocket.new('localhost', _port)
|
21
|
+
s.close
|
22
|
+
return true
|
23
|
+
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
|
24
|
+
return false
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
rescue Timeout::Error
|
30
|
+
end
|
31
|
+
|
32
|
+
return false
|
33
|
+
end
|
34
|
+
|
35
|
+
def autodetect_free_port
|
36
|
+
port = 16816
|
37
|
+
while port_in_use?(port) && port < 65536 do
|
38
|
+
port+=1
|
39
|
+
end
|
40
|
+
raise RuntimeError, "No free port detected" if port == 65536
|
41
|
+
return port
|
42
|
+
end
|
43
|
+
|
44
|
+
cuke4php_port=ENV['CUKE4PHP_PORT'] || autodetect_free_port
|
13
45
|
|
14
46
|
server = fork do
|
15
|
-
exec "#{File.dirname(__FILE__)}/../php_bin/cuke4php_server -p #{
|
47
|
+
exec "#{File.dirname(__FILE__)}/../php_bin/cuke4php_server -p #{cuke4php_port} #{ARGV.last ? ARGV.last : 'features'}"
|
16
48
|
end
|
17
49
|
sleep 1
|
18
50
|
cucumber = fork do
|
19
|
-
exec "CUKE4PHP_PORT=#{
|
51
|
+
exec "export CUKE4PHP_PORT=#{cuke4php_port} && cucumber #{ARGV.join(' ')}"
|
20
52
|
end
|
21
53
|
pid, status = Process.wait2(cucumber,0)
|
22
54
|
Process.kill("TERM",server)
|
data/cuke4php.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{cuke4php}
|
8
|
-
s.version = "0.9.
|
8
|
+
s.version = "0.9.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kevin Olbrich", "Alessandro Dal Grande"]
|
@@ -70,16 +70,16 @@ Gem::Specification.new do |s|
|
|
70
70
|
s.specification_version = 3
|
71
71
|
|
72
72
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
73
|
-
s.add_runtime_dependency(%q<cucumber>, [">= 0"])
|
73
|
+
s.add_runtime_dependency(%q<cucumber>, [">= 0.10.2"])
|
74
74
|
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
75
75
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
76
76
|
else
|
77
|
-
s.add_dependency(%q<cucumber>, [">= 0"])
|
77
|
+
s.add_dependency(%q<cucumber>, [">= 0.10.2"])
|
78
78
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
79
79
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
80
80
|
end
|
81
81
|
else
|
82
|
-
s.add_dependency(%q<cucumber>, [">= 0"])
|
82
|
+
s.add_dependency(%q<cucumber>, [">= 0.10.2"])
|
83
83
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
84
84
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
85
85
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuke4php
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 51
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 4
|
10
|
+
version: 0.9.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kevin Olbrich
|
@@ -25,10 +25,12 @@ dependencies:
|
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
hash:
|
28
|
+
hash: 51
|
29
29
|
segments:
|
30
30
|
- 0
|
31
|
-
|
31
|
+
- 10
|
32
|
+
- 2
|
33
|
+
version: 0.10.2
|
32
34
|
type: :runtime
|
33
35
|
name: cucumber
|
34
36
|
prerelease: false
|