Sha256: 6d4037b0724b16b190b5f4202a7712545d2fe585573cb10668f57a989134fab8

Contents?: true

Size: 982 Bytes

Versions: 1

Compression:

Stored size: 982 Bytes

Contents

require "active_support/concern"

module Redmine
  module Generators
    module PluginSupport
      extend ActiveSupport::Concern

      included do
        templates_path << File.expand_path("../templates", __FILE__)
        
        class << self
          def lookup_with_redmine(namespaces)
            redmine_names = namespaces.select { |ns| ns.start_with? "redmine:" }
            redmine_names.each do |ns|
              require "redmine/generators/#{ns.split(":").last}_generator"
            end
            lookup_without_redmine (namespaces - redmine_names)
          end
          alias_method_chain :lookup, :redmine

          def lookup_with_redmine!
            Dir[File.expand_path("../*_generator.rb", __FILE__)].each do |path|
              require File.join("redmine/generators", File.basename(path, ".rb"))
            end
            lookup_without_redmine!
          end
          alias_method_chain :lookup!, :redmine
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redmine-generators-0.0.1 lib/redmine/generators/plugin_support.rb