go_run 0.0.0 → 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.
- checksums.yaml +4 -4
- data/lib/go_run.rb +18 -15
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a32e5d4f7388ea7d6f91386c02111d9ade5294f
|
|
4
|
+
data.tar.gz: 4c02c83d1a8d558a331a4818d413402280aef5bd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8406e344af9402065de242dd3eeb61128ecee1bc6608f1287f604e3185f7a42c59e8f2df4972a8c8b394294bf21cf0a5b48c150384bcfb3e1d695e7fd0ea651d
|
|
7
|
+
data.tar.gz: 52d558b52684217030ddf6473c12ef1b54dfa26017e9758abd98ef699cd89121c2f56493b1573c159b4c8f96ff49110d4bf38e8d8147a12dd1a93a11c2b20cb0
|
data/lib/go_run.rb
CHANGED
|
@@ -5,28 +5,36 @@ require 'ostruct'
|
|
|
5
5
|
|
|
6
6
|
class GoRun
|
|
7
7
|
def initialize(args)
|
|
8
|
-
|
|
8
|
+
parse_args(args)
|
|
9
9
|
validate_runfile
|
|
10
10
|
validate_args
|
|
11
11
|
run
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def parse_args(args)
|
|
15
|
-
options = OpenStruct.new
|
|
16
|
-
options.runfile = File.expand_path("./Runfile.yml", `pwd`.strip)
|
|
17
|
-
opt_parser = OptionParser.new do |opts|
|
|
15
|
+
@options = OpenStruct.new
|
|
16
|
+
@options.runfile = File.expand_path("./Runfile.yml", `pwd`.strip)
|
|
17
|
+
@opt_parser = OptionParser.new do |opts|
|
|
18
|
+
opts.banner = "Usage: #{$0} [options] target [target ...]"
|
|
19
|
+
|
|
18
20
|
opts.on("-r", "--runfile RUNFILE_PATH",
|
|
19
21
|
"Set the location of the Runfile") do |runfile|
|
|
20
|
-
options.runfile = runfile
|
|
22
|
+
@options.runfile = runfile
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
opts.on_tail("-h", "--help", "Show this message") do |runfile|
|
|
26
|
+
puts opts
|
|
27
|
+
exit 0
|
|
21
28
|
end
|
|
22
29
|
end
|
|
23
|
-
opt_parser.parse!(args)
|
|
24
|
-
options
|
|
30
|
+
@opt_parser.parse!(args)
|
|
25
31
|
end
|
|
26
32
|
|
|
27
33
|
def validate_runfile
|
|
28
34
|
if not runfile_exists?
|
|
29
35
|
puts "Runfile not found: #{@options.runfile}"
|
|
36
|
+
puts
|
|
37
|
+
puts @opt_parser.help()
|
|
30
38
|
exit 1
|
|
31
39
|
end
|
|
32
40
|
end
|
|
@@ -37,18 +45,13 @@ class GoRun
|
|
|
37
45
|
|
|
38
46
|
def validate_args
|
|
39
47
|
if ARGV.length == 0
|
|
40
|
-
|
|
48
|
+
puts "You must choose at least one target"
|
|
49
|
+
puts
|
|
50
|
+
puts @opt_parser.help()
|
|
41
51
|
exit 1
|
|
42
52
|
end
|
|
43
53
|
end
|
|
44
54
|
|
|
45
|
-
def print_usage
|
|
46
|
-
puts "You must choose at least one target"
|
|
47
|
-
puts
|
|
48
|
-
puts "Example usage:"
|
|
49
|
-
puts "#{$0} <target> [targets]..."
|
|
50
|
-
end
|
|
51
|
-
|
|
52
55
|
def run
|
|
53
56
|
runner = Runner.new(Parser.new(@options.runfile).config)
|
|
54
57
|
runner.run(ARGV)
|