Class: Toolshed::CLI
- Inherits:
-
Object
- Object
- Toolshed::CLI
- Defined in:
- lib/toolshed/cli.rb
Overview
CLI is responsible for executing the initial command
Instance Method Summary collapse
Instance Method Details
#execute(command_class, args, options = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/toolshed/cli.rb', line 10 def execute(command_class, args, = {}) load_config(command_class) begin command_class.new.execute(args, ) rescue Toolshed::Error => e Toolshed.logger.fatal "An error occurred: #{e.message}" rescue RuntimeError => e Toolshed.logger.fatal "An error occurred: #{e.message}" end end |
#load_config(command_class) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/toolshed/cli.rb', line 21 def load_config(command_class) Toolshed.add_file_log_source(command_class.class.name) Toolshed.logger.info "Credentials loaded from #{File.absolute_path(Toolshed::Client.instance.toolshedrc_path)}" # rubocop:disable Metrics/LineLength rescue => e Toolshed.logger.fatal "Error loading your credentials: #{e.message}" end |