Class: Merrycms::InstallMediaGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/merrycms/install_media_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

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.timestamped_migrations
    Time.now.utc.strftime("%Y%m%d%H%M%S")
  else
    "%.3d" % (current_migration_number(dirname) + 1)
  end
end

.source_rootObject



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_initializerObject



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_filesObject



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_filesObject



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_filesObject



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