rbbt-util 5.26.147 → 5.26.148

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1896ce13e6cb3eb66dae38e32281efd3e41d28812297eb03cbb0c70e568b1ea8
4
- data.tar.gz: 81cd7eae5d7c4f9960a448bf9478c482061b215b5d050212a136078eb9dcf396
3
+ metadata.gz: bf3004b4e61c1bd21d810ca71531a16c1fdfc7f1378ad611066adc769889eb19
4
+ data.tar.gz: f2d1291cda6e4624a748fe183813ef1db0d5bba9839bb68da5925b7412728206
5
5
  SHA512:
6
- metadata.gz: bb1cf75feadaf35b81d7af01d001dc7f5241d4c1ab5942318f40b94c9e7c0dd79fe0eec6c28bc1182270429874882af1fad2ba5b47559bba5cf1cf62417db66e
7
- data.tar.gz: 991c0cc027d9f901eea39d691848d2846a4161676ff7f3cc08db337785019fa7195e358e82572c946ca56fd5cd00d5b24c34842124e8b8ee20c8ac9bcf39e454
6
+ metadata.gz: 613b76e53fd61498015a0a9d21a138235691e1d34caa099bd2c7704839901b8052283bba59aba507991aea2c0c346d7f611812221597caba2e651a832829d362
7
+ data.tar.gz: 4a42b2057154f9ffea5473d31516fb56eb5d2a5c591d15a5f303fb6da102b2b99b4af3ade7018cba14027e8672e5e5da104dc2589970ebe138dc05ae2fb1dc90
@@ -8,6 +8,8 @@ module Rbbt::Config
8
8
  GOT_KEYS=[]
9
9
 
10
10
  def self.add_entry(key, value, tokens)
11
+ tokens = [tokens] unless Array === tokens
12
+ tokens << "key:#{key}" unless tokens.include?("key:#{key}")
11
13
  CACHE[key.to_s] ||= []
12
14
  CACHE[key.to_s] << [tokens, value]
13
15
  end
@@ -16,8 +18,7 @@ module Rbbt::Config
16
18
  Log.debug "Loading file: #{ file }"
17
19
  TSV.traverse file, :type => :array do |line|
18
20
  next if line =~ /^#/
19
- key, value, *tokens = line.split(/\s/)
20
- tokens << "key:#{key}"
21
+ key, value, *tokens = line.strip.split(/\s/)
21
22
 
22
23
  self.add_entry(key, value, tokens) if key
23
24
  end
@@ -65,16 +66,18 @@ module Rbbt::Config
65
66
  [token, priority]
66
67
  end
67
68
 
68
- def self.match(entries, token)
69
+ def self.match(entries, give_token)
69
70
  priorities = {}
70
71
  entries.each do |tokens, value|
71
72
  best_prio = nil
72
73
  tokens = [tokens] unless Array === tokens
73
74
  tokens.each do |tok|
74
75
  tok, prio = token_priority tok
76
+ next unless tok == give_token
77
+
75
78
  best_prio = prio if best_prio.nil? or best_prio > prio
76
79
  next if prio > best_prio
77
- next unless tok == token
80
+
78
81
  priorities[prio] ||= []
79
82
  priorities[prio].unshift value
80
83
  end
@@ -64,6 +64,7 @@ module Workflow
64
64
  end
65
65
 
66
66
  FORGET_DEP_TASKS = ENV["RBBT_FORGET_DEP_TASKS"] == "true"
67
+ REMOVE_DEP_TASKS = ENV["RBBT_REMOVE_DEP_TASKS"] == "true"
67
68
  def dep_task(name, workflow, oname, *rest, &block)
68
69
  dep(workflow, oname, *rest, &block)
69
70
  extension workflow.tasks[oname].extension if workflow.tasks.include?(oname) unless @extension
@@ -73,11 +74,18 @@ module Workflow
73
74
  set_info :result_type, dep.info[:result_type]
74
75
  forget = config :forget_dep_tasks, :forget_dep_tasks, :default => FORGET_DEP_TASKS
75
76
  if forget
77
+ remove = config :remove_dep_tasks, :remove_dep_tasks, :default => REMOVE_DEP_TASKS
76
78
  self.archive_deps
77
79
  self.dependencies = self.dependencies - [dep]
78
80
  Open.rm_rf self.files_dir if Open.exist? self.files_dir
79
81
  FileUtils.cp_r dep.files_dir, self.files_dir if Open.exist? dep.files_dir
80
82
  Open.ln_h dep.path, self.tmp_path
83
+ case remove.to_s
84
+ when 'true'
85
+ dep.clean
86
+ when 'recursive'
87
+ dep.recursive_clean
88
+ end
81
89
  else
82
90
  Open.rm_rf self.files_dir
83
91
  Open.link dep.files_dir, self.files_dir
@@ -4,13 +4,25 @@ require 'rbbt/util/config'
4
4
  class TestConfig < Test::Unit::TestCase
5
5
  def setup
6
6
  Rbbt::Config.set({:cpus => 30}, :test_config, :test)
7
- Rbbt::Config.set(:cpus , 5, "slow::2", :test)
7
+ Rbbt::Config.set(:cpus, 5, "slow::2", :test)
8
+ Rbbt::Config.set({:token => "token"}, "token", "key:token")
9
+ Rbbt::Config.set(:notoken, "no_token")
8
10
  end
9
11
 
10
12
  def test_simple
11
13
  assert_equal 30, Rbbt::Config.get(:cpus, :test_config)
12
14
  end
13
15
 
16
+ def test_match
17
+ assert_equal({20 => ["token"]}, Rbbt::Config.match({["key:token"] => "token"}, "key:token"))
18
+ end
19
+
20
+ def test_simple_no_token
21
+ assert_equal "token", Rbbt::Config.get("token", "token")
22
+ assert_equal "token", Rbbt::Config.get("token")
23
+ assert_equal "no_token", Rbbt::Config.get("notoken")
24
+ end
25
+
14
26
  def test_prio
15
27
  assert_equal 5, Rbbt::Config.get(:cpus, :slow, :test)
16
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.26.147
4
+ version: 5.26.148
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-01 00:00:00.000000000 Z
11
+ date: 2020-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake