Sha256: df9cf78e9148c75b2c99646326534a4cea622d7c40bb93a48f81be3ae69dc679

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

require "model_base/version"

module ModelBase

  autoload :ColumnAttribute, 'model_base/column_attribute'
  autoload :Configuration, 'model_base/config'
  autoload :MetaModel    , 'model_base/meta_model'

  class << self
    def configure
      yield config
    end

    def config
      @config ||= Configuration.new
    end

    def enable!
      require 'model_base/generators/model_support'
      ::Rails::Generators::NamedBase.prepend(::ModelBase::Generators::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)
      require 'model_base/generators/erb/scaffold'
      ::ModelBase::Generators::Erb::Scaffold.enable!
      require 'model_base/generators/factory_girl/model'
      ::ModelBase::Generators::FactoryGirl::Model.enable!
    end

    def base_time
      Time.zone.parse(config.base_time)
    end
  end
end
require 'model_base/railtie' if defined?(Rails)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
model_base_generators-0.3.2 lib/model_base.rb
model_base_generators-0.3.1 lib/model_base.rb
model_base_generators-0.3.0 lib/model_base.rb
model_base_generators-0.2.4 lib/model_base.rb
model_base_generators-0.2.3 lib/model_base.rb