Class: Actasdynamic::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/actasdynamic/install/install_generator.rb

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.api_tokenObject

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

Parameters:

  • value

    the value to set the attribute import_namespace to.



12
13
14
# File 'lib/generators/actasdynamic/install/install_generator.rb', line 12

def import_namespace=(value)
  @import_namespace = value
end

.project_idObject

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_migrationsObject



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_modelObject



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_namespaceObject



15
16
17
# File 'lib/generators/actasdynamic/install/install_generator.rb', line 15

def import_namespace
  @namespace || {}
end