Sha256: 97652576011c40d2da662c72c0bbfebee71cffc4efad56a75572014dbb9bebc5

Contents?: true

Size: 620 Bytes

Versions: 9

Compression:

Stored size: 620 Bytes

Contents

require 'rails/generators'
require 'rails/generators'
require 'rails/generators/migration'

# @private
class SlugaliciousGenerator < Rails::Generators::Base
  include Rails::Generators::Migration
  
  source_root "#{File.dirname __FILE__}/../templates"
  
  def self.next_migration_number(dirname)
    if ActiveRecord::Base.timestamped_migrations then
      Time.now.utc.strftime "%Y%m%d%H%M%S"
    else
      "%.3d" % (current_migration_number(dirname) + 1)
    end
  end
  
  def copy_files
    copy_file 'slug.rb', 'app/models/slug.rb'
    migration_template "create_slugs.rb", "db/migrate/create_slugs.rb"
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
slugalicious-2.1.1 lib/slugalicious_generator.rb
slugalicious-2.1.0 lib/slugalicious_generator.rb
slugalicious-2.0.0 lib/slugalicious_generator.rb
slugalicious-1.2.1 lib/slugalicious_generator.rb
slugalicious-1.2.0 lib/slugalicious_generator.rb
slugalicious-1.1.2 lib/slugalicious_generator.rb
slugalicious-1.1.1 lib/slugalicious_generator.rb
slugalicious-1.1.0 lib/slugalicious_generator.rb
slugalicious-1.0.0 lib/slugalicious_generator.rb