Sha256: 479a290540b0862956fe75f2bb5f766332a2d6afdba86c51c183d6f406e59117

Contents?: true

Size: 975 Bytes

Versions: 18

Compression:

Stored size: 975 Bytes

Contents

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

      desc "Creates an EffectivePosts 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 "effective_posts.rb", "config/initializers/effective_posts.rb"
      end

      def create_migration_file
        @posts_table_name = ':' + EffectivePosts.posts_table_name.to_s

        migration_template '../../../db/migrate/01_create_effective_posts.rb.erb', 'db/migrate/create_effective_posts.rb'
      end

      def show_readme
        readme "README" if behavior == :invoke
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
effective_posts-0.4.6 lib/generators/effective_posts/install_generator.rb
effective_posts-0.4.5 lib/generators/effective_posts/install_generator.rb
effective_posts-0.4.4 lib/generators/effective_posts/install_generator.rb
effective_posts-0.4.3 lib/generators/effective_posts/install_generator.rb
effective_posts-0.4.2 lib/generators/effective_posts/install_generator.rb
effective_posts-0.4.1 lib/generators/effective_posts/install_generator.rb
effective_posts-0.4.0 lib/generators/effective_posts/install_generator.rb
effective_posts-0.3.0 lib/generators/effective_posts/install_generator.rb
effective_posts-0.2.6 lib/generators/effective_posts/install_generator.rb
effective_posts-0.2.5 lib/generators/effective_posts/install_generator.rb
effective_posts-0.2.4 lib/generators/effective_posts/install_generator.rb
effective_posts-0.2.3 lib/generators/effective_posts/install_generator.rb
effective_posts-0.2.2 lib/generators/effective_posts/install_generator.rb
effective_posts-0.2.1 lib/generators/effective_posts/install_generator.rb
effective_posts-0.2.0 lib/generators/effective_posts/install_generator.rb
effective_posts-0.1.2 lib/generators/effective_posts/install_generator.rb
effective_posts-0.1.1 lib/generators/effective_posts/install_generator.rb
effective_posts-0.1 lib/generators/effective_posts/install_generator.rb