sct/lib/sct/cli_tools_distributor.rb in sct-1.0.4 vs sct/lib/sct/cli_tools_distributor.rb in sct-1.0.5
- old
+ new
@@ -1,50 +1,50 @@
module Sct
class CLIToolsDistributor
- class << self
+ class << self
def take_off
require 'sct'
tool_name = ARGV.first ? ARGV.first.downcase : nil
if tool_name && Sct::TOOLS.include?(tool_name.to_sym)
# Triggering a specific tool
-
+
require tool_name
begin
# First, remove the tool's name from the arguments
# Since it will be parsed by the `commander` at a later point
# and it must not contain the binary name
ARGV.shift
-
+
# Import the CommandsGenerator class, which is used to parse
# the user input
require File.join(tool_name, "commands_generator")
-
+
# Call the tool's CommandsGenerator class and let it do its thing
commands_generator = Object.const_get(tool_name.sct_module)::CommandsGenerator
rescue LoadError
# This will only happen if the tool we call here, doesn't provide
# a CommandsGenerator class yet
# When we launch this feature, this should never be the case
abort("#{tool_name} can't be called via `sct #{tool_name}`, run '#{tool_name}' directly instead".red)
end
-
+
# Some of the tools might use other actions so need to load all
# actions before we start the tool generator here in the future
Sct.load_actions
-
+
# trigger start on tool
commands_generator.start
- else
+ else
require "sct/commands_generator"
Sct::CommandsGenerator.start
end
ensure
SctCore::UpdateChecker.start_looking_for_update('sct')
SctCore::UpdateChecker.show_update_status('sct', Sct::VERSION)
end
end
end
-end
\ No newline at end of file
+end