Sha256: 527fd64bc5447b8a44d22a3f263acc8a99d9a46a00417fcc06bb8eb84a9fa4dc

Contents?: true

Size: 977 Bytes

Versions: 4

Compression:

Stored size: 977 Bytes

Contents

require 'rails/generators'
require 'rails/generators/migration'    
module LolitaMenu
  module Generators
    class InstallGenerator < Rails::Generators::Base
      include Rails::Generators::Migration

      source_root File.expand_path("../templates", __FILE__)
      desc "Create migrations. "

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

      def create_menu_migrations
        begin
          migration_template "migrations/create_menus.rb", "db/migrate/create_lolita_menus.rb" 
          migration_template "migrations/create_menu_items.rb", "db/migrate/create_lolita_menu_items.rb"
        rescue Exception => e
          puts e
        end
      end

      def copy_initializer
        template "lolita-menu-urls.rb", "config/lolita-menu-urls.rb"
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lolita-menu-0.1.5 lib/generators/lolita_menu/install_generator.rb
lolita-menu-0.1.4 lib/generators/lolita_menu/install_generator.rb
lolita-menu-0.1.1 lib/generators/lolita_menu/install_generator.rb
lolita-menu-0.1.0 lib/generators/lolita_menu/install_generator.rb