pivotal-selenium-grid 0.0.4 → 0.2.0

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/History.txt CHANGED
@@ -1,3 +1,13 @@
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
+
6
+ === 0.1.0 / 2008-10-06
7
+
8
+ * bugfix: backgrounding argument position was wrong (needs to be last)
9
+ * bugfix: config/requirement needed to be required
10
+
1
11
  === 0.0.4 / 2008-10-06
2
12
 
3
13
  * added hub:list
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/extensions.rb CHANGED
@@ -1 +1,2 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'config', 'requirements')
1
2
  require_path '/lib/extensions/**/*.rb'
data/lib/java/vm.rb CHANGED
@@ -8,10 +8,10 @@ module Java
8
8
  command << classname
9
9
  include_settings(command, options)
10
10
  include_arguments(command, options)
11
- include_background(command, options)
12
11
  include_log(command, options)
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
data/lib/java.rb CHANGED
@@ -1 +1,2 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'config', 'requirements')
1
2
  require_path '/lib/java/**/*.rb'
@@ -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
@@ -20,7 +20,6 @@ module SeleniumGrid
20
20
  :arguments => args,
21
21
  :background => overrides[:background] || ENV['BACKGROUND'] || false,
22
22
  }
23
-
24
23
  Java::VM.new.run "com.thoughtworks.selenium.grid.remotecontrol.SelfRegisteringRemoteControlLauncher", options
25
24
  end
26
25
 
@@ -28,6 +27,7 @@ module SeleniumGrid
28
27
  options = {
29
28
  :port => ENV['PORT'] || DEFAULT_PORT
30
29
  }.merge(overrides)
30
+
31
31
  Lsof.kill(options[:port].to_i)
32
32
  end
33
33
 
@@ -1,8 +1,8 @@
1
1
  module SeleniumGrid #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 0
5
- TINY = 4
4
+ MINOR = 2
5
+ TINY = 0
6
6
  STRING = [MAJOR, MINOR, TINY].join('.')
7
7
  end
8
8
  end
data/lib/selenium-grid.rb CHANGED
@@ -1 +1,2 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'config', 'requirements')
1
2
  require_path '/lib/selenium-grid/**/*.rb'
@@ -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."
data/spec/java/vm_spec.rb CHANGED
@@ -38,6 +38,11 @@ module Java
38
38
  mock(vm).sh('java test.ClassName &')
39
39
  vm.run "test.ClassName", { :background => true }
40
40
  end
41
+
42
+ it "is the last option" do
43
+ mock(vm).sh("java test.ClassName > '/var/log/test.log' 2>&1 &")
44
+ vm.run "test.ClassName", {:background => true, :log => '/var/log/test.log'}
45
+ end
41
46
  end
42
47
 
43
48
  context "when the options include :classpath" do
@@ -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: pivotal-selenium-grid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Dy
@@ -81,6 +81,7 @@ files:
81
81
  - lib/selenium-grid/hub.rb
82
82
  - lib/selenium-grid/remote.rb
83
83
  - lib/selenium-grid/version.rb
84
+ - lib/tasks/grid.rake
84
85
  - lib/tasks/hoe.rake
85
86
  - lib/tasks/hub.rake
86
87
  - lib/tasks/rc.rake