Sha256: 74cf686d3f5649075958d02d1647df3c38d8d71115273a5a35bd5fb986b60a12

Contents?: true

Size: 953 Bytes

Versions: 13

Compression:

Stored size: 953 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
        @products_table_name  = ':' + EffectiveProducts.products_table_name.to_s

        migration_template ('../' * 3) + 'db/migrate/01_create_effective_products.rb.erb', 'db/migrate/create_effective_products.rb'
      end

    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
effective_products-0.2.1 lib/generators/effective_products/install_generator.rb
effective_products-0.2.0 lib/generators/effective_products/install_generator.rb
effective_products-0.1.2 lib/generators/effective_products/install_generator.rb
effective_products-0.1.1 lib/generators/effective_products/install_generator.rb
effective_products-0.1.0 lib/generators/effective_products/install_generator.rb
effective_products-0.0.9 lib/generators/effective_products/install_generator.rb
effective_products-0.0.8 lib/generators/effective_products/install_generator.rb
effective_products-0.0.7 lib/generators/effective_products/install_generator.rb
effective_products-0.0.6 lib/generators/effective_products/install_generator.rb
effective_products-0.0.5 lib/generators/effective_products/install_generator.rb
effective_products-0.0.4 lib/generators/effective_products/install_generator.rb
effective_products-0.0.3 lib/generators/effective_products/install_generator.rb
effective_products-0.0.2 lib/generators/effective_products/install_generator.rb