Module: UpAndRunning::FeatureResolver
Instance Method Summary collapse
- #load_path ⇒ Object
-
#resolve(name) ⇒ Object
Returns the matching compiler TODO - abstract both compiler and templates into feature.
Instance Method Details
#load_path ⇒ Object
26 27 28 29 30 31 |
# File 'lib/up_and_running.rb', line 26 def load_path @load_path ||= begin lp = (ENV['UP_AND_RUNNING_FEATURE_LOAD_PATH'] || []).split(':') lp << File.('~/.up_and_running/features') end end |
#resolve(name) ⇒ Object
Returns the matching compiler TODO - abstract both compiler and templates into feature
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/up_and_running.rb', line 13 def resolve(name) load_path.find do |dir| next unless Dir.exists?(dir) filename = File.join(dir, "#{name}.rb") if File.exists?(filename) load filename const_name = File.basename(filename).sub(/\.rb$/, '').split('_').map(&:capitalize).join return Compilers.const_get(const_name) end end raise "Couldn't find feature for #{name}" end |