Class: Brandish::Application::BuildCommand Private
- Inherits:
-
Object
- Object
- Brandish::Application::BuildCommand
- Includes:
- Commander::Methods
- Defined in:
- lib/brandish/application/build_command.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The build command. This just builds the project in the set directory.
Constant Summary collapse
- COMMAND_DESCRIPTION =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The description for the build command.
"Builds an existing Brandish project. If no directory is specified " \ " using --directory or -d, it defaults to the current directory."
- DEFAULTS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The default options for the build command.
{ only: :all }.freeze
Class Method Summary collapse
-
.call(application, options) ⇒ void
private
Performs the build command.
-
.define(application, command) ⇒ void
private
Defines the command on the given application.
Instance Method Summary collapse
-
#call ⇒ void
private
Performs the build.
-
#initialize(application, options) ⇒ BuildCommand
constructor
private
Initialize the build command.
Constructor Details
#initialize(application, options) ⇒ BuildCommand
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize the build command.
51 52 53 54 |
# File 'lib/brandish/application/build_command.rb', line 51 def initialize(application, ) @application = application @options = DEFAULTS.merge() end |
Class Method Details
.call(application, options) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Performs the build command. This initializes the command, and calls #call.
44 45 46 |
# File 'lib/brandish/application/build_command.rb', line 44 def self.call(application, ) new(application, ).call end |
.define(application, command) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Defines the command on the given application. This sets the important data information for the command, for use for the help output.
23 24 25 26 27 28 29 30 |
# File 'lib/brandish/application/build_command.rb', line 23 def self.define(application, command) command.syntax = "brandish build" command.description = COMMAND_DESCRIPTION command.option "-o", "--only NAMES", [::String], "Which forms to build. If this is omitted, it defaults to all." command.action { |_, o| call(application, o.__hash__) } end |
Instance Method Details
#call ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Performs the build. First, it loads the configuration file for the
build. Then, it performs the build, calling Configure#build with
the :only
filter provided by the options. This uses a Commander
native called progress
to make it look nice on the output.
62 63 64 65 66 67 68 69 70 |
# File 'lib/brandish/application/build_command.rb', line 62 def call configure = @application.load_configuration_file @application.progress(configure.build(@options[:only]).to_a, &:call) rescue => e say_error "\n!> Error while building!" say_error "!> #{e.location}" if e.respond_to?(:location) say_error "!> Received exception: #{e.class}: #{e.}" e.backtrace.each { |l| say_warning "\t~> in #{l}" } if @options[:trace] end |