Sha256: 7cbfb21ecb2846491a152aa856ad4210e0510f17e0d2cc754a8a9c1b47677f46

Contents?: true

Size: 1.25 KB

Versions: 20

Compression:

Stored size: 1.25 KB

Contents

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

      desc 'Creates an EffectivePages 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_pages.rb', 'config/initializers/effective_pages.rb'
      end

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

      def copy_example_page
        template 'example.html.haml', 'app/views/effective/pages/example.html.haml'
      end

      def setup_routes
        inject_into_file 'config/routes.rb', "\n  # if you want EffectivePages to render the home / root page\n  # uncomment the following line and create an Effective::Page with slug == 'home' \n  # root to: 'Effective::Pages#show', id: 'home'\n", :before => /root (:?)to.*/
      end

    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
effective_pages-3.14.1 lib/generators/effective_pages/install_generator.rb
effective_pages-3.14.0 lib/generators/effective_pages/install_generator.rb
effective_pages-3.13.5 lib/generators/effective_pages/install_generator.rb
effective_pages-3.13.4 lib/generators/effective_pages/install_generator.rb
effective_pages-3.13.3 lib/generators/effective_pages/install_generator.rb
effective_pages-3.13.2 lib/generators/effective_pages/install_generator.rb
effective_pages-3.13.1 lib/generators/effective_pages/install_generator.rb
effective_pages-3.13.0 lib/generators/effective_pages/install_generator.rb
effective_pages-3.12.0 lib/generators/effective_pages/install_generator.rb
effective_pages-3.11.0 lib/generators/effective_pages/install_generator.rb
effective_pages-3.10.3 lib/generators/effective_pages/install_generator.rb
effective_pages-3.10.2 lib/generators/effective_pages/install_generator.rb
effective_pages-3.10.1 lib/generators/effective_pages/install_generator.rb
effective_pages-3.10.0 lib/generators/effective_pages/install_generator.rb
effective_pages-3.9.0 lib/generators/effective_pages/install_generator.rb
effective_pages-3.8.4 lib/generators/effective_pages/install_generator.rb
effective_pages-3.8.3 lib/generators/effective_pages/install_generator.rb
effective_pages-3.8.2 lib/generators/effective_pages/install_generator.rb
effective_pages-3.8.1 lib/generators/effective_pages/install_generator.rb
effective_pages-3.8.0 lib/generators/effective_pages/install_generator.rb