class Pushkin::SetupGenerator

Public Class Methods

next_migration_number(dir) click to toggle source
# 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

Public Instance Methods

migration_version() click to toggle source
# File lib/generators/pushkin/setup_generator.rb, line 29
def migration_version
  "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
end
setup_application() click to toggle source
# 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