Class: Twilio::Rails::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



8
9
10
11
# File 'lib/generators/twilio/rails/install/install_generator.rb', line 8

def next_migration_number(dirname)
  next_migration_number = current_migration_number(dirname) + 1
  ActiveRecord::Migration.next_migration_number(next_migration_number)
end

Instance Method Details

#setup_initializerObject



14
15
16
# File 'lib/generators/twilio/rails/install/install_generator.rb', line 14

def setup_initializer
  copy_file "initializer.rb", "config/initializers/twilio_rails.rb"
end

#setup_migrationsObject



22
23
24
# File 'lib/generators/twilio/rails/install/install_generator.rb', line 22

def setup_migrations
  migration_template "migration.rb", "db/migrate/install_twilio_rails.rb"
end

#setup_modelsObject



26
27
28
29
30
31
32
33
# File 'lib/generators/twilio/rails/install/install_generator.rb', line 26

def setup_models
  copy_file "message.rb", "app/models/message.rb"
  copy_file "phone_caller.rb", "app/models/phone_caller.rb"
  copy_file "phone_call.rb", "app/models/phone_call.rb"
  copy_file "recording.rb", "app/models/recording.rb"
  copy_file "response.rb", "app/models/response.rb"
  copy_file "sms_conversation.rb", "app/models/sms_conversation.rb"
end

#setup_routesObject



18
19
20
# File 'lib/generators/twilio/rails/install/install_generator.rb', line 18

def setup_routes
  route "mount Twilio::Rails::Engine => '/twilio'"
end