Sha256: e9c9f6a7dbe14f98b7dc162da9d2cfcddb8bb5a10ee091f39903f29031475710

Contents?: true

Size: 444 Bytes

Versions: 5

Compression:

Stored size: 444 Bytes

Contents

require 'rails/generators'

module DynamicMenu
  class MenuGenerator < Rails::Generators::Base
    source_root File.expand_path('../templates',__FILE__)
    def generate_menu
      @args[0] =~ /(.+):.+/i
      file = $1
      dir = "app/menus/#{file}"
      Dir.mkdir(dir) unless File.exists?(dir)
      @args[0] =~ /.+:(.+)/i
      @menu_name = $1
      template "menu.rb", "app/menus/#{file}/#{@menu_name}.rb"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dynamic_menu-3.0.2 lib/generators/dynamic_menu/menu_generator.rb
dynamic_menu-3.0.1 lib/generators/dynamic_menu/menu_generator.rb
dynamic_menu-3.0.0 lib/generators/dynamic_menu/menu_generator.rb
dynamic_menu-3.0.0.rc3 lib/generators/dynamic_menu/menu_generator.rb
dynamic_menu-3.0.0.rc2 lib/generators/dynamic_menu/menu_generator.rb