Class: DigestNotifier::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- DigestNotifier::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/digest_notifier/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(dirname) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/generators/digest_notifier/install_generator.rb', line 11 def self.next_migration_number(dirname) if ActiveRecord::Base. 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 else (current_migration_number(dirname) + 1) end end |
Instance Method Details
#copy_configuration ⇒ Object
33 34 35 |
# File 'lib/generators/digest_notifier/install_generator.rb', line 33 def copy_configuration template "digest_notifier_config.rb", File.join("config", "initializers", "digest_notifier.rb") end |
#copy_migration ⇒ Object
37 38 39 40 41 |
# File 'lib/generators/digest_notifier/install_generator.rb', line 37 def copy_migration migration_template "create_digest_email_groups.rb", File.join("db", "migrate", "create_digest_email_groups.rb") migration_template "create_digest_email_items.rb", File.join("db", "migrate", "create_digest_email_items.rb") migration_template "create_digest_email_deliveries.rb", File.join("db", "migrate", "create_digest_email_deliveries.rb") end |
#copy_model ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/generators/digest_notifier/install_generator.rb', line 24 def copy_model if .m? Gem.find_files("digest_notifier/models/*.rb").each do |file| model_name = file.slpit("/").last template file, File.join("app", "models", model_name) end end end |
#show ⇒ Object
43 44 45 |
# File 'lib/generators/digest_notifier/install_generator.rb', line 43 def show readme "README" end |