Sha256: b5a69e9a4d784efd70324bac5bf94144a148f1736a1b7ce86d03bd3589db12f8

Contents?: true

Size: 953 Bytes

Versions: 5

Compression:

Stored size: 953 Bytes

Contents

require 'rails/generators/active_record'

class SocialAuth::InstallGenerator < Rails::Generators::Base
  include Rails::Generators::Migration

  source_root File.expand_path('../templates', __FILE__)

  def copy_migrations
    copy_migration "create_social_auth_services"

    puts "Installation successful. You can now run:"
    puts "  rake db:migrate"
  end

  def copy_initializer
    template "initializer.rb", "config/initializers/social_auth.rb"
  end

  def self.next_migration_number(dirname)
    if ActiveRecord::Base.timestamped_migrations
      Time.now.utc.strftime("%Y%m%d%H%M%S%L")
    else
      "%.3d" % (current_migration_number(dirname) + 1)
    end
  end

  private

  def copy_migration(filename)
    if self.class.migration_exists?("db/migrate", "#{filename}")
      say_status("skipped", "Migration #{filename}.rb already exists")
    else
      migration_template "#{filename}.rb", "db/migrate/#{filename}.rb"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
social_auth-0.0.13 lib/generators/social_auth/install/install_generator.rb
social_auth-0.0.12 lib/generators/social_auth/install/install_generator.rb
social_auth-0.0.11 lib/generators/social_auth/install/install_generator.rb
social_auth-0.0.10 lib/generators/social_auth/install/install_generator.rb
social_auth-0.0.9 lib/generators/social_auth/install/install_generator.rb