rbbt-util 5.14.15 → 5.14.16
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.
- checksums.yaml +4 -4
- data/bin/rbbt +1 -1
- data/etc/app.d/entities.rb +4 -1
- data/lib/rbbt/association.rb +2 -2
- data/lib/rbbt/resource/path.rb +55 -51
- data/lib/rbbt/resource/util.rb +1 -1
- data/lib/rbbt/tsv/accessor.rb +1 -1
- data/lib/rbbt/tsv/parser.rb +2 -2
- data/lib/rbbt/util/log.rb +6 -0
- data/lib/rbbt/util/misc/development.rb +7 -1
- data/share/rbbt_commands/tsv/info +0 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70d99fc7279b9731d3f52b47a88b98e754f50376
|
4
|
+
data.tar.gz: a44903e02e4cd08f4780b7a64526f14335fcd661
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f6e582804b9c76c255ef1a7acc1ab8bf261e75a239c6b51f85de1e37baea9e0bd688da035e9999963a8d744e8f327039af4c0fe20e8b57e3f965097be418b7c
|
7
|
+
data.tar.gz: e655675f21100fcb903238b74c0e721743d9a78ae2bd7f17e1238ac1de9439b293b712760d781ba05aafd2da601f9b874e64da14848d373c023f0c817ab66025
|
data/bin/rbbt
CHANGED
data/etc/app.d/entities.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
|
+
|
2
|
+
#{{{ Require files
|
1
3
|
Rbbt.etc.requires.read.split("\n").each do |file|
|
2
4
|
next if file.empty?
|
3
5
|
Log.debug("requiring #{ file }")
|
4
6
|
require file
|
5
7
|
end if Rbbt.etc.requires.exists?
|
6
8
|
|
7
|
-
|
8
9
|
Entity.entity_list_cache = Rbbt.var.sinatra.find.entity_lists
|
9
10
|
Entity.entity_map_cache = Rbbt.var.sinatra.find.entity_maps
|
10
11
|
Entity.entity_property_cache = Rbbt.var.sinatra.find.entity_properties
|
11
12
|
|
13
|
+
#{{{ Prepare REST entities
|
12
14
|
Rbbt.etc.entities.read.split("\n").each do |name|
|
13
15
|
next if name.empty?
|
14
16
|
mod = Kernel.const_get name
|
@@ -18,6 +20,7 @@ Rbbt.etc.entities.read.split("\n").each do |name|
|
|
18
20
|
end
|
19
21
|
end if Rbbt.etc.entities.exists?
|
20
22
|
|
23
|
+
#{{{ Prepare REST entity property persist
|
21
24
|
$annotation_repo = Rbbt.var.sinatra.annotation_repo.find
|
22
25
|
(Rbbt.etc.persist_properties.yaml || {}).each do |name,list|
|
23
26
|
next if name.empty?
|
data/lib/rbbt/association.rb
CHANGED
@@ -88,6 +88,7 @@ module Association
|
|
88
88
|
if file.fields == field_headers
|
89
89
|
file
|
90
90
|
else
|
91
|
+
iii :reorder
|
91
92
|
file.reorder(source, field_headers)
|
92
93
|
end
|
93
94
|
else
|
@@ -239,7 +240,7 @@ module Association
|
|
239
240
|
tsv = load_tsv(file, options)
|
240
241
|
|
241
242
|
tsv.annotate(data)
|
242
|
-
data.serializer = tsv.type
|
243
|
+
data.serializer = tsv.type
|
243
244
|
|
244
245
|
tsv.with_unnamed do
|
245
246
|
tsv.each do |k,v|
|
@@ -330,4 +331,3 @@ module Association
|
|
330
331
|
end
|
331
332
|
end
|
332
333
|
end
|
333
|
-
|
data/lib/rbbt/resource/path.rb
CHANGED
@@ -90,57 +90,61 @@ module Path
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def find(where = nil, caller_lib = nil, paths = nil)
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
93
|
+
@path ||= {}
|
94
|
+
key = Misc.digest([where, caller_lib, paths].inspect)
|
95
|
+
@path[key] ||= begin
|
96
|
+
paths = (self.search_paths || SEARCH_PATHS).merge(paths || {})
|
97
|
+
where = paths[:default] if where == :default
|
98
|
+
return self if located?
|
99
|
+
if self.match(/(.*?)\/(.*)/)
|
100
|
+
toplevel, subpath = self.match(/(.*?)\/(.*)/).values_at 1, 2
|
101
|
+
else
|
102
|
+
toplevel, subpath = self, ""
|
103
|
+
end
|
104
|
+
|
105
|
+
path = nil
|
106
|
+
if where.nil?
|
107
|
+
STANDARD_SEARCH.each do |w|
|
108
|
+
w = w.to_sym
|
109
|
+
next unless paths.include? w
|
110
|
+
path = find(w, caller_lib, paths)
|
111
|
+
return path if File.exists? path
|
112
|
+
end
|
113
|
+
(SEARCH_PATHS.keys - STANDARD_SEARCH).each do |w|
|
114
|
+
w = w.to_sym
|
115
|
+
next unless paths.include? w
|
116
|
+
path = find(w, caller_lib, paths)
|
117
|
+
return path if File.exists? path
|
118
|
+
end
|
119
|
+
if paths.include? :default
|
120
|
+
find((paths[:default] || :user), caller_lib, paths)
|
121
|
+
else
|
122
|
+
raise "Path '#{ path }' not found, and no default specified in search paths: #{paths.inspect}"
|
123
|
+
end
|
124
|
+
else
|
125
|
+
where = where.to_sym
|
126
|
+
raise "Did not recognize the 'where' tag: #{where}. Options: #{paths.keys}" unless paths.include? where
|
127
|
+
|
128
|
+
if where == :lib
|
129
|
+
libdir = Path.caller_lib_dir(caller_lib) || "NOLIBDIR"
|
130
|
+
else
|
131
|
+
libdir = "NOLIBDIR"
|
132
|
+
end
|
133
|
+
pwd = FileUtils.pwd
|
134
|
+
path = paths[where].
|
135
|
+
sub('{PKGDIR}', pkgdir).
|
136
|
+
sub('{PWD}', pwd).
|
137
|
+
sub('{TOPLEVEL}', toplevel).
|
138
|
+
sub('{SUBPATH}', subpath).
|
139
|
+
sub('{PATH}', self).
|
140
|
+
sub('{LIBDIR}', libdir) #, @pkgdir, @resource, @search_paths
|
141
|
+
|
142
|
+
path = path + '.gz' if File.exists? path + '.gz'
|
143
|
+
path = path + '.bgz' if File.exists? path + '.bgz'
|
144
|
+
|
145
|
+
self.annotate path
|
146
|
+
end
|
147
|
+
end
|
144
148
|
end
|
145
149
|
|
146
150
|
def find_all(caller_lib = nil, search_paths = nil)
|
data/lib/rbbt/resource/util.rb
CHANGED
@@ -101,7 +101,7 @@ module Resource
|
|
101
101
|
task = Misc.path_relative_to rake_dir, path
|
102
102
|
rakefile = rakefile.produce if rakefile.respond_to? :produce
|
103
103
|
|
104
|
-
rake_dir = rake_dir.find if rake_dir.respond_to? :find
|
104
|
+
rake_dir = rake_dir.find(:user) if rake_dir.respond_to? :find
|
105
105
|
|
106
106
|
begin
|
107
107
|
require 'rbbt/resource/rake'
|
data/lib/rbbt/tsv/accessor.rb
CHANGED
data/lib/rbbt/tsv/parser.rb
CHANGED
@@ -143,7 +143,8 @@ module TSV
|
|
143
143
|
raise $!
|
144
144
|
end
|
145
145
|
|
146
|
-
|
146
|
+
str = parts[key_position]
|
147
|
+
keys = str.split(@sep2, -1)
|
147
148
|
|
148
149
|
if @take_all
|
149
150
|
values = parts.collect{|e| e.split(@sep2, -1) }.flatten
|
@@ -545,7 +546,6 @@ module TSV
|
|
545
546
|
stream.abort if stream.respond_to? :abort
|
546
547
|
raise $!
|
547
548
|
rescue Exception
|
548
|
-
Log.exception $!
|
549
549
|
Log.error "Exception parsing #{Misc.fingerprint stream}: #{$!.message}"
|
550
550
|
stream.abort $! if stream.respond_to? :abort
|
551
551
|
raise $!
|
data/lib/rbbt/util/log.rb
CHANGED
@@ -272,9 +272,12 @@ module Misc
|
|
272
272
|
end
|
273
273
|
|
274
274
|
def self.bootstrap(elems, num = :current, file = nil, &block)
|
275
|
+
num = :current if num.nil?
|
275
276
|
cpus = case num
|
276
277
|
when :current
|
277
278
|
4
|
279
|
+
when String
|
280
|
+
num.to_i
|
278
281
|
when Integer
|
279
282
|
if num < 100
|
280
283
|
num
|
@@ -283,6 +286,9 @@ module Misc
|
|
283
286
|
end
|
284
287
|
end
|
285
288
|
file = caller.first + rand(1000000).to_s if file.nil?
|
286
|
-
|
289
|
+
index = (0..elems.length-1).to_a.collect{|v| v.to_s }
|
290
|
+
RbbtSemaphore.fork_each_on_semaphore index, cpus, file do |i|
|
291
|
+
yield elems[i.to_i]
|
292
|
+
end
|
287
293
|
end
|
288
294
|
end
|
@@ -30,9 +30,7 @@ file = STDIN if file == '-'
|
|
30
30
|
|
31
31
|
raise ParameterException, "Please specify the tsv file as argument" if file.nil?
|
32
32
|
|
33
|
-
iii options
|
34
33
|
options[:fields] = options[:fields].split(/[,\|]/) if options[:fields]
|
35
|
-
iii options
|
36
34
|
options[:header_hash] = options["header_hash"]
|
37
35
|
options[:sep] = options["sep"]
|
38
36
|
|
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.14.
|
4
|
+
version: 5.14.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|