scout-essentials 1.3.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.vimproject +33 -1
  3. data/VERSION +1 -1
  4. data/lib/scout/annotation/annotated_object.rb +69 -0
  5. data/lib/scout/annotation/annotation_module.rb +59 -0
  6. data/lib/scout/annotation/array.rb +74 -0
  7. data/lib/scout/annotation.rb +45 -0
  8. data/lib/scout/concurrent_stream.rb +4 -1
  9. data/lib/scout/config.rb +3 -3
  10. data/lib/scout/exceptions.rb +2 -1
  11. data/lib/scout/indiferent_hash/options.rb +2 -1
  12. data/lib/scout/log/color.rb +1 -1
  13. data/lib/scout/log.rb +11 -11
  14. data/lib/scout/misc/digest.rb +39 -8
  15. data/lib/scout/misc/filesystem.rb +23 -0
  16. data/lib/scout/misc/format.rb +32 -0
  17. data/lib/scout/misc/helper.rb +37 -0
  18. data/lib/scout/misc/math.rb +109 -0
  19. data/lib/scout/misc/system.rb +18 -2
  20. data/lib/scout/misc.rb +1 -0
  21. data/lib/scout/named_array.rb +8 -6
  22. data/lib/scout/open/remote.rb +8 -3
  23. data/lib/scout/open/stream.rb +5 -1
  24. data/lib/scout/open/util.rb +1 -1
  25. data/lib/scout/path/find.rb +30 -8
  26. data/lib/scout/path/util.rb +1 -1
  27. data/lib/scout/path.rb +10 -4
  28. data/lib/scout/persist/open.rb +1 -1
  29. data/lib/scout/persist/serialize.rb +5 -1
  30. data/lib/scout/persist.rb +49 -20
  31. data/lib/scout/resource/path.rb +1 -1
  32. data/lib/scout/resource/scout.rb +2 -0
  33. data/lib/scout/resource/util.rb +8 -3
  34. data/lib/scout/resource.rb +15 -3
  35. data/scout-essentials.gemspec +21 -13
  36. data/test/scout/annotation/test_annotated_object.rb +0 -0
  37. data/test/scout/annotation/test_array.rb +119 -0
  38. data/test/scout/misc/test_digest.rb +54 -0
  39. data/test/scout/misc/test_filesystem.rb +28 -0
  40. data/test/scout/misc/test_helper.rb +14 -0
  41. data/test/scout/misc/test_math.rb +9 -0
  42. data/test/scout/path/test_find.rb +32 -0
  43. data/test/scout/test_annotation.rb +169 -0
  44. data/test/scout/test_persist.rb +17 -1
  45. data/test/scout/test_resource.rb +8 -8
  46. metadata +13 -5
  47. data/lib/scout/meta_extension.rb +0 -101
  48. data/test/scout/test_meta_extension.rb +0 -80
