Class: PostJson::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object


10
11
12
13
14
15
16
17
# File 'lib/generators/post_json/install/install_generator.rb', line 10

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_initializer_fileObject


27
28
29
# File 'lib/generators/post_json/install/install_generator.rb', line 27

def copy_initializer_file
  copy_file "initializer.rb", "config/initializers/post_json.rb"
end

#copy_migrationsObject


19
20
21
22
23
24
25
# File 'lib/generators/post_json/install/install_generator.rb', line 19

def copy_migrations
  migration_template "enable_extensions.rb", "db/migrate/enable_extensions.rb"
  migration_template "create_procedures.rb", "db/migrate/create_procedures.rb"
  migration_template "create_post_json_model_settings.rb", "db/migrate/create_post_json_model_settings.rb"
  migration_template "create_post_json_documents.rb", "db/migrate/create_post_json_documents.rb"
  migration_template "create_post_json_dynamic_indexes.rb", "db/migrate/create_post_json_dynamic_indexes.rb"
end