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



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

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



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

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

#setup_migrationsObject



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

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

#setup_modelsObject



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

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



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

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