Module: Ripe::Library
- Defined in:
- lib/ripe/library.rb
Overview
This singleton class represents a library containing all the components accessible to ripe (tasks and workflows) based on what is contained in the RIPELIB environment variable.
Class Method Summary collapse
-
.find(comp, filename) ⇒ String?
Search throughout the library for a task or workflow component by the name of
handle. -
.paths ⇒ List
Provide a list of search paths.
Class Method Details
.find(comp, filename) ⇒ String?
Search throughout the library for a task or workflow component by the name of handle. When there is more than one match, give precendence to component whose path is declared first.
34 35 36 37 38 39 40 41 |
# File 'lib/ripe/library.rb', line 34 def find(comp, filename) search = paths.map do |path| file = "#{path}/#{comp}s/#{filename}" (File.exists? file) ? file : nil end search.compact.first end |
.paths ⇒ List
Provide a list of search paths
17 18 19 20 21 |
# File 'lib/ripe/library.rb', line 17 def paths # Prepend the working directory to the list of paths so that the # working directory is always looked in first. "#{Dir.pwd}/#{Repo::REPOSITORY_PATH}:#{ENV['RIPELIB']}".split(/:/) end |