grid_tools 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +6 -0
- data/bin/grid_tools +119 -0
- data/binaries/linux_64/chromedriver +0 -0
- data/binaries/mac/chromedriver +0 -0
- data/binaries/selenium-server-standalone-2.26.0.jar +0 -0
- data/binaries/windows/IEDriverServer.exe +0 -0
- data/binaries/windows/chromedriver.exe +0 -0
- data/grid_tools.rdoc +5 -0
- data/lib/grid_tools/version.rb +3 -0
- data/lib/grid_tools.rb +21 -0
- metadata +133 -0
data/README.rdoc
ADDED
data/bin/grid_tools
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'gli'
|
3
|
+
require 'grid_tools'
|
4
|
+
|
5
|
+
include GLI::App
|
6
|
+
|
7
|
+
program_desc 'Describe your application here'
|
8
|
+
|
9
|
+
version GridTools::VERSION
|
10
|
+
|
11
|
+
#desc 'Describe some switch here'
|
12
|
+
#switch [:s,:switch]
|
13
|
+
|
14
|
+
#desc 'Describe some flag here'
|
15
|
+
#default_value 'the default'
|
16
|
+
#arg_name 'The name of the argument'
|
17
|
+
#flag [:f,:flagname]
|
18
|
+
|
19
|
+
desc 'Start a Hub or Node'
|
20
|
+
arg_name 'Describe arguments to start here'
|
21
|
+
command :start do |c|
|
22
|
+
#c.desc ''
|
23
|
+
#c.switch [:h,:hub]
|
24
|
+
|
25
|
+
c.desc 'Hub Hostname'
|
26
|
+
c.default_value 'localhost'
|
27
|
+
c.flag [:h, :hostname]
|
28
|
+
|
29
|
+
c.action do |global_options,options,args|
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
if args.count != 1
|
34
|
+
raise "No idea what to start bro."
|
35
|
+
end
|
36
|
+
|
37
|
+
if args[0] == "hub"
|
38
|
+
if `ps -e -o pid,args | awk '/selenium-server/ { print $1 }'`.split(/\n/).count < 3
|
39
|
+
binaries = File.expand_path(File.dirname(File.expand_path(__FILE__)) + '/../binaries')
|
40
|
+
cmd = "java -jar #{binaries}/selenium-server-standalone* -browserTimeout 300 -role hub >> ~/hub.log 2>&1 &"
|
41
|
+
system cmd
|
42
|
+
pid = `ps -e -o pid,args | awk '/selenium-server/ { print $1 }'`.split(/\n/)[0]
|
43
|
+
puts "Started a hub. [pid: #{pid}]"
|
44
|
+
else
|
45
|
+
raise "Hub or node already started,"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
if args[0] == "node"
|
50
|
+
if `ps -e -o pid,args | awk '/selenium-server/ { print $1 }'`.split(/\n/).count < 3
|
51
|
+
binaries = File.expand_path(File.dirname(File.expand_path(__FILE__)) + '/../binaries')
|
52
|
+
cmd = "java -jar #{binaries}/selenium-server-standalone* -role wd -hub http://#{options[:h]}:4444/grid/register -trustAllSSLCertificates >> ~/node.log 2>&1 &"
|
53
|
+
system cmd
|
54
|
+
pid = `ps -e -o pid,args | awk '/selenium-server/ { print $1 }'`.split(/\n/)[0]
|
55
|
+
puts "Started a node. [pid: #{pid}]"
|
56
|
+
else
|
57
|
+
raise "Hub or node already started."
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
desc 'Describe stop here'
|
66
|
+
arg_name 'Describe arguments to stop here'
|
67
|
+
command :stop do |c|
|
68
|
+
c.action do |global_options,options,args|
|
69
|
+
|
70
|
+
if args.count != 1
|
71
|
+
raise "No idea what to stop."
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
if args[0] == "hub"
|
76
|
+
pid_array = `ps -e -o pid,args | awk '/selenium-server/ { print $1 }'`.split(/\n/)
|
77
|
+
if pid_array.count > 2
|
78
|
+
`kill #{pid_array[0]}`
|
79
|
+
puts "Killed Process #{pid_array[0]}"
|
80
|
+
else
|
81
|
+
raise "Idk what to kill..."
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
if args[0] == "node"
|
86
|
+
pid_array = `ps -e -o pid,args | awk '/selenium-server/ { print $1 }'`.split(/\n/)
|
87
|
+
if pid_array.count > 2
|
88
|
+
`kill #{pid_array[0]}`
|
89
|
+
puts "Killed Process #{pid_array[0]}"
|
90
|
+
else
|
91
|
+
raise "Idk what to kill..."
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
pre do |global,command,options,args|
|
99
|
+
# Pre logic here
|
100
|
+
# Return true to proceed; false to abourt and not call the
|
101
|
+
# chosen command
|
102
|
+
# Use skips_pre before a command to skip this block
|
103
|
+
# on that command only
|
104
|
+
true
|
105
|
+
end
|
106
|
+
|
107
|
+
post do |global,command,options,args|
|
108
|
+
# Post logic here
|
109
|
+
# Use skips_post before a command to skip this
|
110
|
+
# block on that command only
|
111
|
+
end
|
112
|
+
|
113
|
+
on_error do |exception|
|
114
|
+
# Error logic here
|
115
|
+
# return false to skip default error handling
|
116
|
+
true
|
117
|
+
end
|
118
|
+
|
119
|
+
exit run(ARGV)
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/grid_tools.rdoc
ADDED
data/lib/grid_tools.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'grid_tools/version.rb'
|
2
|
+
|
3
|
+
# Add requires for other files you add to your project here, so
|
4
|
+
# you just need to require this one file in your bin file
|
5
|
+
|
6
|
+
module GridTools
|
7
|
+
|
8
|
+
def self.windows?
|
9
|
+
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
|
10
|
+
end
|
11
|
+
def self.mac?
|
12
|
+
(/darwin/ =~ RUBY_PLATFORM) != nil
|
13
|
+
end
|
14
|
+
def self.unix?
|
15
|
+
!OS.windows?
|
16
|
+
end
|
17
|
+
def self.linux?
|
18
|
+
OS.unix? and not OS.mac?
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: grid_tools
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Alan Scherger
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rdoc
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: aruba
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
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: gli
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - '='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 2.5.0
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - '='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.5.0
|
78
|
+
description:
|
79
|
+
email: flyinprogramer@gmail.com
|
80
|
+
executables:
|
81
|
+
- grid_tools
|
82
|
+
extensions: []
|
83
|
+
extra_rdoc_files:
|
84
|
+
- README.rdoc
|
85
|
+
- grid_tools.rdoc
|
86
|
+
files:
|
87
|
+
- bin/grid_tools
|
88
|
+
- binaries/selenium-server-standalone-2.26.0.jar
|
89
|
+
- binaries/linux_64/chromedriver
|
90
|
+
- binaries/mac/chromedriver
|
91
|
+
- binaries/windows/IEDriverServer.exe
|
92
|
+
- binaries/windows/chromedriver.exe
|
93
|
+
- lib/grid_tools/version.rb
|
94
|
+
- lib/grid_tools.rb
|
95
|
+
- README.rdoc
|
96
|
+
- grid_tools.rdoc
|
97
|
+
homepage: http://www.google.com
|
98
|
+
licenses: []
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options:
|
101
|
+
- --title
|
102
|
+
- grid_tools
|
103
|
+
- --main
|
104
|
+
- README.rdoc
|
105
|
+
- -ri
|
106
|
+
require_paths:
|
107
|
+
- lib
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ! '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
segments:
|
116
|
+
- 0
|
117
|
+
hash: -2143661617772648491
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
120
|
+
requirements:
|
121
|
+
- - ! '>='
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
segments:
|
125
|
+
- 0
|
126
|
+
hash: -2143661617772648491
|
127
|
+
requirements: []
|
128
|
+
rubyforge_project:
|
129
|
+
rubygems_version: 1.8.24
|
130
|
+
signing_key:
|
131
|
+
specification_version: 3
|
132
|
+
summary: grid_tools is a simple way create and manage a selenium grid.
|
133
|
+
test_files: []
|