brake 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/brake.rb +11 -4
- metadata +1 -1
data/lib/brake.rb
CHANGED
@@ -16,9 +16,15 @@ end
|
|
16
16
|
class Brake
|
17
17
|
# Starts the Brake Class
|
18
18
|
def genesis
|
19
|
-
arguments = self.parse_command_line_options
|
19
|
+
arguments, untangle = self.parse_command_line_options
|
20
|
+
|
21
|
+
# puts out the command line arguments if untangle is true
|
22
|
+
p ARGV if untangle
|
23
|
+
|
24
|
+
ARGV.push('default') if ARGV == []
|
20
25
|
ARGV.each do | task |
|
21
|
-
|
26
|
+
p task if untangle
|
27
|
+
self.run_rake_task( task, arguments )
|
22
28
|
end
|
23
29
|
end
|
24
30
|
|
@@ -27,6 +33,7 @@ class Brake
|
|
27
33
|
# @return [hash] arguemnts a hash containg the parsed and data
|
28
34
|
def parse_command_line_options
|
29
35
|
options = []
|
36
|
+
untangle = false
|
30
37
|
|
31
38
|
# parses the options from the command line
|
32
39
|
OptionParser.new do |opts|
|
@@ -50,6 +57,7 @@ class Brake
|
|
50
57
|
opts.on("-v", "--version 00", String, "String: API Version number" ) { |o| options.push([:version, o]) }
|
51
58
|
opts.separator ""
|
52
59
|
opts.separator "For furthur assistance please contact Ben Slaughter"
|
60
|
+
opts.on("-u", "--[no-]untangle", "Bool: Turns Debug on/off" ) { |o| untangle = o }
|
53
61
|
opts.on_tail("-h", "--help", "Show this message") do
|
54
62
|
puts opts
|
55
63
|
exit
|
@@ -86,14 +94,13 @@ class Brake
|
|
86
94
|
arguments.push( "VERSION=#{value[1].downcase}" )
|
87
95
|
end
|
88
96
|
end
|
89
|
-
return arguments
|
97
|
+
return arguments, untangle
|
90
98
|
end
|
91
99
|
|
92
100
|
# Runs the given rake task with the given arguments
|
93
101
|
# @param [string] task This is the name of the rake task to be invoked
|
94
102
|
# @param [hash] arguments a hash containing the arguments to be passed to the task
|
95
103
|
def run_rake_task( task, arguments )
|
96
|
-
task = 'default' if task == nil
|
97
104
|
puts "running task: " + task
|
98
105
|
case task.downcase
|
99
106
|
when 'default'
|