@@ -0,0 +1,109 @@
1
+ module Misc
2
+
3
+ Log2Multiplier = 1.0 / Math.log(2.0)
4
+ Log10Multiplier = 1.0 / Math.log(10.0)
5
+ def self.log2(x)
6
+ Math.log(x) * Log2Multiplier
7
+ end
8
+
9
+ def self.log10(x)
10
+ Math.log(x) * Log10Multiplier
11
+ end
12
+
13
+ def self.max(list)
14
+ max = nil
15
+ list.each do |v|
16
+ next if v.nil?
17
+ max = v if max.nil? or v > max
18
+ end
19
+ max
20
+ end
21
+
22
+ def self.min(list)
23
+ min = nil
24
+ list.each do |v|
25
+ next if v.nil?
26
+ min = v if min.nil? or v < min
27
+ end
28
+ min
29
+ end
30
+
31
+ def self.std_num_vector(v, min, max)
32
+ v_min = Misc.min(v)
33
+ v_max = Misc.max(v)
34
+ v_range = v_max - v_min
35
+ range = max.to_f - min.to_f
36
+
37
+ v.collect{|e| (e.nil? || e.nan?) ? e : min + range * (e.to_f - v_min) / v_range }
38
+ end
39
+
40
+ def self.sum(list)
41
+ list.compact.inject(0.0){|acc,e| acc += e }
42
+ end
43
+
44
+ def self.mean(list)
45
+ sum(list.compact.collect{|v| v.to_f } ) / list.compact.length
46
+ end
47
+
48
+ def self.median(array)
49
+ sorted = array.sort
50
+ len = sorted.length
51
+ (sorted[(len - 1) / 2] + sorted[len / 2]).to_f / 2
52
+ end
53
+
54
+ def self.variance(list)
55
+ return nil if list.length < 3
56
+ mean = mean(list)
57
+ list = list.compact
58
+ list_length = list.length
59
+
60
+ total_square_distance = 0.0
61
+ list.each do |value|
62
+ distance = value.to_f - mean
63
+ total_square_distance += distance * distance
64
+ end
65
+
66
+ total_square_distance / (list_length - 1)
67
+ end
68
+
69
+
70
+ def self.sd(list)
71
+ return nil if list.length < 3
72
+ variance = self.variance(list)
73
+ Math.sqrt(variance)
74
+ end
75
+
76
+ def self.counts(array)
77
+ counts = {}
78
+ array.each do |e|
79
+ counts[e] ||= 0
80
+ counts[e] += 1
81
+ end
82
+
83
+ counts
84
+ end
85
+
86
+ def self.proportions(array)
87
+ total = array.length
88
+
89
+ proportions = Hash.new 0
90
+
91
+ array.each do |e|
92
+ proportions[e] += 1.0 / total
93
+ end
94
+
95
+ class << proportions; self; end.class_eval do
96
+ def to_s
97
+ sort{|a,b| a[1] == b[1] ? a[0] <=> b[0] : a[1] <=> b[1]}.collect{|k,c| "%3d\t%s" % [c, k]} * "\n"
98
+ end
99
+ end
100
+
101
+ proportions
102
+ end
103
+
104
+ def self.zscore(e, list)
105
+ m = Misc.mean(list)
106
+ sd = Misc.sd(list)
107
+ (e.to_f - m) / sd
108
+ end
109
+ end
@@ -13,6 +13,22 @@ module Misc
13
13
  Sys::ProcTable.ps.select{ |pe| pe.ppid == ppid }
14
14
  end
15
15
 
16
+ def self.wait_child(pid)
17
+ begin
18
+ Process.waitpid2 pid.to_i
19
+ rescue Errno::ECHILD
20
+ end
21
+ end
22
+
23
+ def self.abort_child(pid, wait = true)
24
+ begin
25
+ Process.kill("TERM", pid.to_i)
26
+ wait_child(pid) if wait
27
+ rescue
28
+ Log.debug("Process #{pid} was not killed: #{$!.message}")
29
+ end
30
+ end
31
+
16
32
  def self.env_add(var, value, sep = ":", prepend = true)
17
33
  if ENV[var].nil?
18
34
  ENV[var] = value
@@ -37,8 +53,8 @@ module Misc
37
53
  end
38
54
  end
39
55
 
40
- def self.update_git(gem_name = 'scout-gear')
41
- gem_name = 'scout-gear' if gem_name.nil?
56
+ def self.update_git(gem_name = 'scout-essentials')
57
+ gem_name = 'scout-essentials' if gem_name.nil?
42
58
  dir = File.join(__dir__, '../../../../', gem_name)
43
59
  return unless Open.exist?(dir)
44
60
  Misc.in_dir dir do
data/lib/scout/misc.rb CHANGED
@@ -5,6 +5,7 @@ require_relative 'misc/filesystem'
5
5
  require_relative 'misc/monitor'
6
6
  require_relative 'misc/system'
7
7
  require_relative 'misc/helper'
8
+ require_relative 'misc/math'
8
9
 
9
10
  module Misc
10
11
  end
@@ -1,7 +1,7 @@
1
- require_relative 'meta_extension'
1
+ require_relative 'annotation'
2
2
  module NamedArray
3
- extend MetaExtension
4
- extension_attr :fields, :key
3
+ extend Annotation
4
+ annotation :fields, :key
5
5
 
6
6
  def all_fields
7
7
  [key, fields].compact.flatten
@@ -9,9 +9,11 @@ module NamedArray
9
9
 
10
10
  def self.field_match(field, name)
11
11
  if (String === field) && (String === name)
12
- field == name ||
13
- field.start_with?(name) || field.include?("(" + name + ")") ||
14
- name.start_with?(field) || name.include?("(" + field + ")")
12
+ return true if field == name
13
+ return true if field.include?("(" + name + ")")
14
+ return true if name.include?("(" + field + ")")
15
+ return true if field.start_with?(name + " ")
16
+ return true if name.start_with?(field + " ")
15
17
  else
