Sha256: f61b978a739100d9b4bd1da81dcc9bb274dbc028cca24721279deb022b789a12

Contents?: true

Size: 767 Bytes

Versions: 2

Compression:

Stored size: 767 Bytes

Contents

require 'generators/common'
module Batman
  module Generators
    class ControllerGenerator < ::Rails::Generators::NamedBase
      include Common
      requires_app_name

      desc "This generator creates a Batman controller"
      argument :actions, :type => :array, :default => [], :banner => "action action"

      def create_batman_controller
        with_app_name do
          template "batman/controller.coffee", "#{app_path}/controllers/#{file_name.downcase}_controller.js.coffee"
          generate "batman:html #{plural_name} #{action_names} #{app_name_flag}"
          generate "batman:view  #{plural_name} #{app_name_flag}"
        end
      end

      def action_names
        options[:actions].join(' ') if options[:actions]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
batman-rails-0.15.1 lib/generators/batman/controller_generator.rb
batman-rails-0.15.0 lib/generators/batman/controller_generator.rb