Class: Puret::Generators::Base
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Puret::Generators::Base
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/puret.rb
Overview
:nodoc:
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#invoke_model ⇒ Object
create model unless exists.
Class Method Details
.next_migration_number(path) ⇒ Object
18 19 20 |
# File 'lib/generators/puret.rb', line 18 def self.next_migration_number(path) Time.now.utc.strftime("%Y%m%d%H%M%S") end |
.source_root ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/generators/puret.rb', line 10 def self.source_root @_puret_source_root ||= begin if base_name && generator_name File.(File.join(base_name, generator_name, 'templates'), File.dirname(__FILE__)) end end end |
Instance Method Details
#invoke_model ⇒ Object
create model unless exists
23 24 25 |
# File 'lib/generators/puret.rb', line 23 def invoke_model invoke "model", [name] unless File.exists?(File.join(destination_root, model_path)) end |