gondola 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,6 +2,7 @@ source "http://rubygems.org"
2
2
 
3
3
  gem "sauce", ">= 0.19.0"
4
4
  gem "parallel", "~> 0.5.2"
5
+ gem "rainbow"
5
6
 
6
7
  group :development do
7
8
  gem "shoulda", ">= 0"
data/Gemfile.lock CHANGED
@@ -20,6 +20,7 @@ GEM
20
20
  net-ssh-gateway (1.0.1)
21
21
  net-ssh (>= 1.99.1)
22
22
  parallel (0.5.3)
23
+ rainbow (1.1.1)
23
24
  rake (0.8.7)
24
25
  rest-client (1.6.1)
25
26
  mime-types (>= 1.16)
@@ -49,6 +50,7 @@ DEPENDENCIES
49
50
  fakeweb (~> 1.3.0)
50
51
  jeweler (~> 1.5.2)
51
52
  parallel (~> 0.5.2)
53
+ rainbow
52
54
  sauce (>= 0.19.0)
53
55
  shoulda
54
56
  vcr (>= 1.7.1)
data/bin/gondola CHANGED
@@ -88,7 +88,25 @@ class ProjectCommand < CmdParse::Command
88
88
  exit 1
89
89
  end
90
90
 
91
- args.each { |p| Dir.mkdir p }
91
+ args.each do |dir|
92
+ begin
93
+ Dir.mkdir dir
94
+ rescue Errno::EEXIST
95
+ puts "This project already exists"
96
+ exit 1
97
+ end
98
+ puts "Creating new project #{dir.inspect}"
99
+ print "Base Url: "
100
+ base_url = $stdin.gets.chomp
101
+ File.open(File.join(dir, "config.yml"), "w") do |f|
102
+ yaml = Gondola::DEFAULT_CONFIG.merge({
103
+ :project_name => dir,
104
+ :base_url => base_url
105
+ })
106
+ YAML.dump(yaml, f)
107
+ end
108
+ puts "Project created"
109
+ end
92
110
  end
93
111
  end
94
112
 
