selenium-grid 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.2.0 / 2008-10-06
2
+
3
+ * added grid:list and grid:stop
4
+ * capturing std error on kill of hub and remotes
5
+
1
6
  === 0.1.0 / 2008-10-06
2
7
 
3
8
  * bugfix: backgrounding argument position was wrong (needs to be last)
data/Manifest.txt CHANGED
@@ -19,6 +19,7 @@ lib/selenium-grid.rb
19
19
  lib/selenium-grid/hub.rb
20
20
  lib/selenium-grid/remote.rb
21
21
  lib/selenium-grid/version.rb
22
+ lib/tasks/grid.rake
22
23
  lib/tasks/hoe.rake
23
24
  lib/tasks/hub.rake
24
25
  lib/tasks/rc.rake
data/bin/selenium-grid CHANGED
@@ -107,6 +107,13 @@ class RcRunningOptions < SeleniumGridOptions
107
107
  end
108
108
 
109
109
  case ARGV.first
110
+ when 'grid:list':
111
+ hub = Hub.instance.list.collect { |port, component| "#{port}\t#{component}"}
112
+ remotes = Remote.instance.list.collect { |port, browser| "#{port}\tremote\t#{browser}"}.sort
113
+ puts hub.concat(remotes).join("\n")
114
+ when 'grid:stop':
115
+ Hub.instance.stop
116
+ Remote.instance.list.keys.each { |port| Remote.instance.stop(:port => port) }
110
117
  when 'hub:start':
111
118
  options = HubStartOptions.new.parse(ARGV)
112
119
  Hub.instance.start(options)
@@ -115,7 +122,7 @@ case ARGV.first
115
122
  when 'hub:running':
116
123
  puts Hub.instance.running?
117
124
  when 'hub:list':
118
- puts Hub.instance.list
125
+ puts Hub.instance.list.collect { |port, component| "#{port}\t#{component}"}
119
126
  when 'rc:start':
120
127
  options = RcStartOptions.new.parse(ARGV)
121
128
  Remote.instance.start(options)
@@ -131,7 +138,7 @@ case ARGV.first
131
138
  puts "Usage: selenium-grid <command> [options]"
132
139
  puts ""
133
140
  puts "commands"
134
- puts "\t" + %w(hub:start hub:stop hub:list hub:running rc:start rc:stop rc:list rc:running).join("\n\t")
141
+ puts "\t" + %w(grid:list grid:stop hub:start hub:stop hub:list hub:running rc:start rc:stop rc:list rc:running).join("\n\t")
135
142
  puts ""
136
143
 
137
144
  HubStartOptions.new.summarize
data/lib/java/vm.rb CHANGED
@@ -11,7 +11,7 @@ module Java
11
11
  include_log(command, options)
12
12
  include_background(command, options)
13
13
 
14
- sh command.compact.join(' ')
14
+ hide_error_stream { sh command.compact.join(' ') }
15
15
  end
16
16
 
17
17
  private
@@ -56,5 +56,17 @@ module Java
56
56
  command << options[:settings].collect { |key, value| "-D#{key}=#{value}" }.join(' ')
57
57
  end
58
58
  end
59
+
60
+ def hide_error_stream
61
+ old_stderr = $stderr
62
+ begin
63
+ $stderr = StringIO.new
64
+ yield
65
+ rescue Exception => e
66
+ $stderr = old_stderr
67
+ ensure
68
+ $stderr = old_stderr
69
+ end
70
+ end
59
71
  end
60
72
  end
@@ -3,7 +3,7 @@ require 'singleton'
3
3
  module SeleniumGrid
4
4
  class Hub
5
5
  include Singleton
6
-
6
+
7
7
  HUB_PORT=4444
8
8
 
9
9
  def start(overrides = {})
@@ -15,7 +15,7 @@ module SeleniumGrid
15
15
  :log => ENV['LOG'] || overrides[:log] || File.join(".", "log", "hub.log")
16
16
  }
17
17
  options = {
18
- :background => ENV['BACKGROUND'] || false,
18
+ :background => ENV['BACKGROUND'] || false
19
19
  }.merge(overrides).merge(requirements)
20
20
 
21
21
  Java::VM.new.run "com.thoughtworks.selenium.grid.hub.HubServer", options
@@ -26,9 +26,9 @@ module SeleniumGrid
26
26
  end
27
27
 
28
28
  def list
29
- "#{HUB_PORT}\thub" if running?
29
+ running? ? { HUB_PORT.to_s => "hub" } : {}
30
30
  end
31
-
31
+
32
32
  def running?
33
33
  Lsof.running?(HUB_PORT)
34
34
  end
@@ -27,6 +27,7 @@ module SeleniumGrid
27
27
  options = {
28
28
  :port => ENV['PORT'] || DEFAULT_PORT
29
29
  }.merge(overrides)
30
+
30
31
  Lsof.kill(options[:port].to_i)
31
32
  end
32
33
 
@@ -1,7 +1,7 @@
1
1
  module SeleniumGrid #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 1
4
+ MINOR = 2
5
5
  TINY = 0
6
6
  STRING = [MAJOR, MINOR, TINY].join('.')
7
7
  end
@@ -0,0 +1,18 @@
1
+ require 'rake'
2
+
3
+ namespace :grid do
4
+ include SeleniumGrid
5
+
6
+ desc "Stop the entire Grid."
7
+ task(:stop) do
8
+ Hub.instance.stop
9
+ Remote.instance.list.keys.each { |port| Remote.instance.stop(:port => port) }
10
+ end
11
+
12
+ desc "List details about the Grid."
13
+ task(:list) do
14
+ hub = Hub.instance.list.collect { |port, component| "#{port}\t#{component}"}
15
+ remotes = Remote.instance.list.collect { |port, browser| "#{port}\tremote\t#{browser}"}.sort
16
+ puts hub.concat(remotes).join("\n")
17
+ end
18
+ end
data/lib/tasks/hub.rake CHANGED
@@ -15,7 +15,7 @@ namespace :hub do
15
15
 
16
16
  desc "List details about the Hub."
17
17
  task(:list) do
18
- puts Hub.instance.list
18
+ puts Hub.instance.list.collect { |port, component| "#{port}\t#{component}"}
19
19
  end
20
20
 
21
21
  desc "Check whether the Hub is running."
@@ -74,8 +74,8 @@ module SeleniumGrid
74
74
  mock(Lsof).running?(Hub::HUB_PORT) { false }
75
75
  end
76
76
 
77
- it "lists nothing" do
78
- hub.list.should be_nil
77
+ it "lists empty string" do
78
+ hub.list.should be_empty
79
79
  end
80
80
  end
81
81
 
@@ -85,7 +85,7 @@ module SeleniumGrid
85
85
  end
86
86
 
87
87
  it "lists details about the running Hub" do
88
- hub.list.should == "#{Hub::HUB_PORT}\thub"
88
+ hub.list.should == { Hub::HUB_PORT.to_s => "hub" }
89
89
  end
90
90
  end
91
91
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selenium-grid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Dy
@@ -85,6 +85,7 @@ files:
85
85
  - lib/selenium-grid/hub.rb
86
86
  - lib/selenium-grid/remote.rb
87
87
  - lib/selenium-grid/version.rb
88
+ - lib/tasks/grid.rake
88
89
  - lib/tasks/hoe.rake
89
90
  - lib/tasks/hub.rake
90
91
  - lib/tasks/rc.rake