16
18
  field == name
17
19
  end
@@ -87,7 +87,12 @@ module Open
87
87
  end
88
88
 
89
89
  def self.download(url, file)
90
- CMD.cmd_log(:wget, "'#{url}' -O '#{file}'")
90
+ begin
91
+ CMD.cmd_log(:wget, "'#{url}' -O '#{file}'")
92
+ rescue
93
+ FileUtils.rm(file) if File.exist?(file)
94
+ raise $!
95
+ end
91
96
  end
92
97
 
93
98
  def self.digest_url(url, options = {})
@@ -107,7 +112,7 @@ module Open
107
112
  nil
108
113
  end
109
114
  end
110
-
115
+
111
116
  def self.remove_from_cache(url, options = {})
112
117
  filename = cache_file(url, options)
113
118
  if File.exist? filename
@@ -116,7 +121,7 @@ module Open
116
121
  nil
117
122
  end
118
123
  end
119
-
124
+
120
125
  def self.add_cache(url, data, options = {})
121
126
  filename = cache_file(url, options)
122
127
  Open.sensible_write(filename, data, :force => true)
@@ -126,7 +126,11 @@ module Open
126
126
  end
127
127
  end
128
128
  else
129
- File.open(tmp_path, 'wb') do |f| end
129
+ if content.respond_to?(:write_file)
130
+ content.write_file(tmp_path)
131
+ else
132
+ File.open(tmp_path, 'wb') do |f| f.write content.to_s end
133
+ end
130
134
  end
131
135
 
132
136
  begin
@@ -22,7 +22,7 @@ module Open
22
22
  end
23
23
  end
24
24
  else
25
- CMD.cmd("#{GREP_CMD} #{invert ? '-v ' : ''} '#{grep}' -", :in => stream, :pipe => true, :post => proc{begin stream.force_close; rescue Exception; end if stream.respond_to?(:force_close)})
25
+ CMD.cmd("#{GREP_CMD} #{invert ? '-v ' : ''} '#{grep}' -", :in => stream, :nofail => true, :pipe => true, :post => proc{begin stream.force_close; rescue Exception; end if stream.respond_to?(:force_close)})
26
26
  end
27
27
  end
28
28
 
@@ -7,7 +7,7 @@ module Path
7
7
  caller_dup = caller.dup
8
8
  while file = caller_dup.shift
9
9
  break unless file =~ /(?:scout|rbbt)\/(?:resource\.rb|workflow\.rb)/ or
10
- file =~ /(?:scout|rbbt)\/(?:.*\/)?(path|open)\.rb/ or
10
+ file =~ /(?:scout|rbbt)\/(?:.*\/)?(path|open|tsv|refactor)\.rb/ or
11
11
  file =~ /(?:scout|rbbt)\/(?:.*\/)?path\/(?:find|refactor|util)\.rb/ or
12
12
  file =~ /(?:scout|rbbt)\/persist.rb/ or
13
13
  file =~ /scout\/resource\/produce.rb/ or
@@ -33,7 +33,13 @@ module Path
33
33
  end
34
34
 
35
35
  def self.follow(path, map, map_name = nil)
36
- file = map.sub('{PKGDIR}', path.pkgdir.respond_to?(:pkgdir) ? path.pkgdir.pkgdir || Path.default_pkgdir : path.pkgdir || Path.default_pkgdir).
36
+ map = File.join(map, '{PATH}') unless map.include?("{")
37
+ if path.respond_to?(:pkgdir)
38
+ pkgdir = path.pkgdir
39
+ pkgdir = pkgdir.pkgdir while pkgdir.respond_to?(:pkgdir)
40
+ end
41
+ pkgdir = Path.default_pkgdir if pkgdir.nil?
42
+ file = map.sub('{PKGDIR}', pkgdir).
37
43
  sub('{HOME}', ENV["HOME"]).
38
44
  sub('{RESOURCE}', path.pkgdir.to_s).
39
45
  sub('{PWD}', FileUtils.pwd).
@@ -69,7 +75,7 @@ module Path
69
75
  :cache => '/cache/{TOPLEVEL}/{PKGDIR}/{SUBPATH}',
70
76
  :bulk => '/bulk/{TOPLEVEL}/{PKGDIR}/{SUBPATH}',
