Sha256: c226544de3e87b938cc0f5989c4af76c460d42063203af83fa5ea6c83a300f78

Contents?: true

Size: 984 Bytes

Versions: 10

Compression:

Stored size: 984 Bytes

Contents

require 'rails/generators/migration'

module Socialite
  module Generators
    class MigrationsGenerator < ::Rails::Generators::Base #:nodoc:
      include Rails::Generators::Migration
      source_root File.expand_path('../templates', __FILE__)

      class_option :users_table,
        :default => 'socialite_users',
        :type => :string
      class_option :identity_table,
        :default => 'socialite_identities',
        :type => :string

      desc "add the migrations needed for socialite"

      def self.next_migration_number(path)
        unless @prev_migration_nr
          @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
        else
          @prev_migration_nr += 1
        end
        @prev_migration_nr.to_s
      end

      def copy_migrations
        migration_template "users.rb.erb", "db/migrate/create_socialite_users.rb"
        migration_template "identity.rb.erb", "db/migrate/create_socialite_identities.rb"
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
socialite-0.2.1 lib/generators/socialite/migrations_generator.rb
socialite-0.2.0 lib/generators/socialite/migrations_generator.rb
socialite-0.1.2 lib/generators/socialite/migrations_generator.rb
socialite-0.1.1 lib/generators/socialite/migrations_generator.rb
socialite-0.1.0.pre.7 lib/generators/socialite/migrations_generator.rb
socialite-0.1.0.pre.6 lib/generators/socialite/migrations_generator.rb
socialite-0.1.0.pre.5 lib/generators/socialite/migrations_generator.rb
socialite-0.1.0.pre.4 lib/generators/socialite/migrations_generator.rb
socialite-0.1.0.pre.3 lib/generators/socialite/migrations_generator.rb
socialite-0.1.0.pre.2 lib/generators/socialite/migrations_generator.rb