Class: Actasdynamic::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Actasdynamic::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/actasdynamic/install/install_generator.rb
Class Attribute Summary collapse
-
.api_token ⇒ Object
Returns the value of attribute api_token.
-
.import_namespace ⇒ Object
writeonly
Sets the attribute import_namespace.
-
.project_id ⇒ Object
Returns the value of attribute project_id.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.api_token ⇒ Object
Returns the value of attribute api_token.
10 11 12 |
# File 'lib/generators/actasdynamic/install/install_generator.rb', line 10 def api_token @api_token end |
.import_namespace=(value) ⇒ Object (writeonly)
Sets the attribute import_namespace
12 13 14 |
# File 'lib/generators/actasdynamic/install/install_generator.rb', line 12 def import_namespace=(value) @import_namespace = value end |
.project_id ⇒ Object
Returns the value of attribute project_id.
10 11 12 |
# File 'lib/generators/actasdynamic/install/install_generator.rb', line 10 def project_id @project_id end |
Class Method Details
.next_migration_number(path) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/generators/actasdynamic/install/install_generator.rb', line 20 def self.next_migration_number(path) unless @prev_migration_nr @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i else @prev_migration_nr += 1 end @prev_migration_nr.to_s end |
Instance Method Details
#copy_migrations ⇒ Object
34 35 36 37 |
# File 'lib/generators/actasdynamic/install/install_generator.rb', line 34 def copy_migrations migration_template "create_something.rb", "db/migrate/create_dynamic_models.rb" migration_template "create_something_else.rb", "db/migrate/create_dynamic_fields.rb" end |
#generate_model ⇒ Object
30 31 32 33 |
# File 'lib/generators/actasdynamic/install/install_generator.rb', line 30 def generate_model template @namespace,"app/models/crm_dynamic_model.rb" template"crm_dynamic_field.rb","app/models/crm_dynamic_field.rb" end |
#import_namespace ⇒ Object
15 16 17 |
# File 'lib/generators/actasdynamic/install/install_generator.rb', line 15 def import_namespace @namespace || {} end |