brake 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +10 -1
- data/lib/brake.rb +33 -8
- metadata +2 -2
data/README
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
README
|
2
2
|
A Brandwatch rake wrapper, Brake
|
3
3
|
|
4
|
+
Simply this is a wrapper disigned to give the end user some control by being able to pass command line options
|
5
|
+
but still having the conviniance of rake tasks
|
6
|
+
Primarly used to aid in the brandwatch automation tasting hence brake for brandwatch rake
|
7
|
+
The tool has now evolved and if used cleverly could be used by anyome
|
8
|
+
|
4
9
|
Brake Version:0.2.0
|
5
10
|
|
6
11
|
Brake, The Brandwatch Rake wrapper for cucumber, Give Rake a Brake.
|
@@ -23,7 +28,7 @@ Browser options:
|
|
23
28
|
-H, --[no-]highlight Bool: To turn off the highlight of elements
|
24
29
|
|
25
30
|
-u, --[no-]untangle Bool: Turns Debug on/off
|
26
|
-
-h, --help You'
|
31
|
+
-h, --help You're looking at it
|
27
32
|
For furthur assistance please contact Ben Slaughter or Jonathan Chrisp
|
28
33
|
bens@brandwatch.com or jonathan@brandwatch.com
|
29
34
|
|
@@ -54,4 +59,8 @@ Jon - Updated API task to run release as default
|
|
54
59
|
Ben - Removed '--require features' from the default args so now only -P disable profiles and -s disable source code line numbers
|
55
60
|
Ben - Removed platform, this is no longer required
|
56
61
|
|
62
|
+
2.2.4
|
63
|
+
Ben - Some typos in comments and improved readme and code comments for yard docs
|
64
|
+
Jon - Added headless, retries, highlight and cleanup options
|
65
|
+
|
57
66
|
END
|
data/lib/brake.rb
CHANGED
@@ -10,8 +10,15 @@ rescue LoadError
|
|
10
10
|
end
|
11
11
|
|
12
12
|
# @author Ben Slaughter
|
13
|
+
# class brake the heart and soul of brake
|
14
|
+
# simply this is a wrapper disigned to give the end user some control by being able to pass command line options
|
15
|
+
# but still having the conviniance of rake tasks
|
16
|
+
# Primarly used to aid in the brandwatch automation tasting hence brake for brandwatch rake
|
17
|
+
# The tool has now evolved and if used cleverly could be used by anyome
|
13
18
|
class Brake
|
14
19
|
# Starts the Brake Class
|
20
|
+
# Outputs the brake version at runtime
|
21
|
+
# If there is no information given to brake it will rin the 'default task'
|
15
22
|
def genesis
|
16
23
|
puts "Brake Version:" + Gem.loaded_specs["brake"].version.to_s
|
17
24
|
@arguments = self.parse_command_line_options
|
@@ -31,7 +38,8 @@ class Brake
|
|
31
38
|
end
|
32
39
|
|
33
40
|
# Parses the options from the command line
|
34
|
-
#
|
41
|
+
# Converts the parsed information into a Hash
|
42
|
+
# The Hash is then returned
|
35
43
|
# @return [hash] arguemnts a hash containg the parsed and data
|
36
44
|
def parse_command_line_options
|
37
45
|
options = []
|
@@ -46,21 +54,25 @@ class Brake
|
|
46
54
|
opts.on("-e", "--enviroment release", String, "String: The enviroment to run the tests against eg Release" ) { |o| options.push([:env, o]) }
|
47
55
|
opts.on("-t", "--tags @high,@login", Array, "Array: A list of all tagged test to be run" ) { |o| options.push([:tags, o]) }
|
48
56
|
opts.on("-l", "--log_level debug", String, "String: The log output level debug|info" ) { |o| options.push([:log_level, o]) }
|
49
|
-
opts.on("-d", "--
|
57
|
+
opts.on("-d", "--dry-run", "Bool: turns on the selenium dry run feature" ) { |o| options.push([:dry_run, o]) }
|
58
|
+
opts.on("-c", "--controller chrome", String, "String: The type of controller to run (API, Chrome, Safari)" ) { |o| options.push([:controller, o]) }
|
59
|
+
opts.on("--[no-]headless", "Bool: To turn on/off headless mode (only works on Linux!)" ) { |o| options.push([:headless, o]) }
|
60
|
+
opts.on("--[no-]cleanup", "Bool: To turn on/off setup cleanup" ) { |o| options.push([:cleanup, o]) }
|
61
|
+
opts.on("--retries 3", String, "String: The number of retries to perform on element methods" ) { |o| options.push([:retries, o]) }
|
62
|
+
opts.on("--timeouts 10", String, "String: The length of the timeouts on element methods" ) { |o| options.push([:timeouts, o]) }
|
50
63
|
opts.separator ""
|
51
64
|
opts.separator "BrandwatchWeb options:"
|
52
|
-
opts.on("-c", "--controller chrome", String, "String: The type of controller to run (API, Chrome, Safari)" ) { |o| options.push([:controller, o]) }
|
53
65
|
opts.on("-s", "--screen 1280,1024", Array, "Array: The width,hight of the browser window" ) { |o| options.push([:screen, o]) }
|
54
66
|
opts.on("--pos", "--position 0,0", Array, "Array: The x,y coords of the browser 0,0 top left" ) { |o| options.push([:position, o]) }
|
55
67
|
opts.separator ""
|
68
|
+
opts.separator "Browser options:"
|
69
|
+
opts.on("-H", "--[no-]highlight", "Bool: To turn on/off the highlight of elements" ) { |o| options.push([:highlight, o]) }
|
70
|
+
opts.separator ""
|
56
71
|
opts.separator "API options:"
|
57
72
|
opts.on("-v", "--version 00", String, "String: API Version number" ) { |o| options.push([:version, o]) }
|
58
73
|
opts.separator ""
|
59
|
-
opts.separator "Browser options:"
|
60
|
-
opts.on("-H", "--[no-]highlight", "Bool: To turn off the highlight of elements" ) { |o| options.push([:highlight, o]) }
|
61
|
-
opts.separator ""
|
62
74
|
opts.on("-u", "--[no-]untangle", "Bool: Turns Debug on/off" ) { |o| @untangle = o }
|
63
|
-
opts.on_tail("-h", "--help", "
|
75
|
+
opts.on_tail("-h", "--help", "You're Looking at it") do
|
64
76
|
puts opts
|
65
77
|
puts "For furthur assistance please contact Ben Slaughter or Jonathan Chrisp"
|
66
78
|
puts "bens@brandwatch.com or jonathan@brandwatch.com"
|
@@ -74,8 +86,8 @@ class Brake
|
|
74
86
|
end
|
75
87
|
|
76
88
|
# creates the default arguments
|
77
|
-
# --require features Ensures that all features are included
|
78
89
|
# -P Disables profiles, we no longer need it as all data is given at command line
|
90
|
+
# -s removes the extra source code line no note displayed in the command line
|
79
91
|
arguments = { :req => "-P -s" }
|
80
92
|
|
81
93
|
# takes the parsed options and turns them into meaningful data
|
@@ -91,6 +103,14 @@ class Brake
|
|
91
103
|
arguments[:log_level] = "LOGLEVEL=#{value[1].downcase}"
|
92
104
|
when :dry_run
|
93
105
|
arguments[:dry_run] = "--dry-run"
|
106
|
+
when :headless
|
107
|
+
arguments[:headless] = "HEADLESS=#{value[1].to_s}"
|
108
|
+
when :cleanup
|
109
|
+
arguments[:cleanup] = "CLEANUP=#{value[1].to_s}"
|
110
|
+
when :retries
|
111
|
+
arguments[:retries] = "RETRIES=#{value[1].downcase}"
|
112
|
+
when :timeouts
|
113
|
+
arguments[:timeouts] = "TIMEOUTS=#{value[1].downcase}"
|
94
114
|
when :highlight
|
95
115
|
arguments[:highlight] = "HIGHLIGHT=true"
|
96
116
|
when :controller
|
@@ -109,6 +129,7 @@ class Brake
|
|
109
129
|
# Runs the given rake task with the given arguments
|
110
130
|
# @param [string] task This is the name of the rake task to be invoked
|
111
131
|
# @param [hash] arguments a hash containing the arguments to be passed to the task
|
132
|
+
# @note There are 2 pre built tasks bw/brandwatchWeb and api/brandwatchapi
|
112
133
|
def run_rake_task( task, arguments )
|
113
134
|
puts "running task: " + task
|
114
135
|
self.debug( arguments )
|
@@ -127,6 +148,10 @@ class Brake
|
|
127
148
|
puts "WARNING: No Defaults set for custom task"
|
128
149
|
Rake::Task[task].execute( arguments.values.join( ' ' ) )
|
129
150
|
end # case
|
151
|
+
|
152
|
+
# This cased me some problems while running tasks
|
153
|
+
# There is no raise as several tasks may be run
|
154
|
+
# and due to that nature of the wrapper I do not want the code to quit
|
130
155
|
rescue RuntimeError => e
|
131
156
|
puts "Brake Aborted!"
|
132
157
|
puts e.message
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-10-
|
13
|
+
date: 2012-10-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|