console_runner 0.1.27 → 0.1.28
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/command_line_parser.rb +4 -5
- data/lib/console_runner.rb +2 -2
- data/lib/console_runner/version.rb +1 -1
- 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: bc3a9531df2e4e6164309a48b9711fb4ce4b82a0
|
|
4
|
+
data.tar.gz: 52b2b36913c2bc8a5e8baf6ef06b368b556817fe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1de098adb92f8c1e600898eaac0d56d9e7cbb41c1b6a3c5e1c08795f13dd841ced303c7a2e2a2f7e8e1badf7d216da94c9dfb44d0c3a25707ec710726c33b30c
|
|
7
|
+
data.tar.gz: ff252265a08da9bccad17fd4f315842a1e9e7136bfe3c23efd9f05b8a83ca35471a5fcc3c488135f4d0578579f232a29005a93632a66dbb9773c546dd082905c
|
data/lib/command_line_parser.rb
CHANGED
|
@@ -10,16 +10,15 @@ class CommandLineParser
|
|
|
10
10
|
# Generate tool help menu.
|
|
11
11
|
# IMPORTANT! Should be executed before ARGV.shift
|
|
12
12
|
def initialize(file_parser)
|
|
13
|
-
@file_parser
|
|
14
|
-
@sub_commands
|
|
15
|
-
@sub_commands_text
|
|
13
|
+
@file_parser = file_parser
|
|
14
|
+
@sub_commands = @file_parser.runnable_methods.map { |m| m.name.to_s }
|
|
15
|
+
@sub_commands_text = @file_parser.runnable_methods.map do |m|
|
|
16
16
|
[
|
|
17
17
|
m.name.to_s,
|
|
18
18
|
FileParser.select_runnable_tags(m).map(&:text).join("\n")
|
|
19
19
|
]
|
|
20
20
|
end.to_h
|
|
21
|
-
@parser
|
|
22
|
-
CommandLineParser.debug = ARGV.any? { |a| %w(-d --debug).include? a }
|
|
21
|
+
@parser = Trollop::Parser.new
|
|
23
22
|
@parser.opt(:debug, 'Run in debug mode.', type: :flag)
|
|
24
23
|
@parser.stop_on @sub_commands
|
|
25
24
|
@initialize_method = nil
|
data/lib/console_runner.rb
CHANGED
|
@@ -4,12 +4,12 @@ require 'console_runner/version'
|
|
|
4
4
|
|
|
5
5
|
# console_runner logic is here
|
|
6
6
|
module ConsoleRunner
|
|
7
|
-
|
|
7
|
+
CommandLineParser.debug = ARGV.any? { |a| %w(-d --debug).include? a }
|
|
8
|
+
SEPARATOR = '==================================='.freeze
|
|
8
9
|
begin
|
|
9
10
|
start_time = Time.now
|
|
10
11
|
success_status = true
|
|
11
12
|
puts "#{SEPARATOR}\nStart Time: #{start_time}\n#{SEPARATOR}".blue
|
|
12
|
-
|
|
13
13
|
file_from_arg = ARGV.shift
|
|
14
14
|
raise ConsoleRunnerError, 'Specify file to be executed' unless file_from_arg
|
|
15
15
|
file_path = File.realpath file_from_arg
|