jstd-runner 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/jstd-runner.gemspec +1 -0
- data/lib/jstd-runner.rb +1 -0
- data/lib/jstd-runner/cli.rb +8 -0
- data/lib/jstd-runner/runner.rb +35 -4
- data/lib/jstd-runner/server.rb +5 -4
- data/lib/jstd-runner/version.rb +1 -1
- metadata +106 -107
data/jstd-runner.gemspec
CHANGED
data/lib/jstd-runner.rb
CHANGED
data/lib/jstd-runner/cli.rb
CHANGED
@@ -43,6 +43,14 @@ module JstdRunner
|
|
43
43
|
op.on("-r", "--restart hour:minute") do |hour_minute|
|
44
44
|
runner.options[:restart_at] = hour_minute
|
45
45
|
end
|
46
|
+
|
47
|
+
op.on('-t', '--traffic-log PATH') do |path|
|
48
|
+
runner.options[:traffic_log] = path
|
49
|
+
end
|
50
|
+
|
51
|
+
op.on('-j', '--jar PATH') do |path|
|
52
|
+
runner.options[:jar] = path
|
53
|
+
end
|
46
54
|
}.parse!(args)
|
47
55
|
end
|
48
56
|
|
data/lib/jstd-runner/runner.rb
CHANGED
@@ -7,15 +7,18 @@ module JstdRunner
|
|
7
7
|
:monitor_interval => 10,
|
8
8
|
:browser => :firefox,
|
9
9
|
:daemonize => false,
|
10
|
-
:restart_at => nil
|
10
|
+
:restart_at => nil,
|
11
|
+
:traffic_log => nil,
|
12
|
+
:jar => nil
|
11
13
|
}
|
12
14
|
|
13
15
|
attr_reader :options
|
14
16
|
|
15
17
|
def initialize
|
16
|
-
@options
|
17
|
-
@shutting_down
|
18
|
+
@options = DEFAULT_OPTIONS.dup
|
19
|
+
@shutting_down = @clean_shutdown = false
|
18
20
|
@server_restarting = @browser_restarting = false
|
21
|
+
@server_port = @options[:port]
|
19
22
|
end
|
20
23
|
|
21
24
|
def run
|
@@ -83,6 +86,11 @@ module JstdRunner
|
|
83
86
|
end
|
84
87
|
|
85
88
|
def start_server
|
89
|
+
if options[:traffic_log]
|
90
|
+
@server_port += 1
|
91
|
+
start_proxy
|
92
|
+
end
|
93
|
+
|
86
94
|
server.start
|
87
95
|
server.monitor(options[:monitor_interval]) {
|
88
96
|
server.restart
|
@@ -104,6 +112,29 @@ module JstdRunner
|
|
104
112
|
}
|
105
113
|
end
|
106
114
|
|
115
|
+
def start_proxy
|
116
|
+
path = options[:traffic_log]
|
117
|
+
FileUtils.mkdir_p File.dirname(path)
|
118
|
+
|
119
|
+
Log.info "starting proxy, logging to #{path}"
|
120
|
+
|
121
|
+
log = File.open(path, 'a')
|
122
|
+
server_port = @server_port
|
123
|
+
|
124
|
+
EventMachine::start_server("0.0.0.0", options[:port], EventMachine::ProxyServer::Connection, {}) do |conn|
|
125
|
+
conn.server :srv, {:host => "127.0.0.1", :port => server_port}
|
126
|
+
|
127
|
+
# modify / process request stream
|
128
|
+
conn.on_data do |data|
|
129
|
+
binding.pry
|
130
|
+
log.puts [Time.now, conn.peer].inspect
|
131
|
+
log.write data
|
132
|
+
|
133
|
+
data
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
107
138
|
def capture_browser
|
108
139
|
Log.info "capturing #{browser.inspect}"
|
109
140
|
browser.capture(server.host, server.port)
|
@@ -145,7 +176,7 @@ module JstdRunner
|
|
145
176
|
end
|
146
177
|
|
147
178
|
def server
|
148
|
-
@server ||= Server.new(options[:
|
179
|
+
@server ||= Server.new(@server_port, options[:jar])
|
149
180
|
end
|
150
181
|
|
151
182
|
def browser
|
data/lib/jstd-runner/server.rb
CHANGED
@@ -13,14 +13,15 @@ module JstdRunner
|
|
13
13
|
|
14
14
|
attr_reader :host, :port
|
15
15
|
|
16
|
-
def initialize(port)
|
16
|
+
def initialize(port, jar = nil)
|
17
17
|
@host = "127.0.0.1"
|
18
18
|
@port = Integer(port)
|
19
19
|
@restarting = false
|
20
|
+
@jar = jar || JAR
|
20
21
|
end
|
21
22
|
|
22
23
|
def start
|
23
|
-
Log.info "starting JsTestDriver"
|
24
|
+
Log.info "starting JsTestDriver from #{@jar}"
|
24
25
|
|
25
26
|
if immediate_poller.connected?
|
26
27
|
raise StartupError, "JsTestDriver already running on #{@host}:#{@port}"
|
@@ -36,7 +37,7 @@ module JstdRunner
|
|
36
37
|
|
37
38
|
def restart
|
38
39
|
@restarting = true
|
39
|
-
Log.info "
|
40
|
+
Log.info "restarting server"
|
40
41
|
stop rescue nil
|
41
42
|
@process = nil
|
42
43
|
start
|
@@ -60,7 +61,7 @@ module JstdRunner
|
|
60
61
|
|
61
62
|
def process
|
62
63
|
@process ||= (
|
63
|
-
proc = ChildProcess.new("java", "-jar",
|
64
|
+
proc = ChildProcess.new("java", "-jar", @jar, "--port", @port.to_s)
|
64
65
|
proc.io.inherit! if $DEBUG
|
65
66
|
|
66
67
|
proc
|
data/lib/jstd-runner/version.rb
CHANGED
metadata
CHANGED
@@ -1,127 +1,136 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: jstd-runner
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 6
|
10
|
-
version: 0.0.6
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Jari Bakken
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-11-07 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: selenium-webdriver
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 19
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
- 1
|
32
|
-
- 4
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
33
21
|
version: 0.1.4
|
34
22
|
type: :runtime
|
35
|
-
|
36
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.1.4
|
30
|
+
- !ruby/object:Gem::Dependency
|
37
31
|
name: eventmachine
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - '='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.12.10
|
38
|
+
type: :runtime
|
38
39
|
prerelease: false
|
39
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
41
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 59
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
- 12
|
48
|
-
- 10
|
42
|
+
requirements:
|
43
|
+
- - '='
|
44
|
+
- !ruby/object:Gem::Version
|
49
45
|
version: 0.12.10
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: em-proxy
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
50
54
|
type: :runtime
|
51
|
-
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: mail
|
54
55
|
prerelease: false
|
55
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: mail
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
56
65
|
none: false
|
57
|
-
requirements:
|
66
|
+
requirements:
|
58
67
|
- - ~>
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
segments:
|
62
|
-
- 2
|
63
|
-
- 4
|
64
|
-
version: "2.4"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '2.4'
|
65
70
|
type: :runtime
|
66
|
-
version_requirements: *id003
|
67
|
-
- !ruby/object:Gem::Dependency
|
68
|
-
name: daemons
|
69
71
|
prerelease: false
|
70
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '2.4'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: daemons
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
71
81
|
none: false
|
72
|
-
requirements:
|
73
|
-
- -
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
hash: 19
|
76
|
-
segments:
|
77
|
-
- 1
|
78
|
-
- 1
|
79
|
-
- 0
|
82
|
+
requirements:
|
83
|
+
- - '='
|
84
|
+
- !ruby/object:Gem::Version
|
80
85
|
version: 1.1.0
|
81
86
|
type: :runtime
|
82
|
-
version_requirements: *id004
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rspec
|
85
87
|
prerelease: false
|
86
|
-
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
87
89
|
none: false
|
88
|
-
requirements:
|
90
|
+
requirements:
|
91
|
+
- - '='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.1.0
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rspec
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
89
99
|
- - ~>
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
hash: 19
|
92
|
-
segments:
|
93
|
-
- 2
|
94
|
-
- 7
|
95
|
-
- 0
|
100
|
+
- !ruby/object:Gem::Version
|
96
101
|
version: 2.7.0
|
97
102
|
type: :development
|
98
|
-
version_requirements: *id005
|
99
|
-
- !ruby/object:Gem::Dependency
|
100
|
-
name: rake
|
101
103
|
prerelease: false
|
102
|
-
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.7.0
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rake
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
103
113
|
none: false
|
104
|
-
requirements:
|
114
|
+
requirements:
|
105
115
|
- - ~>
|
106
|
-
- !ruby/object:Gem::Version
|
107
|
-
hash: 63
|
108
|
-
segments:
|
109
|
-
- 0
|
110
|
-
- 9
|
111
|
-
- 2
|
116
|
+
- !ruby/object:Gem::Version
|
112
117
|
version: 0.9.2
|
113
118
|
type: :development
|
114
|
-
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.9.2
|
115
126
|
description: Runs a JsTestDriver server + browsers with some built-in monitoring
|
116
|
-
email:
|
127
|
+
email:
|
117
128
|
- jari.bakken@gmail.com
|
118
|
-
executables:
|
129
|
+
executables:
|
119
130
|
- jstd-runner
|
120
131
|
extensions: []
|
121
|
-
|
122
132
|
extra_rdoc_files: []
|
123
|
-
|
124
|
-
files:
|
133
|
+
files:
|
125
134
|
- .gitignore
|
126
135
|
- Gemfile
|
127
136
|
- LICENSE
|
@@ -148,37 +157,27 @@ files:
|
|
148
157
|
- spec/spec_helper.rb
|
149
158
|
homepage: http://github.com/jarib/jstd-runner
|
150
159
|
licenses: []
|
151
|
-
|
152
160
|
post_install_message:
|
153
161
|
rdoc_options: []
|
154
|
-
|
155
|
-
require_paths:
|
162
|
+
require_paths:
|
156
163
|
- lib
|
157
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
164
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
158
165
|
none: false
|
159
|
-
requirements:
|
160
|
-
- -
|
161
|
-
- !ruby/object:Gem::Version
|
162
|
-
|
163
|
-
|
164
|
-
- 0
|
165
|
-
version: "0"
|
166
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ! '>='
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
171
|
none: false
|
168
|
-
requirements:
|
169
|
-
- -
|
170
|
-
- !ruby/object:Gem::Version
|
171
|
-
|
172
|
-
segments:
|
173
|
-
- 0
|
174
|
-
version: "0"
|
172
|
+
requirements:
|
173
|
+
- - ! '>='
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
175
176
|
requirements: []
|
176
|
-
|
177
177
|
rubyforge_project:
|
178
|
-
rubygems_version: 1.8.
|
178
|
+
rubygems_version: 1.8.24
|
179
179
|
signing_key:
|
180
180
|
specification_version: 3
|
181
181
|
summary: JsTestDriver wrapper
|
182
182
|
test_files: []
|
183
|
-
|
184
183
|
has_rdoc:
|