Sha256: 16e85002be8f243a70d3b9df7bd0e363f6eb3cccbf1f058c91e8c5a95f7f6709

Contents?: true

Size: 952 Bytes

Versions: 7

Compression:

Stored size: 952 Bytes

Contents

require 'model_base'

module ModelBase
  module Generators
    autoload :ModelSupport, 'model_base/generators/model_support'

    module Erb
      autoload :Scaffold, 'model_base/generators/erb/scaffold'
    end

    module FactoryGirl
      autoload :Model, 'model_base/generators/factory_girl/model'
    end

    module Rails
      autoload :ScaffoldController, 'model_base/generators/rails/scaffold_controller'
    end

    class << self
      def enable!
        ::Rails::Generators::NamedBase.prepend(ModelSupport)
        templates_dir = File::expand_path('../../templates', __FILE__)
        ::Rails::Generators.templates_path.unshift(templates_dir)
        ::Rails::Generators.lookup(["rails:scaffold_controller"])
        ::Rails::Generators::ScaffoldControllerGenerator.source_paths.unshift(templates_dir)
        Erb::Scaffold.enable!
        FactoryGirl::Model.enable!
        Rails::ScaffoldController.enable!
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
model_base_generators-0.3.9 lib/model_base/generators.rb
model_base_generators-0.3.8 lib/model_base/generators.rb
model_base_generators-0.3.7 lib/model_base/generators.rb
model_base_generators-0.3.6 lib/model_base/generators.rb
model_base_generators-0.3.5 lib/model_base/generators.rb
model_base_generators-0.3.4 lib/model_base/generators.rb
model_base_generators-0.3.3 lib/model_base/generators.rb