clucumber 0.3.0 → 0.3.2
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/README.md +3 -3
- data/lib/clucumber.rb +29 -6
- metadata +4 -4
data/README.md
CHANGED
@@ -34,12 +34,12 @@ In your `features/support/env.rb`, you use something like this:
|
|
34
34
|
|
35
35
|
require 'clucumber'
|
36
36
|
begin
|
37
|
-
ClucumberSubprocess.
|
38
|
-
|
37
|
+
ClucumberSubprocess.launch(File.expand_path("../", File.dirname(__FILE__)),
|
38
|
+
:port => 42428).listen <<-LISP
|
39
39
|
;; Put code here that loads your application.
|
40
40
|
LISP
|
41
41
|
rescue PTY::ChildExited
|
42
|
-
puts(@main_clucumber && @main_clucumber.output)
|
42
|
+
STDERR.puts(@main_clucumber && @main_clucumber.output)
|
43
43
|
end
|
44
44
|
|
45
45
|
This will launch a lisp with clucumber loaded (pass :lisp parameter to `ClucumberSubprocess.new` to specify which lisp, it defaults to sbcl), and start listening on port 42428.
|
data/lib/clucumber.rb
CHANGED
@@ -23,6 +23,8 @@ class ClucumberSubprocess
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def run
|
26
|
+
set_port_from_wire_file and return if wire_file_exists?
|
27
|
+
|
26
28
|
Dir.chdir(@dir) do
|
27
29
|
@out, @in, @pid = PTY.spawn(@lisp)
|
28
30
|
end
|
@@ -37,21 +39,29 @@ class ClucumberSubprocess
|
|
37
39
|
(load #p"#{File.expand_path("clucumber/clucumber-bootstrap.lisp", File.dirname(__FILE__))}")
|
38
40
|
LISP
|
39
41
|
end
|
40
|
-
|
41
|
-
def
|
42
|
+
|
43
|
+
def start_clucumber_server(additional_forms)
|
42
44
|
@in.puts <<-LISP
|
43
45
|
#{additional_forms}
|
44
46
|
(asdf:oos 'asdf:load-op :clucumber)
|
45
47
|
(clucumber-external:start #p"./" "localhost" #{@port})
|
46
48
|
LISP
|
49
|
+
end
|
50
|
+
|
51
|
+
def listen(additional_forms="")
|
52
|
+
start_clucumber_server(additional_forms) unless wire_file_exists?
|
53
|
+
|
47
54
|
until socket = TCPSocket.new("localhost", @port) rescue nil
|
48
55
|
raise LaunchFailed, "Couldn't start clucumber:\n#{@output}" unless alive?
|
49
56
|
sleep 0.01
|
50
57
|
end
|
51
|
-
File.open(File.join(@dir, "step_definitions", "clucumber.wire"), "w") do |out|
|
52
|
-
YAML.dump({'host' => "localhost", 'port' => @port}, out)
|
53
|
-
end
|
54
58
|
socket.close
|
59
|
+
|
60
|
+
unless wire_file_exists?
|
61
|
+
File.open(wire_file, "w") do |out|
|
62
|
+
YAML.dump({'host' => "localhost", 'port' => @port}, out)
|
63
|
+
end
|
64
|
+
end
|
55
65
|
end
|
56
66
|
|
57
67
|
def record_output
|
@@ -67,7 +77,7 @@ class ClucumberSubprocess
|
|
67
77
|
|
68
78
|
def kill
|
69
79
|
if @pid
|
70
|
-
FileUtils.rm_f
|
80
|
+
FileUtils.rm_f wire_file
|
71
81
|
@reader.terminate!
|
72
82
|
Process.kill("TERM", @pid)
|
73
83
|
Process.waitpid(@pid)
|
@@ -83,6 +93,7 @@ class ClucumberSubprocess
|
|
83
93
|
end
|
84
94
|
end
|
85
95
|
|
96
|
+
protected
|
86
97
|
def vendor_path
|
87
98
|
File.expand_path("../clucumber/vendor/", __FILE__)
|
88
99
|
end
|
@@ -90,4 +101,16 @@ class ClucumberSubprocess
|
|
90
101
|
def vendor_libs
|
91
102
|
Dir[vendor_path + '/*'].map {|dir| File.basename(dir)}
|
92
103
|
end
|
104
|
+
|
105
|
+
def wire_file
|
106
|
+
File.join(@dir, "step_definitions", "clucumber.wire")
|
107
|
+
end
|
108
|
+
|
109
|
+
def wire_file_exists?
|
110
|
+
File.exist?(wire_file)
|
111
|
+
end
|
112
|
+
|
113
|
+
def set_port_from_wire_file
|
114
|
+
@port = YAML.parse_file(wire_file)['port']
|
115
|
+
end
|
93
116
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andreas Fuchs
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-08-01 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|