Class: Pushkin::SetupGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Pushkin::SetupGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/pushkin/setup_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(dir) ⇒ Object
9 10 11 |
# File 'lib/generators/pushkin/setup_generator.rb', line 9 def self.next_migration_number(dir) Time.now.utc.strftime("%Y%m%d%H%M%S") end |
Instance Method Details
#migration_version ⇒ Object
29 30 31 |
# File 'lib/generators/pushkin/setup_generator.rb', line 29 def migration_version "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" end |
#setup_application ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/generators/pushkin/setup_generator.rb', line 13 def setup_application file_name = "tokens_controller.rb" copy_file file_name, "app/controllers/pushkin/api/v1/#{file_name}" migration_template "create_pushkin_tables.rb", "db/migrate/create_pushkin_tables1.rb", migration_version: migration_version route "namespace :pushkin do\n" + " namespace :api do\n" + " namespace :v1 do\n" + " resources :tokens, only: [:create]\n" + " end\n" + " end\n" + " end\n" end |