Class: Lotus::Commands::Generate Private
- Inherits:
-
Object
- Object
- Lotus::Commands::Generate
- Defined in:
- lib/lotus/commands/generate.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.
Defined Under Namespace
Classes: Error
Constant Summary collapse
- GENERATORS_NAMESPACE =
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.
"Lotus::Generators::%s".freeze
- APP_ARCHITECTURE =
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.
'app'.freeze
Instance Attribute Summary collapse
- #app ⇒ Object readonly private
- #app_name ⇒ Object readonly private
- #cli ⇒ Object readonly private
- #env ⇒ Object readonly private
- #name ⇒ Object readonly private
- #options ⇒ Object readonly private
- #source ⇒ Object readonly private
- #target ⇒ Object readonly private
Instance Method Summary collapse
- #app_root ⇒ Object private
-
#initialize(type, app_name, name, env, cli) ⇒ Generate
constructor
private
A new instance of Generate.
- #model_root ⇒ Object (also: #core_root) private
- #spec_root ⇒ Object private
- #start ⇒ Object private
Constructor Details
#initialize(type, app_name, name, env, cli) ⇒ Generate
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.
Returns a new instance of Generate.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/lotus/commands/generate.rb', line 26 def initialize(type, app_name, name, env, cli) @cli = cli @env = env @name = name @options = env..merge(cli.) sanitize_input(app_name, name) @type = type @source = Pathname.new(::File.dirname(__FILE__) + "/../generators/#{ @type }/").realpath @target = Pathname.pwd.realpath @app = Utils::String.new(@app_name).classify end |
Instance Attribute Details
#app ⇒ Object (readonly)
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.
22 23 24 |
# File 'lib/lotus/commands/generate.rb', line 22 def app @app end |
#app_name ⇒ Object (readonly)
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.
22 23 24 |
# File 'lib/lotus/commands/generate.rb', line 22 def app_name @app_name end |
#cli ⇒ Object (readonly)
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.
22 23 24 |
# File 'lib/lotus/commands/generate.rb', line 22 def cli @cli end |
#env ⇒ Object (readonly)
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.
22 23 24 |
# File 'lib/lotus/commands/generate.rb', line 22 def env @env end |
#name ⇒ Object (readonly)
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.
22 23 24 |
# File 'lib/lotus/commands/generate.rb', line 22 def name @name end |
#options ⇒ Object (readonly)
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.
22 23 24 |
# File 'lib/lotus/commands/generate.rb', line 22 def @options end |
#source ⇒ Object (readonly)
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.
22 23 24 |
# File 'lib/lotus/commands/generate.rb', line 22 def source @source end |
#target ⇒ Object (readonly)
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.
22 23 24 |
# File 'lib/lotus/commands/generate.rb', line 22 def target @target end |
Instance Method Details
#app_root ⇒ Object
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.
52 53 54 55 56 57 58 |
# File 'lib/lotus/commands/generate.rb', line 52 def app_root @app_root ||= begin result = Pathname.new(@options[:apps_path]) result = result.join(@app_name) if @env.container? result end end |
#model_root ⇒ Object Also known as: core_root
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.
68 69 70 71 |
# File 'lib/lotus/commands/generate.rb', line 68 def model_root @model_root ||= Pathname.new(['lib', ::File.basename(Dir.getwd)] .join(::File::SEPARATOR)) end |
#spec_root ⇒ Object
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.
62 63 64 |
# File 'lib/lotus/commands/generate.rb', line 62 def spec_root @spec_root ||= Pathname.new('spec') end |
#start ⇒ Object
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.
43 44 45 46 47 48 |
# File 'lib/lotus/commands/generate.rb', line 43 def start generator.start rescue Error => e puts e. exit 1 end |