Sha256: d9750ae50a78183fec10b52ea3a62a5d42b4b4f30f7848e24807ac694a19076f

Contents?: true

Size: 666 Bytes

Versions: 19

Compression:

Stored size: 666 Bytes

Contents

module Tork
  # Loads all Ruby scripts found having the given name in (1) the directories
  # specified in the TORK_CONFIGS environment variable, (2) the subdirectories
  # of lib/tork/config/, and (3) the user's .tork/ directory; in that order.
  #
  # @return [Array] paths of Ruby scripts that were loaded
  #
  def self.config name
    dirs = ENV['TORK_CONFIGS'].strip.split(/:+/).reject(&:empty?).uniq.
           map {|dir| [dir, __FILE__.sub(/\.rb$/, "/#{dir}")] }.flatten

    Dir["{#{dirs.join(',')},.tork}/#{name}.rb"].each {|script| load script }
  end
end

ENV['TORK_CONFIGS'] ||= 'default'.freeze # ENV values come frozen by default
Tork.config :config

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
tork-19.8.2 lib/tork/config.rb
tork-19.8.1 lib/tork/config.rb
tork-19.8.0 lib/tork/config.rb
tork-19.7.0 lib/tork/config.rb
tork-19.6.1 lib/tork/config.rb
tork-19.6.0 lib/tork/config.rb
tork-19.5.1 lib/tork/config.rb
tork-19.5.0 lib/tork/config.rb
tork-19.4.0 lib/tork/config.rb
tork-19.3.2 lib/tork/config.rb
tork-19.3.1 lib/tork/config.rb
tork-19.3.0 lib/tork/config.rb
tork-19.2.2 lib/tork/config.rb
tork-19.2.1 lib/tork/config.rb
tork-19.2.0 lib/tork/config.rb
tork-19.1.0 lib/tork/config.rb
tork-19.0.2 lib/tork/config.rb
tork-19.0.1 lib/tork/config.rb
tork-19.0.0 lib/tork/config.rb