scout-essentials 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.vimproject +33 -1
- data/VERSION +1 -1
- data/lib/scout/annotation/annotated_object.rb +69 -0
- data/lib/scout/annotation/annotation_module.rb +59 -0
- data/lib/scout/annotation/array.rb +74 -0
- data/lib/scout/annotation.rb +45 -0
- data/lib/scout/concurrent_stream.rb +4 -1
- data/lib/scout/config.rb +3 -3
- data/lib/scout/exceptions.rb +2 -1
- data/lib/scout/indiferent_hash/options.rb +2 -1
- data/lib/scout/log/color.rb +1 -1
- data/lib/scout/log.rb +11 -11
- data/lib/scout/misc/digest.rb +39 -8
- data/lib/scout/misc/filesystem.rb +23 -0
- data/lib/scout/misc/format.rb +32 -0
- data/lib/scout/misc/helper.rb +37 -0
- data/lib/scout/misc/math.rb +109 -0
- data/lib/scout/misc/system.rb +2 -2
- data/lib/scout/misc.rb +1 -0
- data/lib/scout/named_array.rb +8 -6
- data/lib/scout/open/remote.rb +8 -3
- data/lib/scout/open/stream.rb +5 -1
- data/lib/scout/open/util.rb +1 -1
- data/lib/scout/path/find.rb +18 -6
- data/lib/scout/path/util.rb +1 -1
- data/lib/scout/path.rb +10 -4
- data/lib/scout/persist/open.rb +1 -1
- data/lib/scout/persist/serialize.rb +6 -2
- data/lib/scout/persist.rb +49 -20
- data/lib/scout/resource/path.rb +1 -1
- data/lib/scout/resource/scout.rb +2 -0
- data/lib/scout/resource/util.rb +8 -3
- data/lib/scout/resource.rb +15 -3
- data/scout-essentials.gemspec +21 -13
- data/test/scout/annotation/test_annotated_object.rb +0 -0
- data/test/scout/annotation/test_array.rb +119 -0
- data/test/scout/misc/test_digest.rb +54 -0
- data/test/scout/misc/test_filesystem.rb +28 -0
- data/test/scout/misc/test_helper.rb +14 -0
- data/test/scout/misc/test_math.rb +9 -0
- data/test/scout/path/test_find.rb +32 -0
- data/test/scout/test_annotation.rb +169 -0
- data/test/scout/test_persist.rb +17 -1
- data/test/scout/test_resource.rb +8 -8
- metadata +13 -5
- data/lib/scout/meta_extension.rb +0 -101
- 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
|
data/lib/scout/misc/system.rb
CHANGED
@@ -37,8 +37,8 @@ module Misc
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
def self.update_git(gem_name = 'scout-
|
41
|
-
gem_name = 'scout-
|
40
|
+
def self.update_git(gem_name = 'scout-essentials')
|
41
|
+
gem_name = 'scout-essentials' if gem_name.nil?
|
42
42
|
dir = File.join(__dir__, '../../../../', gem_name)
|
43
43
|
return unless Open.exist?(dir)
|
44
44
|
Misc.in_dir dir do
|
data/lib/scout/misc.rb
CHANGED
data/lib/scout/named_array.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require_relative '
|
1
|
+
require_relative 'annotation'
|
2
2
|
module NamedArray
|
3
|
-
extend
|
4
|
-
|
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
|
-
|
14
|
-
|
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
|
data/lib/scout/open/remote.rb
CHANGED
@@ -87,7 +87,12 @@ module Open
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def self.download(url, file)
|
90
|
-
|
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)
|
data/lib/scout/open/stream.rb
CHANGED
@@ -126,7 +126,11 @@ module Open
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
else
|
129
|
-
|
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
|
data/lib/scout/open/util.rb
CHANGED
@@ -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
|
|
data/lib/scout/path/find.rb
CHANGED
@@ -33,7 +33,13 @@ module Path
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.follow(path, map, map_name = nil)
|
36
|
-
|
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
|
-
:
|
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
|
})
|
@@ -88,6 +94,16 @@ module Path
|
|
88
94
|
@@map_order = nil
|
89
95
|
end
|
90
96
|
|
97
|
+
def prepend_path(name, map)
|
98
|
+
@@path_maps[name] = map
|
99
|
+
map_order.unshift(name.to_sym)
|
100
|
+
end
|
101
|
+
|
102
|
+
def append_path(name, map)
|
103
|
+
@@path_maps[name] = map
|
104
|
+
map_order.push(name.to_sym)
|
105
|
+
end
|
106
|
+
|
91
107
|
def self.load_path_maps(filename)
|
92
108
|
Path.setup(filename) unless Path === filename
|
93
109
|
if filename.exist?
|
@@ -135,10 +151,6 @@ module Path
|
|
135
151
|
@original
|
136
152
|
end
|
137
153
|
|
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
154
|
def follow(map_name = :default, annotate = true)
|
143
155
|
IndiferentHash.setup(path_maps)
|
144
156
|
map = path_maps[map_name] || Path.path_maps[map_name]
|
data/lib/scout/path/util.rb
CHANGED
data/lib/scout/path.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
require_relative '
|
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
|
8
|
-
|
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
|
30
|
+
def map_order
|
31
|
+
@map_order ||= (path_maps.keys & Path.basic_map_order) + (path_maps.keys - Path.basic_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
|
|
data/lib/scout/persist/open.rb
CHANGED
@@ -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
|
-
|
117
|
+
else
|
114
118
|
serialized = serialize(content, type)
|
115
119
|
Open.sensible_write(file, serialized, :force => true)
|
116
120
|
return nil
|
@@ -144,7 +148,7 @@ module Persist
|
|
144
148
|
when :file
|
145
149
|
value = Open.read(file)
|
146
150
|
value.sub!(/^\./, File.dirname(file)) if value.start_with?("./")
|
147
|
-
if
|
151
|
+
if Path.is_filename?(value)
|
148
152
|
value
|
149
153
|
else
|
150
154
|
file
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
55
|
-
|
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
|
59
|
-
Log.debug "Empty result and
|
60
|
-
return
|
79
|
+
if no_load
|
80
|
+
Log.debug "Empty result and no_load is '#{no_load}'"
|
81
|
+
return file
|
61
82
|
else
|
62
|
-
|
63
|
-
|
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.
|
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
|
-
|
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
|
|
data/lib/scout/resource/path.rb
CHANGED
@@ -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
|
data/lib/scout/resource/scout.rb
CHANGED
data/lib/scout/resource/util.rb
CHANGED
@@ -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(
|
24
|
-
|
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 =
|
54
|
+
resource = Resource.default_resource unless Resource === resource
|
50
55
|
unlocated = resource.identify path
|
51
56
|
end
|
52
57
|
|
data/lib/scout/resource.rb
CHANGED
@@ -7,13 +7,25 @@ require_relative 'resource/util'
|
|
7
7
|
require_relative 'resource/software'
|
8
8
|
|
9
9
|
module Resource
|
10
|
-
extend
|
11
|
-
|
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, self, self.libdir, @path_maps, @map_order)
|
31
43
|
end
|
32
44
|
|
33
45
|
def method_missing(name, prev = nil, *args)
|
data/scout-essentials.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: scout-essentials 1.
|
5
|
+
# stub: scout-essentials 1.4.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "scout-essentials".freeze
|
9
|
-
s.version = "1.
|
9
|
+
s.version = "1.4.0".freeze
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Miguel Vazquez".freeze]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2024-05-15"
|
15
15
|
s.description = "Things a scout can use anywhere".freeze
|
16
16
|
s.email = "mikisvaz@gmail.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -27,6 +27,10 @@ Gem::Specification.new do |s|
|
|
27
27
|
"Rakefile",
|
28
28
|
"VERSION",
|
29
29
|
"lib/scout-essentials.rb",
|
30
|
+
"lib/scout/annotation.rb",
|
31
|
+
"lib/scout/annotation/annotated_object.rb",
|
32
|
+
"lib/scout/annotation/annotation_module.rb",
|
33
|
+
"lib/scout/annotation/array.rb",
|
30
34
|
"lib/scout/cmd.rb",
|
31
35
|
"lib/scout/concurrent_stream.rb",
|
32
36
|
"lib/scout/config.rb",
|
@@ -42,13 +46,13 @@ Gem::Specification.new do |s|
|
|
42
46
|
"lib/scout/log/progress/report.rb",
|
43
47
|
"lib/scout/log/progress/util.rb",
|
44
48
|
"lib/scout/log/trap.rb",
|
45
|
-
"lib/scout/meta_extension.rb",
|
46
49
|
"lib/scout/misc.rb",
|
47
50
|
"lib/scout/misc/digest.rb",
|
48
51
|
"lib/scout/misc/filesystem.rb",
|
49
52
|
"lib/scout/misc/format.rb",
|
50
53
|
"lib/scout/misc/helper.rb",
|
51
54
|
"lib/scout/misc/insist.rb",
|
55
|
+
"lib/scout/misc/math.rb",
|
52
56
|
"lib/scout/misc/monitor.rb",
|
53
57
|
"lib/scout/misc/system.rb",
|
54
58
|
"lib/scout/named_array.rb",
|
@@ -85,6 +89,8 @@ Gem::Specification.new do |s|
|
|
85
89
|
"share/color/color_names",
|
86
90
|
"share/color/diverging_colors.hex",
|
87
91
|
"share/software/install_helpers",
|
92
|
+
"test/scout/annotation/test_annotated_object.rb",
|
93
|
+
"test/scout/annotation/test_array.rb",
|
88
94
|
"test/scout/indiferent_hash/test_case_insensitive.rb",
|
89
95
|
"test/scout/indiferent_hash/test_options.rb",
|
90
96
|
"test/scout/log/test_color.rb",
|
@@ -92,7 +98,9 @@ Gem::Specification.new do |s|
|
|
92
98
|
"test/scout/log/test_progress.rb",
|
93
99
|
"test/scout/misc/test_digest.rb",
|
94
100
|
"test/scout/misc/test_filesystem.rb",
|
101
|
+
"test/scout/misc/test_helper.rb",
|
95
102
|
"test/scout/misc/test_insist.rb",
|
103
|
+
"test/scout/misc/test_math.rb",
|
96
104
|
"test/scout/misc/test_system.rb",
|
97
105
|
"test/scout/open/test_lock.rb",
|
98
106
|
"test/scout/open/test_remote.rb",
|
@@ -111,12 +119,12 @@ Gem::Specification.new do |s|
|
|
111
119
|
"test/scout/simple_opt/test_get.rb",
|
112
120
|
"test/scout/simple_opt/test_parse.rb",
|
113
121
|
"test/scout/simple_opt/test_setup.rb",
|
122
|
+
"test/scout/test_annotation.rb",
|
114
123
|
"test/scout/test_cmd.rb",
|
115
124
|
"test/scout/test_concurrent_stream.rb",
|
116
125
|
"test/scout/test_config.rb",
|
117
126
|
"test/scout/test_indiferent_hash.rb",
|
118
127
|
"test/scout/test_log.rb",
|
119
|
-
"test/scout/test_meta_extension.rb",
|
120
128
|
"test/scout/test_misc.rb",
|
121
129
|
"test/scout/test_named_array.rb",
|
122
130
|
"test/scout/test_open.rb",
|
@@ -128,17 +136,17 @@ Gem::Specification.new do |s|
|
|
128
136
|
]
|
129
137
|
s.homepage = "http://github.com/mikisvaz/scout-essentials".freeze
|
130
138
|
s.licenses = ["MIT".freeze]
|
131
|
-
s.rubygems_version = "3.5.
|
139
|
+
s.rubygems_version = "3.5.10".freeze
|
132
140
|
s.summary = "Scout essential tools".freeze
|
133
141
|
|
134
142
|
s.specification_version = 4
|
135
143
|
|
136
|
-
s.add_development_dependency(%q<shoulda>.freeze, [">= 0"])
|
137
|
-
s.add_development_dependency(%q<rdoc>.freeze, ["~> 3.12"])
|
138
|
-
s.add_development_dependency(%q<bundler>.freeze, ["~> 1.0"])
|
139
|
-
s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
|
140
|
-
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
141
|
-
s.add_runtime_dependency(%q<term-ansicolor>.freeze, [">= 0"])
|
142
|
-
s.add_runtime_dependency(%q<yaml>.freeze, [">= 0"])
|
144
|
+
s.add_development_dependency(%q<shoulda>.freeze, [">= 0".freeze])
|
145
|
+
s.add_development_dependency(%q<rdoc>.freeze, ["~> 3.12".freeze])
|
146
|
+
s.add_development_dependency(%q<bundler>.freeze, ["~> 1.0".freeze])
|
147
|
+
s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.1.0".freeze])
|
148
|
+
s.add_development_dependency(%q<simplecov>.freeze, [">= 0".freeze])
|
149
|
+
s.add_runtime_dependency(%q<term-ansicolor>.freeze, [">= 0".freeze])
|
150
|
+
s.add_runtime_dependency(%q<yaml>.freeze, [">= 0".freeze])
|
143
151
|
end
|
144
152
|
|
File without changes
|