Sha256: 4e91561b6a9409743f047c35a73200c511a78819e3c254bcd1ff5ea81a2e2d55

Contents?: true

Size: 939 Bytes

Versions: 2

Compression:

Stored size: 939 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

2 entries across 2 versions & 1 rubygems

Version Path
bivouac-0.2.5 lib/bivouac.rb
bivouac-0.2.4 lib/bivouac.rb