Class: Lotus::Commands::Generate::Abstract

Inherits:
Object
  • Object
show all
Includes:
Generators::Generatable
Defined in:
lib/lotus/commands/generate/abstract.rb

Overview

Since:

  • 0.1.0

Direct Known Subclasses

Action, App, Mailer, Migration, Model

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Generators::Generatable

#add_mapping, #destroy, #generator, #map_templates, #post_process_templates, #process_templates, #start, #template_options

Constructor Details

#initialize(options) ⇒ Abstract

Returns a new instance of Abstract.

Since:

  • 0.1.0



16
17
18
19
20
21
# File 'lib/lotus/commands/generate/abstract.rb', line 16

def initialize(options)
  @options = Lotus::Utils::Hash.new(options).symbolize!
  assert_options!

  @target_path = Pathname.pwd
end

Instance Attribute Details

#optionsObject (readonly)

Since:

  • 0.1.0



14
15
16
# File 'lib/lotus/commands/generate/abstract.rb', line 14

def options
  @options
end

#target_pathObject (readonly)

Since:

  • 0.1.0



14
15
16
# File 'lib/lotus/commands/generate/abstract.rb', line 14

def target_path
  @target_path
end

Instance Method Details

#template_source_pathObject

Since:

  • 0.1.0



23
24
25
26
# File 'lib/lotus/commands/generate/abstract.rb', line 23

def template_source_path
  generator = self.class.name.split('::').last.downcase
  Pathname.new(::File.dirname(__FILE__) + "/../../generators/#{generator}/").realpath
end