71
77
  :lib => '{LIBDIR}/{TOPLEVEL}/{SUBPATH}',
72
- :scout_gear => File.join(Path.caller_lib_dir(__FILE__), "{TOPLEVEL}/{SUBPATH}"),
78
+ :scout_essentials => File.join(Path.caller_lib_dir(__FILE__), "{TOPLEVEL}/{SUBPATH}"),
73
79
  :tmp => '/tmp/{PKGDIR}/{TOPLEVEL}/{SUBPATH}',
74
80
  :default => :user
75
81
  })
@@ -84,10 +90,30 @@ module Path
84
90
  end
85
91
 
86
92
  def self.add_path(name, map)
87
- @@path_maps[name] = map
93
+ path_maps[name] = map
88
94
  @@map_order = nil
89
95
  end
90
96
 
97
+ def self.prepend_path(name, map)
98
+ path_maps[name] = map
99
+ map_order.unshift(name.to_sym)
100
+ end
101
+
102
+ def self.append_path(name, map)
103
+ path_maps[name] = map
104
+ map_order.push(name.to_sym)
105
+ end
106
+
107
+ def prepend_path(name, map)
108
+ path_maps[name] = map
109
+ map_order.unshift(name.to_sym)
110
+ end
111
+
112
+ def append_path(name, map)
113
+ path_maps[name] = map
114
+ map_order.push(name.to_sym)
115
+ end
116
+
91
117
  def self.load_path_maps(filename)
92
118
  Path.setup(filename) unless Path === filename
93
119
  if filename.exist?
@@ -135,10 +161,6 @@ module Path
135
161
  @original
136
162
  end
137
163
 
138
- def map_order
139
- @map_order ||= (path_maps.keys & Path.basic_map_order) + (path_maps.keys - Path.basic_map_order)
140
- end
141
-
142
164
  def follow(map_name = :default, annotate = true)
143
165
  IndiferentHash.setup(path_maps)
144
166
  map = path_maps[map_name] || Path.path_maps[map_name]
@@ -64,7 +64,7 @@ module Path
64
64
  end
65
65
 
66
66
  def glob_all(pattern = nil, caller_lib = nil, search_paths = nil)
67
- search_paths ||= Path.path_maps
67
+ search_paths ||= self.path_maps || Path.path_maps
68
68
  search_paths = search_paths.dup
69
69
 
70
70
  search_paths.keys.collect do |where|
data/lib/scout/path.rb CHANGED
@@ -1,11 +1,11 @@
1
- require_relative 'meta_extension'
1
+ require_relative 'annotation'
2
2
  require_relative 'path/find'
3
3
  require_relative 'path/util'
4
4
  require_relative 'path/tmpfile'
5
5
 
6
6
  module Path
7
- extend MetaExtension
8
- extension_attr :pkgdir, :libdir, :path_maps
7
+ extend Annotation
8
+ annotation :pkgdir, :libdir, :path_maps, :map_order
9
9
 
10
10
  def self.default_pkgdir
11
11
  @@default_pkgdir ||= 'scout'
@@ -27,7 +27,13 @@ module Path
27
27
  @path_maps ||= Path.path_maps.dup
28
28
  end
29
29
 
30
- def join(subpath, prevpath = nil)
30
+ def map_order
31
+ @map_order ||= (path_maps.keys & Path.map_order) + (path_maps.keys - Path.map_order)
32
+ end
33
+
34
+ def join(subpath = nil, prevpath = nil)
35
+ return self if subpath.nil?
36
+
31
37
  subpath = subpath.to_s if Symbol === subpath
32
38
  prevpath = prevpath.to_s if Symbol === prevpath
33
39
 
@@ -8,7 +8,7 @@ module Open
8
8
  end
9
9
 
10
10
  def self.yaml(file)
11
- Open.open(file){|f| YAML.load(f) }
11
+ Open.open(file){|f| YAML.unsafe_load(f) }
12
12
  end
13
13
 
14
14
  def self.marshal(file)
@@ -34,6 +34,8 @@ module Persist
34
34
  content.to_json
35
35
  when :marshal
36
36
  Marshal.dump(content)
37
+ when :annotation, :annotations
38
+ Annotation.tsv(content, :all).to_s
37
39
  else
38
40
  if m = type.to_s.match(/(.*)_array/)
