class Omnibus::CLI::Base
Public Class Methods
exit_on_failure?()
click to toggle source
Forces command to exit with a 1 on any failure…so raise away.
# File lib/omnibus/cli/base.rb, line 80 def self.exit_on_failure? true end
new(args, options, config)
click to toggle source
Calls superclass method
# File lib/omnibus/cli/base.rb, line 32 def initialize(args, options, config) super(args, options, config) $stdout.sync = true # Don't try to initialize the Omnibus project for help commands. current_task renamed to current_command in Thor 0.18.0 current_command = config[:current_command] ? config[:current_command].name : config[:current_task].name return if current_command == "help" if config = @options[:config] if config && File.exist?(@options[:config]) say("Using Omnibus configuration file #{config}", :green) Omnibus.load_configuration(config) elsif config say("No configuration file `#{config}', using defaults", :yellow) end end if path = @options[:path] # TODO: merge in all relevant CLI options here, as they should # override anything from a configuration file. Omnibus::Config.project_root(path) Omnibus::Config.append_timestamp(@options[:timestamp]) if @options.key?('timestamp') unless Omnibus.project_files.any? raise Omnibus::CLI::Error, "Given path '#{path}' does not appear to be a valid Omnibus project root." end begin Omnibus.process_configuration rescue => e error_msg = "Could not load the Omnibus projects." raise Omnibus::CLI::Error.new(error_msg, e) end end end
source_root()
click to toggle source
Used by {Thor::Actions#template} to locate ERB templates @return [String]
# File lib/omnibus/cli/base.rb, line 75 def self.source_root File.expand_path(File.join(File.dirname(__FILE__), '..', 'templates')) end
Protected Instance Methods
load_project!(project_name)
click to toggle source
Omnibus
Helpers (should these be in Omnibus::Util?)
# File lib/omnibus/cli/base.rb, line 106 def load_project!(project_name) project = Omnibus.project(project_name) unless project error_msg = "I don't know anything about project '#{project_name}'." error_msg << " Valid project names include: #{Omnibus.project_names.join(', ')}" raise Omnibus::CLI::Error, error_msg end project end