Class: Lotus::Commands::New

Inherits:
Object
  • Object
show all
Defined in:
lib/lotus/commands/new.rb

Overview

Since:

  • 0.1.0

Constant Summary collapse

GENERATORS_NAMESPACE =

Since:

  • 0.1.0

"Lotus::Generators::Application::%s".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_name_or_path, environment, cli) ⇒ New

Returns a new instance of New.

Since:

  • 0.1.0



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/lotus/commands/new.rb', line 14

def initialize(app_name_or_path, environment, cli)
  @app_name = ApplicationName.new(_get_real_app_name(app_name_or_path))
  @options  = environment.to_options
  @arch     = @options.fetch(:architecture)

  @target   = Pathname.pwd.join(@options.fetch(:path, app_name_or_path))
  @source   = Pathname.new(@options.fetch(:source) { ::File.dirname(__FILE__) + '/../generators/application/' }).join(@arch)

  @cli      = cli

  require "lotus/generators/application/#{ @arch }"
  command  = Utils::String.new(@arch).classify
  @command = Utils::Class.load!(GENERATORS_NAMESPACE % command).new(self)
end

Instance Attribute Details

#app_nameObject (readonly)

Since:

  • 0.1.0



12
13
14
# File 'lib/lotus/commands/new.rb', line 12

def app_name
  @app_name
end

#cliObject (readonly)

Since:

  • 0.1.0



12
13
14
# File 'lib/lotus/commands/new.rb', line 12

def cli
  @cli
end

#optionsObject (readonly)

Since:

  • 0.1.0



12
13
14
# File 'lib/lotus/commands/new.rb', line 12

def options
  @options
end

#sourceObject (readonly)

Since:

  • 0.1.0



12
13
14
# File 'lib/lotus/commands/new.rb', line 12

def source
  @source
end

#targetObject (readonly)

Since:

  • 0.1.0



12
13
14
# File 'lib/lotus/commands/new.rb', line 12

def target
  @target
end

Instance Method Details

#startObject

Since:

  • 0.1.0



29
30
31
# File 'lib/lotus/commands/new.rb', line 29

def start
  @command.start
end