39
41
  type = m[1].to_sym
@@ -69,6 +71,8 @@ module Persist
69
71
  JSON.parse(serialized)
70
72
  when :marshal
71
73
  Marshal.load(serialized)
74
+ when :annotation, :annotations
75
+ Annotation.load_tsv(TSV.open(serialized))
72
76
  else
73
77
  if m = type.to_s.match(/(.*)_array/)
74
78
  type = m[1].to_sym
@@ -110,7 +114,7 @@ module Persist
110
114
  f.puts content
111
115
  end
112
116
  content
113
- else
117
+ else
114
118
  serialized = serialize(content, type)
115
119
  Open.sensible_write(file, serialized, :force => true)
116
120
  return nil
data/lib/scout/persist.rb CHANGED
@@ -31,41 +31,65 @@ module Persist
31
31
  def self.persist(name, type = :serializer, options = {}, &block)
32
32
  persist_options = IndiferentHash.pull_keys options, :persist
33
33
  return yield if FalseClass === persist_options[:persist]
34
+
34
35
  file = persist_options[:path] || options[:path] || persistence_path(name, options)
36
+ data = persist_options[:data] || options[:data]
37
+ no_load = persist_options[:no_load] || options[:no_load]
38
+
39
+ update = options[:update] || persist_options[:update]
40
+ update = Open.mtime(update) if Path === update
41
+ update = Open.mtime(file) >= update ? false : true if Time === update
35
42
 
36
43
  if type == :memory
37
44
  repo = options[:memory] || options[:repo] || MEMORY_CACHE
38
- repo[file] ||= yield
45
+ if update
46
+ repo[file] = yield
47
+ else
48
+ repo[file] ||= yield
49
+ end
39
50
  return repo[file]
40
51
  end
41
52
 
42
- update = options[:update] || persist_options[:update]
43
- update = Open.mtime(update) if Path === update
44
- update = Open.mtime(file) >= update ? false : true if Time === update
45
-
46
- lockfile = persist_options[:lockfile] || options[:lockfile] || Persist.persistence_path(file + '.persist', {:dir => Persist.lock_dir})
53
+ lockfile = persist_options[:lockfile] || options[:lockfile] || Persist.persistence_path(file + '.persist', {:dir => Persist.lock_dir}) if String === file
47
54
 
48
55
  Open.lock lockfile do |lock|
49
56
  if Open.exist?(file) && ! update
50
- Persist.load(file, type)
57
+ if TrueClass === no_load
58
+ file
59
+ else
60
+ Persist.load(file, type)
61
+ end
51
62
  else
52
63
  begin
64
+ Open.rm(file.find) if update && Open.exists?(file)
65
+
53
66
  file = file.find if Path === file
54
- return yield(file) if block.arity == 1
55
- res = yield
67
+ if block.arity == 1
68
+ if data
69
+ yield(data)
70
+ res = data
71
+ else
72
+ return yield(file)
73
+ end
74
+ else
75
+ res = yield
76
+ end
56
77
 
57
78
  if res.nil?
58
- if type.nil?
59
- Log.debug "Empty result and no persist type; not loading result file"
60
- return nil
79
+ if no_load
80
+ Log.debug "Empty result and no_load is '#{no_load}'"
81
+ return file
61
82
  else
62
- Log.debug "Empty result; loading #{type} result from file"
63
- return Persist.load(file, type)
83
+ if type.nil?
84
+ Log.debug "Empty result and no persist type; not loading result file"
85
+ return nil
86
+ else
87
+ Log.debug "Empty result; loading #{type} result from file"
88
+ return Persist.load(file, type)
89
+ end
64
90
  end
65
91
  end
66
92
 
67
- Open.rm(file)
68
-
69
93
  if IO === res || StringIO === res
70
94
  tee_copies = options[:tee_copies] || 1
71
95
  main, *copies = Open.tee_stream_thread_multiple res, tee_copies + 1
@@ -90,20 +114,25 @@ module Persist
90
114
  Thread.handle_interrupt(Exception => :never) do
91
115
  if Open.exist?(file)
92
116
  Log.debug "Failed persistence #{file} - erasing"
93
- Open.rm file
117
+ Open.rm_rf file
94
118
  else
95
119
  Log.debug "Failed persistence #{file}"
96
120
  end
97
- end
121
+ end unless DontPersist === $!
98
122
  raise $! unless options[:canfail]
