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 CHANGED
@@ -1 +1 @@
1
- 0.4.0
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 - 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"
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 - Update status of specified grid ID"
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, if not using token") do |e|
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, if not using token") do |p|
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, default http://gridin.it/api/v0") do |u|
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 Watir API to use, default webdriver [watir, firewatir, webdriver_performance]}") do |a|
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-50-16-63-81.compute-1.amazonaws.com:11235"
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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{grid}
8
- s.version = "0.4.0"
8
+ s.version = "0.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tim Koopmans"]
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
- @token = get_token(params)
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
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grid
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 0
10
- version: 0.4.0
9
+ - 1
10
+ version: 0.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tim Koopmans