Class: Meeting::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Meeting::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/meeting/install/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
36 37 38 39 40 41 42 |
# File 'lib/generators/meeting/install/install_generator.rb', line 36 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__)
30 31 32 33 34 |
# File 'lib/generators/meeting/install/install_generator.rb', line 30 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
47 48 49 |
# File 'lib/generators/meeting/install/install_generator.rb', line 47 def copy_migrations migration_template "create_meetings.rb", "db/migrate/create_meetings.rb" end |
#create_model_file ⇒ Object
44 45 46 |
# File 'lib/generators/meeting/install/install_generator.rb', line 44 def create_model_file template "meeting.rb", "app/models/meeting.rb" end |