Sha256: bbc62b24adbaabc77e28794e10b2328f756d5da2bb1f1bb6b22d2f6ae3be0503

Contents?: true

Size: 935 Bytes

Versions: 1

Compression:

Stored size: 935 Bytes

Contents

module Bivouac
  @@_plugins_view_helpers = []
  @@_plugins_controller_helpers = []
  
  def files( xPath, *options, &block )
    path = File.dirname($0) + "/" + xPath.to_s
    if ENV['BIVOUAC_ROOT']
      path = ENV['BIVOUAC_ROOT'] + "/app/" + xPath.to_s
    end

    Dir.glob("#{path}/**/*.rb").each do |file|
      if options[0]
        if options[0].keys.include?( :except ) 
          if options[0][:except].include?(File.basename(file)) == false
            yield( file )
          end
        end
      else
        yield( file )
      end
    end
  end
  
  def addViewHelperModule( m )
    @@_plugins_view_helpers << m
  end
  
  def viewHelperModule
    @@_plugins_view_helpers
  end

  def addControllerHelperModule( m )
    @@_plugins_view_helpers << m
  end
  
  def controllerHelperModule
    @@_plugins_view_helpers
  end
  
  def filePath( from, *data )
    File.join File.expand_path(File.dirname(from)), data
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bivouac-0.3.0 lib/bivouac.rb