Class: Merrycms::InstallMediaGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Merrycms::InstallMediaGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/merrycms/install_media_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #copy_locale_initializer ⇒ Object
- #create_documents_migration_files ⇒ Object
- #create_images_migration_files ⇒ Object
- #create_videos_migration_files ⇒ Object
Class Method Details
.next_migration_number(dirname) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/generators/merrycms/install_media_generator.rb', line 12 def self.next_migration_number(dirname) if ActiveRecord::Base. Time.now.utc.strftime("%Y%m%d%H%M%S") else "%.3d" % (current_migration_number(dirname) + 1) end end |
.source_root ⇒ Object
8 9 10 |
# File 'lib/generators/merrycms/install_media_generator.rb', line 8 def self.source_root @source_root ||= File.join(File.dirname(__FILE__), 'templates') end |
Instance Method Details
#copy_locale_initializer ⇒ Object
25 26 27 |
# File 'lib/generators/merrycms/install_media_generator.rb', line 25 def copy_locale_initializer copy_file 'paperclip_initializer.rb', 'config/initializers/paperclip.rb' end |
#create_documents_migration_files ⇒ Object
29 30 31 32 |
# File 'lib/generators/merrycms/install_media_generator.rb', line 29 def create_documents_migration_files migration_template 'create_documents_migration.rb', 'db/migrate/create_documents.rb' sleep 1 end |
#create_images_migration_files ⇒ Object
20 21 22 23 |
# File 'lib/generators/merrycms/install_media_generator.rb', line 20 def create_images_migration_files migration_template 'create_images_migration.rb', 'db/migrate/create_images.rb' sleep 1 end |
#create_videos_migration_files ⇒ Object
34 35 36 37 |
# File 'lib/generators/merrycms/install_media_generator.rb', line 34 def create_videos_migration_files migration_template 'create_videos_migration.rb', 'db/migrate/create_videos.rb' sleep 1 end |