Class: RestfulApiAuthentication::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/generators/restful_api_authentication/install/install_generator.rb', line 33

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



42
43
44
# File 'lib/generators/restful_api_authentication/install/install_generator.rb', line 42

def copy_migrations
  migration_template "create_rest_client.rb", "db/migrate/create_rest_client.rb"
end

#copy_the_config_fileObject



46
47
48
# File 'lib/generators/restful_api_authentication/install/install_generator.rb', line 46

def copy_the_config_file
  copy_file "restful_api_authentication.yml", "config/restful_api_authentication.yml"
end

#copy_the_rest_client_modelObject



50
51
52
# File 'lib/generators/restful_api_authentication/install/install_generator.rb', line 50

def copy_the_rest_client_model
  copy_file "rest_client.rb", "app/models/rest_client.rb"
end