Skip to content

Commit

Permalink
config: auto-detect $TORK_CONFIGS values only once
Browse files Browse the repository at this point in the history
  • Loading branch information
sunaku committed Aug 6, 2014
1 parent 96f4fd3 commit afe3778
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 4 deletions.
5 changes: 5 additions & 0 deletions lib/tork/config.rb
Expand Up @@ -15,3 +15,8 @@ def self.config name, search_path=ENV['TORK_CONFIGS']

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

unless ENV['TORK_CONFIGS_DETECTED'] =~ /\S/
ENV['TORK_CONFIGS_DETECTED'] = $0
Tork.config :detect, '*'
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions lib/tork/config/spec/config.rb
@@ -1,4 +1,2 @@
$tork_config_spec_glob = '**/{spec_*,*_spec}.rb'
$tork_config_spec_grep = %r{.*(\bspec_[^/]+|[^/]+_spec)\.rb$}

ENV['TORK_CONFIGS'] += ':spec' if Dir['spec/', $tork_config_spec_glob].any?
1 change: 1 addition & 0 deletions lib/tork/config/spec/detect.rb
@@ -0,0 +1 @@
ENV['TORK_CONFIGS'] += ':spec' if Dir['spec/', $tork_config_spec_glob].any?
2 changes: 0 additions & 2 deletions lib/tork/config/test/config.rb
Expand Up @@ -6,5 +6,3 @@

$tork_config_test_glob = "**/{#{labels_glob}_*,*_#{labels_glob}}.rb"
$tork_config_test_grep = %r{.*(\b#{labels_grep}_[^/]+|[^/]+_#{labels_grep})\.rb$}

ENV['TORK_CONFIGS'] += ':test' if Dir['test/', $tork_config_test_glob].any?
1 change: 1 addition & 0 deletions lib/tork/config/test/detect.rb
@@ -0,0 +1 @@
ENV['TORK_CONFIGS'] += ':test' if Dir['test/', $tork_config_test_glob].any?

0 comments on commit afe3778

Please sign in to comment.