forked from olbrich/cuke4php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cuke4php
executable file
·22 lines (18 loc) · 1.06 KB
/
cuke4php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env ruby
# TODO: support an option like 'cuke4php --init' which will generate the directory structure and support files necessary to use cuke4php with a php project.
# 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)
# see https://github.com/olbrich/cucumber/commit/0c11d206e08e8d5647e03bf78be93723d59529ef
# Note that changing the port number currently requires updating the Cuke4Php.wire file in your project's step_definitions
# or cucumber will look for the cuke4php server on the wrong port.
CUKE4PHP_PORT=ENV['CUKE4PHP_PORT'] || 16816
server = fork do
exec "#{File.dirname(__FILE__)}/../php_bin/cuke4php_server -p #{CUKE4PHP_PORT} #{ARGV.last ? ARGV.last : 'features'}"
end
#Process.detach(pid)
sleep 1
cucumber = fork do
exec "CUKE4PHP_PORT=#{CUKE4PHP_PORT} && cucumber #{ARGV.join(' ')}" #"; echo 'quit' | nc localhost #{CUKE4PHP_PORT}"
end
pid, status = Process.wait2(cucumber,0)
Process.kill("TERM",server)
exit status.exitstatus