Sha256: 2055b158612fb99d31df557ffc9d4f2a540d7eaa8af3c8038a4479fa50d16d39

Contents?: true

Size: 868 Bytes

Versions: 11

Compression:

Stored size: 868 Bytes

Contents

module EffectiveMemberships
  module Generators
    class InstallGenerator < Rails::Generators::Base
      include Rails::Generators::Migration

      desc 'Creates an EffectiveProducts initializer in your application.'

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

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

      def copy_initializer
        template ('../' * 3) + 'config/effective_products.rb', 'config/initializers/effective_products.rb'
      end

      def create_migration_file
        migration_template ('../' * 3) + 'db/migrate/101_create_effective_products.rb', 'db/migrate/create_effective_products.rb'
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
effective_products-0.3.10 lib/generators/effective_products/install_generator.rb
effective_products-0.3.9 lib/generators/effective_products/install_generator.rb
effective_products-0.3.8 lib/generators/effective_products/install_generator.rb
effective_products-0.3.7 lib/generators/effective_products/install_generator.rb
effective_products-0.3.6 lib/generators/effective_products/install_generator.rb
effective_products-0.3.5 lib/generators/effective_products/install_generator.rb
effective_products-0.3.4 lib/generators/effective_products/install_generator.rb
effective_products-0.3.3 lib/generators/effective_products/install_generator.rb
effective_products-0.3.2 lib/generators/effective_products/install_generator.rb
effective_products-0.3.1 lib/generators/effective_products/install_generator.rb
effective_products-0.3.0 lib/generators/effective_products/install_generator.rb