Sha256: d0c8c3d18fa19126fccb71cd6befc4b98673b0c4b34698eaf4bf0b06e8b7803f
Contents?: true
Size: 1.99 KB
Versions: 1
Compression:
Stored size: 1.99 KB
Contents
require_all File.dirname(__FILE__) + '/directory' require 'rails_assist/artifact' module RailsAssist module Directory class << self attr_accessor :rails_root def method_missing(sym, *args, &block) RailsAssist::Artifact::Directory.send sym end end include Root extend Root include App extend App include Container extend Container # dir_for helpers # ------------------- module Methods DIR = RailsAssist::Artifact::Directory # :app, :config, :db, :public, :lib, :log, :doc, :test, :spec # # app_dir, config_dir ... RailsAssist::Directory::Root.root_directories.each do |name| class_eval %{ def #{name}_dir options={} _root_dir = RailsAssist::Directory::Root.root_dir(options) raise "Rails Root dir not defined" if _root_dir.nil? ::File.join(_root_dir, '#{name}') end def #{name}_dirpath options={} _root_dir = RailsAssist::Directory::Root.root_dirpath(options) raise "Rails Root dir not defined" if _root_dir.nil? ::File.join(_root_dir, '#{name}') end } end def rails_dir_for type, options={} raise ArgumentError, '#rails_dir_for takes a dir type argument' if !type dir_method = "#{type}_dir" return send(dir_method, options) if respond_to?(dir_method) DIR.send(dir_method, options) if DIR.respond_to?(dir_method) end def app_dir_for type, options={} ::File.join(app_dirpath(options), type.to_s.pluralize) end def config_dir_for type, options={} ::File.join(config_dirpath(options), type.to_s.pluralize) end def public_dir_for type, options={} ::File.join(public_dirpath(options), type.to_s.pluralize) end end include Methods extend Methods end # Directories end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_assist-0.4.2 | lib/rails_assist/directory.rb |