Sha256: 0c98411e873595ec8b7e0026e93f7f89d5db56e8b5a5f54ba1fe947843114789

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

require "rails/generators"

require "active_object"
require "active_generator/version"
require "active_generator/configuration"

require "generators/environment/environment_generator"
require "generators/initializer/initializer_generator"
require "generators/service/service_generator"

%w(api controller helper jbuilder job mailer model responders_controller service task uploader view).each do |generator_name|
  require "generators/locale/#{generator_name}/#{generator_name}_generator"
end

module ActiveGenerator

  class << self
    attr_accessor :configuration
  end

  def self.configuration
    @configuration ||= Configuration.new
  end

  def self.configuration=(config)
    @configuration = config
  end

  def self.configure
    yield(configuration)
  end

end

%w(controller helper jbuilder job mailer model responders_controller task).each do |generator_name|
  if ActiveGenerator.configuration.send("autoload_#{generator_name}_generator_locale")
    begin
      require "rails/generators/rails/#{generator_name}/#{generator_name}_generator"

      "Rails::Generators::#{generator_name.to_s.camelize}Generator".constantize.class_eval do
        def copy_locale_file
          invoke("locale:#{generator_name}", [name])
        end
      end
    rescue LoadError => e
      # Skip over missing files
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_generator-2.0.6 lib/active_generator.rb