Class: Meetmermeeting::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Meetmermeeting::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/meetmermeeting/install_generator.rb
Class Method Summary collapse
- .next_migration_number(dirname) ⇒ Object
-
.source_root ⇒ Object
source_root File.expand_path(‘../templates’, __FILE__).
Instance Method Summary collapse
Class Method Details
.next_migration_number(dirname) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/generators/meetmermeeting/install_generator.rb', line 35 def self.next_migration_number(dirname) if ActiveRecord::Base. Time.new.utc.strftime("%Y%m%d%H%M%S") else "%.3d" % (current_migration_number(dirname) + 1) end end |
.source_root ⇒ Object
source_root File.expand_path(‘../templates’, __FILE__)
29 30 31 32 33 |
# File 'lib/generators/meetmermeeting/install_generator.rb', line 29 def self.source_root # @source_root ||= File.join(File.dirname(__FILE__), 'templates') @source_root ||= File.("../templates", __FILE__) desc "Add the migration and model files" end |
Instance Method Details
#copy_migrations ⇒ Object
46 47 48 |
# File 'lib/generators/meetmermeeting/install_generator.rb', line 46 def copy_migrations migration_template "create_meetings.rb", "db/migrate/create_meetings.rb" end |
#create_model_file ⇒ Object
43 44 45 |
# File 'lib/generators/meetmermeeting/install_generator.rb', line 43 def create_model_file template "meeting.rb", "app/models/meeting.rb" end |