Sha256: 109e379f7f2c5c9eaf0728cdd2b019cb855be9e99f3b3f86bef6b0bf3633eb89

Contents?: true

Size: 941 Bytes

Versions: 3

Compression:

Stored size: 941 Bytes

Contents

module Bivouac
  @@_plugins_view_helpers = []
  @@_plugins_controller_helpers = []
  
  def files( xPath, *options, &block )
    path = File.dirname($0) + "/" + xPath.to_s + "/*.rb"
    if ENV['BIVOUAC_ROOT']
      path = ENV['BIVOUAC_ROOT'] + "/app/" + xPath.to_s + "/*.rb"
    end
    
    Dir[path].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

3 entries across 3 versions & 1 rubygems

Version Path
bivouac-0.2.1 lib/bivouac.rb
bivouac-0.2.2 lib/bivouac.rb
bivouac-0.2.3 lib/bivouac.rb