Class: Brandish::Application::InitializeCommand Private
- Inherits:
-
Object
- Object
- Brandish::Application::InitializeCommand
- Includes:
- Thor::Actions, Thor::Base
- Defined in:
- lib/brandish/application/initialize_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 initialize command for the application. This creates a new project
at a given directory. The Brandish project is placed at
directory
/name
.
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 initialize command.
"Creates a new Brandish project. The name given should not contain " \ "any path seperators - if a brandish project needs to be placed in " \ "a seperate directory, use the --directory (or -d) option."
Class Method Summary collapse
-
.call(application, arguments, _options) ⇒ void
private
Performs the initialize command.
-
.define(application, command) ⇒ void
private
Defines the command on the given application.
-
.source_root ⇒ ::String
private
The source root for the templates used by Thor for initialization.
Instance Method Summary collapse
-
#call ⇒ void
private
Performs the initialize command, setting up the project.
Class Method Details
.call(application, arguments, _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 initialize command. Since this class uses Thor, this performs some setup to interface with the Thor class.
53 54 55 56 57 |
# File 'lib/brandish/application/initialize_command.rb', line 53 def self.call(application, arguments, ) name = arguments[0] directory = application.directory / name new([], { name: name }, destination_root: directory).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.
37 38 39 40 41 42 |
# File 'lib/brandish/application/initialize_command.rb', line 37 def self.define(application, command) command.syntax = "brandish initialize NAME" command.description = COMMAND_DESCRIPTION command.action { |a, o| call(application, a, o.__hash__) } end |
.source_root ⇒ ::String
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.
The source root for the templates used by Thor for initialization.
27 28 29 |
# File 'lib/brandish/application/initialize_command.rb', line 27 def self.source_root File.("../../../../templates/initialize", __FILE__) 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 initialize command, setting up the project.
62 63 64 65 66 67 68 |
# File 'lib/brandish/application/initialize_command.rb', line 62 def call template "brandish.config.rb" %w(source source/assets source/assets/styles source/assets/scripts templates output).each { |d| empty_directory(d) } template "Gemfile" inside(".") { run "bundle install" } end |