data/gondola.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gondola}
8
- s.version = "1.3.0"
8
+ s.version = "1.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matthew Perry"]
12
- s.date = %q{2011-05-02}
12
+ s.date = %q{2011-06-09}
13
13
  s.description = %q{
14
14
  Gondola is Ruby command line utility and as well as a library which helps
15
15
  for integrate the Selenium IDE more tightly with Sauce Labs' Ondemand services and
@@ -77,6 +77,7 @@ Gem::Specification.new do |s|
77
77
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
78
78
  s.add_runtime_dependency(%q<sauce>, [">= 0.19.0"])
79
79
  s.add_runtime_dependency(%q<parallel>, ["~> 0.5.2"])
80
+ s.add_runtime_dependency(%q<rainbow>, [">= 0"])
80
81
  s.add_development_dependency(%q<shoulda>, [">= 0"])
81
82
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
82
83
  s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
@@ -85,6 +86,7 @@ Gem::Specification.new do |s|
85
86
  else
86
87
  s.add_dependency(%q<sauce>, [">= 0.19.0"])
87
88
  s.add_dependency(%q<parallel>, ["~> 0.5.2"])
89
+ s.add_dependency(%q<rainbow>, [">= 0"])
88
90
  s.add_dependency(%q<shoulda>, [">= 0"])
89
91
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
90
92
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
@@ -94,6 +96,7 @@ Gem::Specification.new do |s|
94
96
  else
95
97
  s.add_dependency(%q<sauce>, [">= 0.19.0"])
96
98
  s.add_dependency(%q<parallel>, ["~> 0.5.2"])
99
+ s.add_dependency(%q<rainbow>, [">= 0"])
97
100
  s.add_dependency(%q<shoulda>, [">= 0"])
98
101
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
99
102
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
@@ -1,23 +1,26 @@
1
1
  # Gondola - console.rb
2
2
  # Definitions of functions for printing
3
3
  # results to the console in a readable format
4
+ require 'rainbow'
4
5
 
5
6
  class Gondola
6
7
  module Results
7
8
  class Console
8
9
  def self.change(result)
9
10
  browser_string = result[:browser].values.join(" ")
10
- print "#{result[:id]}: \"#{result[:name]}\" "
11
+ print "#{result[:id]}: \"#{result[:name]}\" ".foreground(:magenta)
11
12
 
12
13
  case result[:status]
13
14
  when :in_progress
14
- puts "started with #{browser_string}"
15
+ puts "started with #{browser_string}".foreground(:cyan)
15
16
  when :not_started
16
- puts "failed to start on #{browser_string}"
17
- when :passed, :failed
18
- puts "has completed with #{result[:errors].size} error(s) on #{browser_string}"
17
+ puts "failed to start on #{browser_string}".foreground(:red)
18
+ when :passed
19
+ puts "has completed with 0 errors on #{browser_string}".foreground(:green)
20
+ when :failed
21
+ puts "has completed with #{result[:errors].size} error(s) on #{browser_string}".foreground(:red)
19
22
  else
20
- puts "Unknown status code"
23
+ puts "Unknown status code".foreground(:blue)
21
24
  end
22
25
  end
23
26
 
@@ -25,19 +28,23 @@ class Gondola
25
28
  puts
26
29
  results.each do |result|
27
30
  puts "Sauce Labs ID : #{result[:id]}"
28
- puts "Test Name : #{result[:name]}"
31
+ puts "Test Name : #{result[:name]}".foreground(:magenta)
29
32
  puts "Browser : #{result[:browser].values.join(" ")}"
30
- puts "Status : Test #{result[:status].to_s.capitalize} - #{result[:errors].size} error(s)"
31
- if result[:status] == :failed
33
+ if result[:status] == :passed
34
+ puts "Status : Test #{result[:status].to_s.capitalize}".foreground(:green)
35
+
36
+ elsif result[:status] == :failed
37
+ puts "Status : Test #{result[:status].to_s.capitalize} - #{result[:errors].size} error(s)".foreground(:red)
38
+
32
39
  result[:errors].each_with_index do |error,i|
33
- puts "- Error #{i+1}, Command number #{error[:cmd_num]}:"
40
+ puts "- Error #{i+1}, Command number #{error[:cmd_num]}:".foreground(:red)
34
41
 
35
42
  max_key = -1 * (error[:command].keys.map { |k| k.to_s.size }.max + 8)
36
43
  error[:command].each_pair do |k,v|
37
44
  puts " %1$*2$s : #{v}" % [ "#{k.to_s.capitalize} command", max_key ]
38
45
  end
39
46
 
40
- puts " #{error[:error]}"
47
+ puts " #{error[:error]}".foreground(:red)
41
48
  end
42
49
  else
43
50
  puts
@@ -27,7 +27,17 @@ class Gondola
27
27
  @status = :in_progress
28
28
  rescue ::Selenium::Client::CommandError => e
29
29
  @status = :not_started
30
- add_error e.message, e.backtrace
30
+ @errors << {
31
+ :cmd_num => 0,
32
+ :command => "#{SELENIUM_OBJECT}.start",
33
+ :error => e.message
34
+ }
35
+ rescue Timeout::Error => e
36
+ @errors << {
37
+ :cmd_num => 0,
38
+ :command => "#{SELENIUM_OBJECT}.start",
39
+ :error => "ERROR: Command timed out"
40
+ }
31
41
  end
32
42
  @job_id
33
43
  end
@@ -38,7 +48,9 @@ class Gondola
38
48
  eval @converter.ruby
39
49
  rescue AssertionError
40
50
  rescue ::Selenium::Client::CommandError => e
41
- add_error e.message, e.backtrace
51
+ add_error_with_trace e.message, e.backtrace
52
+ rescue Timeout::Error => e
53
+ add_error_with_trace "ERROR: Command timed out", e.backtrace
42
54
  ensure
43
55
  finish
44
56
  end
@@ -58,7 +70,18 @@ class Gondola
58
70
  @sel.failed!
59
71
  end
60
72
  @sel.stop
61
- rescue ::Selenium::Client::CommandError
73
+ rescue ::Selenium::Client::CommandError => e
74
+ @errors << {
75
+ :cmd_num => 0,
76
+ :command => "",
77
+ :error => e.message
78
+ }
79
+ rescue Timeout::Error => e
80
+ @errors << {
81
+ :cmd_num => 0,
82
+ :command => "",
83
+ :error => "ERROR: Command timed out"
84
+ }
62
85
  end
63
86
  end
64
87
 
@@ -70,13 +93,13 @@ class Gondola
70
93
 
71
94
  # Add the current command to the error list
72
95
  # with the given description
73
- def add_error(desc, trace=caller)
96
+ def add_error_with_trace(desc, trace=caller)
74
97
  cmd_num = get_cmd_num(trace)
75
- @errors.push({
98
+ @errors.push << {
76
99
  :cmd_num => cmd_num,
77
- :command => cmd_num ? @converter.commands[cmd_num-1] : "#{SELENIUM_OBJECT}.start",
100
+ :command => @converter.commands[cmd_num-1],
78
101
  :error => desc
79
- })
102
+ }
80
103
  end
81
104
 
82
105
  # Handle all the assert functions by just making the respective
@@ -88,22 +111,22 @@ class Gondola
88
111
  end
89
112
 
90
113
  def verify(expr)
91
- add_error "ERROR: Command returned false, expecting true" unless expr
114
+ add_error_with_trace "ERROR: Command returned false, expecting true" unless expr
92
115
  return expr
93
116
  end
94
117
 
95
118
  def verify_not(expr)
96
- add_error "ERROR: Command returned true, expecting false" if expr
119
+ add_error_with_trace "ERROR: Command returned true, expecting false" if expr
97
120
  return !expr
98
121
  end
99
122
 
100
123
  def verify_equal(eq, expr)
101
- add_error "ERROR: Command returned '#{expr}', expecting '#{eq}'" unless eq == expr
124
+ add_error_with_trace "ERROR: Command returned '#{expr}', expecting '#{eq}'" unless eq == expr
102
125
  return eq == expr
103
126
  end
104
127
 
105
128
  def verify_not_equal(eq, expr)
106
- add_error "ERROR: Command returned '#{expr}', expecting anything but" unless eq != expr
129
+ add_error_with_trace "ERROR: Command returned '#{expr}', expecting anything but" unless eq != expr
107
130
  return eq != expr
108
131
  end
109
132
  end
@@ -1,3 +1,3 @@
1
1
  class Gondola
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
data/lib/gondola.rb CHANGED
@@ -14,6 +14,16 @@ require 'sauce'
14
14
  require 'parallel'
15
15
 
16
16
  class Gondola
17
+
18
+ DEFAULT_CONFIG = {
19
+ :project_name => "New Project",
20
+ :base_url => "http://www.google.com/",
21
+ :browsers => [
22
+ {:os => "Windows 2003", :browser => "firefox", :browser_version => "3.6"},
23
+ {:os => "Windows 2003", :browser => "iexplore", :browser_version => "8" },
24
+ ]
25
+ }
26
+
17
27
  attr_reader :runner
18
28
 
19
29
  def initialize
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gondola
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.3.0
5
+ version: 1.3.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Matthew Perry
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-02 00:00:00 Z
13
+ date: 2011-06-09 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sauce
@@ -35,19 +35,30 @@ dependencies:
35
35
  prerelease: false
36
36
  version_requirements: *id002
37
37
  - !ruby/object:Gem::Dependency
38
- name: shoulda
38
+ name: rainbow
39
39
  requirement: &id003 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
44
  version: "0"
45
- type: :development
45
+ type: :runtime
46
46
  prerelease: false
47
47
  version_requirements: *id003
48
48
  - !ruby/object:Gem::Dependency
49
- name: bundler
49
+ name: shoulda
50
50
  requirement: &id004 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: *id004
59
+ - !ruby/object:Gem::Dependency
60
+ name: bundler
61
+ requirement: &id005 !ruby/object:Gem::Requirement
51
62
  none: false
52
63
  requirements:
53
64
  - - ~>
@@ -55,10 +66,10 @@ dependencies:
55
66
  version: 1.0.0
56
67
  type: :development
57
68
  prerelease: false
58
- version_requirements: *id004
69
+ version_requirements: *id005
59
70
  - !ruby/object:Gem::Dependency
60
71
  name: jeweler
61
- requirement: &id005 !ruby/object:Gem::Requirement
72
+ requirement: &id006 !ruby/object:Gem::Requirement
62
73
  none: false
63
74
  requirements:
64
75
  - - ~>
@@ -66,10 +77,10 @@ dependencies:
66
77
  version: 1.5.2
67
78
  type: :development
68
79
  prerelease: false
69
- version_requirements: *id005
80
+ version_requirements: *id006
70
81
  - !ruby/object:Gem::Dependency
71
82
  name: vcr
72
- requirement: &id006 !ruby/object:Gem::Requirement
83
+ requirement: &id007 !ruby/object:Gem::Requirement
73
84
  none: false
74
85
  requirements:
75
86
  - - ">="
@@ -77,10 +88,10 @@ dependencies:
77
88
  version: 1.7.1
78
89
  type: :development
79
90
  prerelease: false
80
- version_requirements: *id006
91
+ version_requirements: *id007
81
92
  - !ruby/object:Gem::Dependency
82
93
  name: fakeweb
83
- requirement: &id007 !ruby/object:Gem::Requirement
94
+ requirement: &id008 !ruby/object:Gem::Requirement
84
95
  none: false
85
96
  requirements:
86
97
  - - ~>
@@ -88,7 +99,7 @@ dependencies:
88
99
  version: 1.3.0
89
100
  type: :development
90
101
  prerelease: false
91
- version_requirements: *id007
102
+ version_requirements: *id008
92
103
  description: "\n Gondola is Ruby command line utility and as well as a library which helps\n for integrate the Selenium IDE more tightly with Sauce Labs' Ondemand services and\n provide greater ease for those who would like to use both tools but do not have\n enough technical knowledge\n "
93
104
  email: mperry@agoragames.com
94
105
  executables:
@@ -144,7 +155,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
155
  requirements:
145
156
  - - ">="
146
157
  - !ruby/object:Gem::Version
147
- hash: 1061792883
158
+ hash: 549041487
148
159
  segments:
149
160
  - 0
150
161
  version: "0"