grid 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/grid +18 -12
- data/examples/cucumber/step_definitions/example_steps.rb +1 -1
- data/grid.gemspec +1 -1
- data/lib/grid.rb +18 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/bin/grid
CHANGED
@@ -8,15 +8,16 @@ OptionParser.new do |opts|
|
|
8
8
|
opts.banner = "Usage: grid [options] command"
|
9
9
|
opts.separator ""
|
10
10
|
opts.separator "Commands:"
|
11
|
-
opts.separator " list
|
12
|
-
opts.separator " show
|
13
|
-
opts.separator " create
|
14
|
-
opts.separator " add
|
15
|
-
opts.separator " delete
|
16
|
-
opts.separator " start
|
17
|
-
opts.separator " stop
|
11
|
+
opts.separator " list - List all grids"
|
12
|
+
opts.separator " show - Show specified grids"
|
13
|
+
opts.separator " create - Create a new grid"
|
14
|
+
opts.separator " add - Add intranode to specified grid ID"
|
15
|
+
opts.separator " delete - Delete intranode from specified grid ID"
|
16
|
+
opts.separator " start - Start specified grid ID"
|
17
|
+
opts.separator " stop - Stop specified grid ID"
|
18
18
|
opts.separator " restart - Restart specified grid ID"
|
19
|
-
opts.separator " status
|
19
|
+
opts.separator " status - Update status of specified grid ID"
|
20
|
+
opts.separator " token - Generate new access token"
|
20
21
|
opts.separator ""
|
21
22
|
opts.separator "Options:"
|
22
23
|
opts.on("-g", "--grid ID", String,
|
@@ -28,19 +29,24 @@ OptionParser.new do |opts|
|
|
28
29
|
options[:token] = t || nil
|
29
30
|
end
|
30
31
|
opts.on("-e", "--email EMAIL", String,
|
31
|
-
"Specify the email to authenticate with,
|
32
|
+
"Specify the email to authenticate with,
|
33
|
+
if not using token") do |e|
|
32
34
|
options[:email] = e || nil
|
33
35
|
end
|
34
36
|
opts.on("-p", "--password PASSWORD", String,
|
35
|
-
"Specify the password to authenticate with,
|
37
|
+
"Specify the password to authenticate with,
|
38
|
+
if not using token") do |p|
|
36
39
|
options[:password] = p || nil
|
37
40
|
end
|
38
41
|
opts.on("-u", "--uri URI", String,
|
39
|
-
"Optional URI of the Gridinit API
|
42
|
+
"Optional URI of the Gridinit API:
|
43
|
+
http://gridin.it/api/v0 (default)") do |u|
|
40
44
|
options[:uri] = u || nil
|
41
45
|
end
|
42
46
|
opts.on("-a", "--api API", String,
|
43
|
-
"Specify the
|
47
|
+
"Specify the API to use:
|
48
|
+
watir, firewatir, webdriver (default)
|
49
|
+
webdriver_performance") do |a|
|
44
50
|
options[:api] = b || 'webdriver'
|
45
51
|
end
|
46
52
|
|
@@ -6,7 +6,7 @@ require 'grid'
|
|
6
6
|
|
7
7
|
Given /^(\d+) users open "([^"]*)"$/ do |quantity, browser|
|
8
8
|
params={}
|
9
|
-
params[:controller_uri] = "druby://ec2-
|
9
|
+
params[:controller_uri] = "druby://ec2-184-73-37-176.compute-1.amazonaws.com:11235"
|
10
10
|
params[:browser] = browser # type of webdriver browser to spawn
|
11
11
|
params[:quantity] = quantity.to_i # max number of browsers to use
|
12
12
|
params[:rampup] = 10 # seconds
|
data/grid.gemspec
CHANGED
data/lib/grid.rb
CHANGED
@@ -106,7 +106,12 @@ class Grid
|
|
106
106
|
@log = Logger.new(logfile, 'daily')
|
107
107
|
@log.level = Logger::DEBUG
|
108
108
|
@log.datetime_format = "%Y-%m-%d %H:%M:%S "
|
109
|
-
|
109
|
+
if home
|
110
|
+
if File.file? ENV[home]+'/.gridrc'
|
111
|
+
@token = open(ENV[home]+'/.gridrc') { |f| f.read }.split(':')[1]
|
112
|
+
end
|
113
|
+
end
|
114
|
+
@token = get_token(params) unless @token
|
110
115
|
@log.debug("Current token: #{@token}")
|
111
116
|
end
|
112
117
|
|
@@ -114,7 +119,7 @@ class Grid
|
|
114
119
|
ask(prompt) { |q| q.echo = mask }
|
115
120
|
end
|
116
121
|
|
117
|
-
def get_token(params)
|
122
|
+
def get_token(params={})
|
118
123
|
if params[:token]
|
119
124
|
params[:token]
|
120
125
|
else
|
@@ -128,6 +133,17 @@ class Grid
|
|
128
133
|
end
|
129
134
|
end
|
130
135
|
|
136
|
+
def home
|
137
|
+
homes = ["HOME", "HOMEPATH"]
|
138
|
+
homes.detect {|h| ENV[h] != nil}
|
139
|
+
end
|
140
|
+
|
141
|
+
def token
|
142
|
+
@token = get_token
|
143
|
+
open(ENV[home]+'/.gridrc', 'w') { |f| f << "TOKEN:#{@token}" } if home and @token
|
144
|
+
@log.debug("New token : #{@token}")
|
145
|
+
end
|
146
|
+
|
131
147
|
def list
|
132
148
|
@log.debug("Listing grids ...")
|
133
149
|
begin
|
metadata
CHANGED