99
123
  end
100
- res
124
+
125
+ if TrueClass === no_load
126
+ file
127
+ else
128
+ res
129
+ end
101
130
  end
102
131
  end
103
132
  end
104
133
 
105
134
  def self.memory(name, options = {}, &block)
106
- options[:persist_path] ||= options[:path] ||= [name, options[:key]].compact * ":"
135
+ options[:persist_path] ||= options[:path] ||= [name, options[:key]].compact * ":" if options[:key]
107
136
  self.persist(name, :memory, options, &block)
108
137
  end
109
138
 
@@ -1,7 +1,7 @@
1
1
  module Path
2
2
  def produce(force = false)
3
3
  raise @produced if Exception === @produced
4
- return self if ! force && (Open.exist?(self) || @produced)
4
+ return self if ! force && (Open.exist?(self.find) || @produced)
5
5
  begin
6
6
  if Resource === self.pkgdir
7
7
  self.pkgdir.produce self, force
@@ -1,5 +1,7 @@
1
1
  module Scout
2
2
  extend Resource
3
+
4
+ self.pkgdir = 'scout'
3
5
  end
4
6
 
5
7
  Path.load_path_maps(Scout.etc["path_maps"])
@@ -20,19 +20,24 @@ module Resource
20
20
  if String === pattern and pattern.include?('{')
21
21
  regexp = "^" + pattern
22
22
  .gsub(/{(TOPLEVEL)}/,'(?<\1>[^/]+)')
23
- .gsub(/{([^}]+)}/,'(?<\1>[^/]+)?') +
24
- "(?:/(?<REST>.*))?/?$"
23
+ .gsub(/\.{(PKGDIR)}/,'\.(?<\1>[^/]+)')
24
+ .gsub(/\/{([^}]+)}/,'(?:/(?<\1>[^/]+))?') +
25
+ "(?:/(?<REST>.+))?/?$"
25
26
  if m = path.match(regexp)
26
27
  if ! m.named_captures.include?("PKGDIR") || m["PKGDIR"] == self.pkgdir
28
+
27
29
  unlocated = %w(TOPLEVEL SUBPATH PATH REST).collect{|c|
28
30
  m.named_captures.include?(c) ? m[c] : nil
29
31
  }.compact * "/"
32
+
30
33
  unlocated.gsub!(/\/+/,'/')
34
+
31
35
  if self.subdir && ! self.subdir.empty?
32
36
  subdir = self.subdir
33
37
  subdir += "/" unless subdir.end_with?("/")
34
38
  unlocated[subdir] = ""
35
39
  end
40
+
36
41
  choices << self.annotate(unlocated)
37
42
  end
38
43
  end
@@ -46,7 +51,7 @@ module Resource
46
51
 
47
52
  def self.identify(path)
48
53
  resource = path.pkgdir if Path === path
49
- resource = Scout unless Resource === resource
54
+ resource = Resource.default_resource unless Resource === resource
50
55
  unlocated = resource.identify path
51
56
  end
52
57
 
@@ -7,13 +7,25 @@ require_relative 'resource/util'
7
7
  require_relative 'resource/software'
8
8
 
9
9
  module Resource
10
- extend MetaExtension
11
- extension_attr :pkgdir, :libdir, :subdir, :resources, :rake_dirs, :path_maps, :lock_dir
10
+ extend Annotation
11
+ annotation :pkgdir, :libdir, :subdir, :resources, :rake_dirs, :path_maps, :map_order, :lock_dir
12
+
13
+ class << Resource
14
+ attr_accessor :default_resource
15
+
16
+ def default_resource
17
+ @default_resource ||= Scout
18
+ end
19
+ end
12
20
 
13
21
  def self.default_lock_dir
14
22
  Path.setup('tmp/produce_locks').find
15
23
  end
16
24
 
25
+ def path_maps
26
+ @path_maps ||= Path.path_maps.dup
27
+ end
28
+
17
29
  def subdir
18
30
  @subdir ||= ""
19
31
  end
@@ -27,7 +39,7 @@ module Resource
27
39
  end
28
40
 
29
41
  def root
30
- Path.setup(subdir, self, self.libdir, @path_maps)
42
+ Path.setup(subdir.dup, self, self.libdir, @path_maps, @map_order)
31
43
  end
32
44
 
33
45
  def method_missing(name, prev = nil, *args)