Sha256: b9886b24306fe45d480a28385c20a457089711ab6536bad050be66a617c3a085

Contents?: true

Size: 1.03 KB

Versions: 34

Compression:

Stored size: 1.03 KB

Contents

class RedminePluginControllerGenerator < Rails::Generators::NamedBase
  source_root File.expand_path("../templates", __FILE__)
  argument :controller, :type => :string
  argument :actions, :type => :array, :default => [], :banner => "ACTION ACTION ..."

  attr_reader :plugin_path, :plugin_name, :plugin_pretty_name

  def initialize(*args)
    super
    @plugin_name = file_name.underscore
    @plugin_pretty_name = plugin_name.titleize
    @plugin_path = "plugins/#{plugin_name}"
    @controller_class = controller.camelize
  end

  def copy_templates
    template 'controller.rb.erb', "#{plugin_path}/app/controllers/#{controller}_controller.rb"
    template 'helper.rb.erb', "#{plugin_path}/app/helpers/#{controller}_helper.rb"
    template 'functional_test.rb.erb', "#{plugin_path}/test/functional/#{controller}_controller_test.rb"
    # View template for each action.
    actions.each do |action|
      path = "#{plugin_path}/app/views/#{controller}/#{action}.html.erb"
      @action_name = action
      template 'view.html.erb', path
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
redmine_extensions-0.0.39 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
redmine_extensions-0.0.38 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
redmine_extensions-0.0.37 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
redmine_extensions-0.1.11 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
redmine_extensions-0.1.10 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
redmine_extensions-0.0.36 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
redmine_extensions-0.0.34 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
redmine_extensions-0.1.09 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
redmine_extensions-0.1.07 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
redmine_extensions-0.1.06 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
redmine_extensions-0.1.05 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
redmine_extensions-0.1.04 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
redmine_extensions-0.1.03 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
redmine_extensions-0.0.33 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
redmine_extensions-0.1.02 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
redmine_extensions-0.1.01 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
redmine_extensions-0.0.29 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
redmine_extensions-0.0.28 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
redmine_extensions-0.0.27 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
redmine_extensions-0.0.24 spec/redmine/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb