Class: ActiveShrine::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/active_shrine/install/install_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



24
25
26
27
# File 'lib/generators/active_shrine/install/install_generator.rb', line 24

def self.next_migration_number(dirname)
  next_migration_number = current_migration_number(dirname) + 1
  [Time.now.utc.strftime("%Y%m%d%H%M%S"), format("%.14d", next_migration_number)].max
end

Instance Method Details

#startObject



14
15
16
17
18
19
20
21
22
# File 'lib/generators/active_shrine/install/install_generator.rb', line 14

def start
  directory "app"
  directory "config"
  migration_template "db/migrate/create_active_shrine_attachments.rb", "db/migrate/create_active_shrine_attachments.rb"

  Bundler.with_unbundled_env do
    run "bundle add fastimage"
  end
end