Sha256: 407688eda6103b6cb5cbc1140f9588128e3d798d6020dee2d55f311228d9df41

Contents?: true

Size: 1.82 KB

Versions: 4

Compression:

Stored size: 1.82 KB

Contents

module RailsAssist::Artifact
  module Directory
    module Methods
      DIR = RailsAssist::Directory
      APP_DIR = RailsAssist::Directory::App
      
      # :controller, :mailer, :helper, :view, :model, :permit
      #
      # controller_dir, mailer_dir ...
      RailsAssist::Artifact.app_artifacts.each do |name|
        class_eval %{
          def #{name}_dirpath options={}
            _app_dirpath = APP_DIR.app_dirpath(options)
            [_app_dirpath, '#{name.to_s.pluralize}'].file_join
          end

          def #{name}_dir options={}
            #{name}_dirpath(options).dir
          end
        } 
      end    
        
      # initializer_dir, locale_dir
      # stylesheet_dir, javascript_dir    
      {:config => RailsAssist.specials(:config), :public => RailsAssist.specials(:public)}.each_pair do |container, names|
        names.each do |name|
          class_eval %{      
            def #{name}_dirpath options={}
              RailsAssist::Directory.#{container}_dir_for(:#{name.to_s.pluralize}, options).path
            end  

            def #{name}_dir options={}
              #{name}_dirpath(options).dir
            end
          }
        end
      end

      [:stylesheet, :javascript].each do |name|
        class_eval %{      
          def #{name}_dirpath options={}
            RailsAssist::Directory.public_dir_for(:#{name.to_s.pluralize}, options).path
          end
        }
      end
      
      def migration_dirpath options={}
        [DIR.db_dirpath(options), 'migrate'].file_join
      end

      def migration_dir options={}
        migration_dirpath(options).dir
      end
      
      def observer_dirpath options={}
        model_dir(options).path
      end

      def observer_dir options={}
        observer_dirpath(options).dir
      end
    end

    extend Methods
    include Methods
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails_assist-0.5.2 lib/rails_assist/artifact/directory.rb
rails_assist-0.5.1 lib/rails_assist/artifact/directory.rb
rails_assist-0.5.0 lib/rails_assist/artifact/directory.rb
rails_assist-0.4.4 lib/rails_assist/artifact/directory.rb