brake 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/bin/brake +100 -0
  2. data/lib/brake.rb +69 -0
  3. metadata +50 -0
data/bin/brake ADDED
@@ -0,0 +1,100 @@
1
+ #!/usr/bin/env ruby
2
+ require 'optparse'
3
+ #require 'brake'
4
+
5
+ begin
6
+ load 'Brakefile'
7
+ rescue LoadError
8
+ puts "Brake file not present"
9
+ exit
10
+ end
11
+
12
+ if not defined?(LN_SUPPORTED)
13
+ require 'rake'
14
+ end
15
+
16
+ options = []
17
+
18
+ # parses the options from the command line
19
+ OptionParser.new do |opts|
20
+ opts.banner = "\nBrake, The Brandwatch Rake wrapper for cucumber, And on the eighth day, god created Brake.\nUsage: brake <task> [options]"
21
+
22
+ opts.separator ""
23
+ opts.separator "Global options:"
24
+ opts.on("-e", "--enviroment release", String, "String: The enviroment to run the tests on eg Release" ) { |o| options.push([:env, o]) }
25
+ opts.on("-t", "--tags @high,@login", Array, "Array: A list of all tagged test to be run" ) { |o| options.push([:tags, o]) }
26
+ opts.on("-l", "--log_level debug", String, "String: The log output level debug|info" ) { |o| options.push([:log_level, o]) }
27
+
28
+ opts.separator "Browser options:"
29
+ opts.on("-H", "--[no-]highlight", "Bool: To turn off the highlight of elements" ) { |o| options.push([:highlight, o]) }
30
+
31
+ opts.separator ""
32
+ opts.separator "BrandwatchWeb options:"
33
+ opts.on("-b", "--browser chrome", String, "String: The type of browser to run" ) { |o| options.push([:browser, o]) }
34
+ opts.on("-s", "--screen 1280,1024", Array, "Array: The width,hight of the browser window" ) { |o| options.push([:screen, o]) }
35
+ opts.on("-p", "--position 0,0", Array, "Array: The x,y coords of the browser 0,0 top left" ) { |o| options.push([:position, o]) }
36
+
37
+ opts.separator ""
38
+ opts.separator "API options:"
39
+ opts.on("-v", "--version 00", String, "String: API Version number" ) { |o| options.push([:version, o]) }
40
+
41
+ opts.separator ""
42
+ opts.separator "For furthur assistance please contact Ben Slaughter"
43
+ opts.on_tail("-h", "--help", "Show this message") do
44
+ puts opts
45
+ exit
46
+ end
47
+
48
+ end.parse!
49
+
50
+ if ARGV.length > 1
51
+ raise "incorrect arguments"
52
+ end
53
+
54
+ arguments = { :req => "--require features -P" }
55
+ options.each do | value |
56
+ case value[0]
57
+ when :env
58
+ arguments[:env] = "ENVIRONMENT=#{value[1].downcase}"
59
+ when :tags
60
+ arguments[:tags] ||= []
61
+ arguments[:tags].push( "--tags #{value[1].join(',')}" )
62
+ when :log_level
63
+ arguments[:log_level] = "LOGLEVEL=#{value[1].downcase}"
64
+ when :highlight
65
+ arguments[:highlight] = "HIGHLIGHT=true"
66
+ when :browser
67
+ arguments[:browser] = "BROWSERNAME=#{value[1].downcase}"
68
+ when :screen
69
+ arguments.push( "SCREENWIDTH=#{value[1][0].downcase} SCREENHEIGHT=#{value[1][1].downcase}" )
70
+ when :position
71
+ arguments.push( "XPOSITION=#{value[1][0].downcase} YPOSITION=#{value[1][1].downcase}" )
72
+ when :version
73
+ arguments.push( "VERSION=#{value[1].downcase}" )
74
+ end
75
+ end
76
+
77
+ if ARGV[0] == nil
78
+ puts "running task: default"
79
+ puts "WARNING: No Defaults set for default task"
80
+ Rake::Task[:default].invoke( arguments.values.join( ' ' ) )
81
+ else
82
+ ARGV.each do | task |
83
+ puts "running task: " + task
84
+ case task.downcase
85
+ when 'brandwatchweb', 'bw'
86
+ arguments = arguments.merge({ :env => 'ENVIRONMENT=release', :browser => 'BROWSERNAME=chrome' })
87
+ Rake::Task[:brandwatchWeb].invoke( arguments.values.join( ' ' ) )
88
+ when 'brandwatchapi', 'api'
89
+ arguments = arguments.merge({ :version => 'VERSION=1' })
90
+ Rake::Task[:brandwatchAPI].invoke( arguments.values.join( ' ' ) )
91
+ else
92
+ Rake::Task[task].invoke( arguments.values.join( ' ' ) )
93
+ end
94
+ end
95
+ end
96
+
97
+
98
+
99
+
100
+
data/lib/brake.rb ADDED
@@ -0,0 +1,69 @@
1
+ Cake = "\033[33m" + '''
2
+ ,:/+/-
3
+ /M/ .,-=;//;-
4
+ .:/= ;MH/, ,=/+%$XH@MM#@:
5
+ -$##@+$###@H@MMM#######H:. -/H#
6
+ .,H@H@ X######@ -H#####@+- -+H###@X
7
+ .,@##H; +XM##M/, =%@###@X;-
8
+ X%- :M##########$. .:%M###@%:
9
+ M##H, +H@@@$/-. ,;$M###@%, -
10
+ M####M=,,---,.-%%H####M$: ,+@##
11
+ @##################@/. :%H##@$-
12
+ M###############H, ;HM##M$=
13
+ #################. .=$M##M$=
14
+ ################H..;XM##M$= .:+
15
+ M###################@%= =+@MH%
16
+ @################M/. =+H#X%=
17
+ =+M##############M, -/X#X+;.
18
+ .;XM##########H= ,/X#H+:,
19
+ .=+HM######M+/+HM@+=.
20
+ ,:/%XM####H/.
21
+ ,.:=-.
22
+ ''' + "\033[0m\n"
23
+
24
+
25
+ Cube = "\033[33m" + '''
26
+ +@##########M/ :@#########@/
27
+ ##############$;H#######@;+#############
28
+ ###############M########################
29
+ ##############X,-/++/+%+/,%#############
30
+ ############M$: -X############
31
+ ##########H;. ,--. =X##########
32
+ :X######M; -$H@M##MH%: :H#######@
33
+ =%#M+=, ,+@#######M###H: -=/M#%
34
+ %M##@+ .X##$, ./+- ./###; +M##%
35
+ %####M. /###= @##M. X###%
36
+ %####M. ;M##H:. =$###X. $###%
37
+ %####@. /####M$-./@#####: %###%
38
+ %H#M/, /H###########@: ./M#%
39
+ ;$H##@@H: .;$HM#MMMH$;, ./H@M##M$=
40
+ X#########%. ..,,. .;@#########
41
+ ###########H+:. ./@###########
42
+ ##############/ ./%%%%+/.-M#############
43
+ ##############H$@#######@@##############
44
+ ##############X%########M$M#############
45
+ +M##########H: .$##########X=
46
+ ''' + "\033[0m\n"
47
+
48
+ Apature = "\033[33m" + '''
49
+ .,-:;//;:=,
50
+ . :H@@@MM@M#H/.,+%;,
51
+ ,/X+ +M@@M@MM%=,-%HMMM@X/,
52
+ -+@MM; $M@@MH+-,;XMMMM@MMMM@+-
53
+ ;@M@@M- XM@X;. -+XXXXXHHH@M@M#@/.
54
+ ,%MM@@MH ,@%= .---=-=:=,.
55
+ =@#@@@MX ., -%HX$$%%%+;
56
+ =-./@M@M$ .;@MMMM@MM:
57
+ X@/ -$MM/ .+MM@@@M$
58
+ ,@M@H: :@: . =X#@@@@-
59
+ ,@@@MMX, . /H- ;@M@M=
60
+ .H@@@@M@+, %MM+..%#$.
61
+ /MMMM@MMH/. XM@MH; =;
62
+ /%+%$XHH@$= , .H@@@@MX,
63
+ .=--------. -%H.,@@@@@MX,
64
+ .%MM@@@HHHXX$$$%+- .:$MMX =M@@MM%.
65
+ =XMMM@MM@MM#H;,-+HMM@M+ /MMMX=
66
+ =%@M@M#@$-.=$@MM@@@M; %M%=
67
+ ,:+$+-,/H#MMMMMMM@= =,
68
+ =++%%%%+/:-.
69
+ ''' + "\033[0m\n"
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: brake
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ben Slaughter
9
+ - Jonathan Chrisp
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-08-16 00:00:00.000000000 Z
14
+ dependencies: []
15
+ description: Brandwatch Rake opts parser wrapper
16
+ email: bens@brandwatch.com
17
+ executables:
18
+ - brake
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - bin/brake
23
+ - lib/brake.rb
24
+ homepage: http://rubygems.org/gems/brake
25
+ licenses:
26
+ - GPL-2
27
+ post_install_message: Thanks for installing brake!
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ none: false
33
+ requirements:
34
+ - - ! '>='
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ requirements: []
44
+ rubyforge_project:
45
+ rubygems_version: 1.8.24
46
+ signing_key:
47
+ specification_version: 3
48
+ summary: And on the eighth day, god created Break
49
+ test_files: []
50
+ has_rdoc: