class Dapp::CLI::Command::Base
Public Class Methods
new()
click to toggle source
Calls superclass method
Dapp::CLI::new
# File lib/dapp/cli/command/base.rb, line 54 def initialize self.class.options.merge!(Base.options) super() end
Public Instance Methods
cli_options(**kwargs)
click to toggle source
# File lib/dapp/cli/command/base.rb, line 100 def cli_options(**kwargs) dirs = [config[:build_dir], config[:run_dir], config[:deploy_dir]] if dirs.compact.size > 1 self.class.print_error_with_help_and_die! self, "cannot use alias options --run-dir, --build-dir, --deploy-dir at the same time" end config.merge(build_dir: dirs.compact.first, dapp_command: run_method, **kwargs) end
log_dapp_running_time(dapp) { || ... }
click to toggle source
# File lib/dapp/cli/command/base.rb, line 81 def log_dapp_running_time(dapp) return yield unless log_running_time begin start_time = Time.now yield ensure dapp.log_step("Running time #{(Time.now - start_time).round(2)} seconds") end end
log_running_time()
click to toggle source
# File lib/dapp/cli/command/base.rb, line 92 def log_running_time true end
run(_argv = ARGV)
click to toggle source
# File lib/dapp/cli/command/base.rb, line 96 def run(_argv = ARGV) raise end
run_dapp_command(run_method, options: {}) { |dapp| ... }
click to toggle source
# File lib/dapp/cli/command/base.rb, line 59 def run_dapp_command(run_method, options: {}) dapp = ::Dapp::Dapp.new(options: options) ::Dapp::CLI.dapp_object = dapp dapp.sentry_message("Manual usage: `#{options[:dapp_command]}` command") unless ENV['CI'] log_dapp_running_time(dapp) do begin if block_given? yield dapp elsif !run_method.nil? dapp.public_send(run_method) end ensure dapp.terminate end end end
run_method()
click to toggle source
# File lib/dapp/cli/command/base.rb, line 77 def run_method class_to_lowercase end