rbbt-util 5.23.36 → 5.23.37
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/util/open.rb +19 -8
- data/lib/rbbt/workflow.rb +1 -1
- data/share/rbbt_commands/tsv/read +2 -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: 206746628d7fcc049b1e322ac9b7869199855c61
|
4
|
+
data.tar.gz: 77bb05fbe30fd9e912a119460afe1d4a40ebb613
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f74c4c63ee0590f18de5b405dc74eba69fc9f936cd49dec989407c576c203ebdd199ee338884e9992dd3cc1302215bae4b16a75d54976098687003c1479732f4
|
7
|
+
data.tar.gz: 7407802c1cf02b75a8fe2dfaa162d66cc878efc23a2517e3f1ee0b70332ab2adce1428d4ecf85ff45e3d7e998e92d0ddc3bd39c9a6900664a17e62494bcbe4da
|
data/lib/rbbt/util/open.rb
CHANGED
@@ -13,6 +13,18 @@ module Open
|
|
13
13
|
REMOTE_CACHEDIR = File.join(ENV["HOME"], "/tmp/open_cache")
|
14
14
|
FileUtils.mkdir_p REMOTE_CACHEDIR unless File.exist? REMOTE_CACHEDIR
|
15
15
|
|
16
|
+
GREP_CMD = begin
|
17
|
+
if ENV["GREP_CMD"]
|
18
|
+
ENV["GREP_CMD"]
|
19
|
+
elsif File.exists?('/bin/grep')
|
20
|
+
"/bin/grep"
|
21
|
+
elsif File.exists?('/usr/bin/grep')
|
22
|
+
"/usr/bin/grep"
|
23
|
+
else
|
24
|
+
"grep"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
16
28
|
class << self
|
17
29
|
attr_accessor :repository_dirs
|
18
30
|
|
@@ -127,14 +139,13 @@ module Open
|
|
127
139
|
# Grep
|
128
140
|
|
129
141
|
def self.grep(stream, grep, invert = false)
|
130
|
-
grep_cmd = ENV["GREP_CMD"] || "/bin/grep"
|
131
142
|
case
|
132
143
|
when Array === grep
|
133
144
|
TmpFile.with_file(grep * "\n", false) do |f|
|
134
|
-
CMD.cmd("#{
|
145
|
+
CMD.cmd("#{GREP_CMD} #{invert ? '-v' : ''} -", "-w" => true, "-F" => true, "-f" => f, :in => stream, :pipe => true, :post => proc{FileUtils.rm f})
|
135
146
|
end
|
136
147
|
else
|
137
|
-
CMD.cmd("#{
|
148
|
+
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)})
|
138
149
|
end
|
139
150
|
end
|
140
151
|
|
@@ -386,11 +397,11 @@ module Open
|
|
386
397
|
repo_target = get_repo_from_dir(dir_sub_path_target[0])
|
387
398
|
|
388
399
|
content = repo_source.read_and_close do
|
389
|
-
|
400
|
+
repo_source[dir_sub_path_source[1]]
|
390
401
|
end
|
391
402
|
|
392
403
|
repo_target.write_and_close do
|
393
|
-
|
404
|
+
repo_target[dir_sub_path_target[1]] = content
|
394
405
|
end
|
395
406
|
|
396
407
|
return nil
|
@@ -405,7 +416,7 @@ module Open
|
|
405
416
|
tmp_target = File.join(File.dirname(target), '.tmp_mv.' + File.basename(target))
|
406
417
|
FileUtils.mv source, tmp_target
|
407
418
|
FileUtils.mv tmp_target, target
|
408
|
-
return
|
419
|
+
return nil
|
409
420
|
end
|
410
421
|
|
411
422
|
if dir_sub_path_source.nil?
|
@@ -422,11 +433,11 @@ module Open
|
|
422
433
|
repo_target = get_repo_from_dir(dir_sub_path_target[0])
|
423
434
|
|
424
435
|
content = repo_source.read_and_close do
|
425
|
-
|
436
|
+
repo_source[dir_sub_path_target[1]]
|
426
437
|
end
|
427
438
|
|
428
439
|
repo_target.write_and_close do
|
429
|
-
|
440
|
+
repo_target[dir_sub_path_source[1]] = content
|
430
441
|
end
|
431
442
|
|
432
443
|
repo_source.write_and_close do
|
data/lib/rbbt/workflow.rb
CHANGED
@@ -505,7 +505,6 @@ module Workflow
|
|
505
505
|
end
|
506
506
|
|
507
507
|
def self.fast_load_step(path)
|
508
|
-
return load_step(path)
|
509
508
|
step = Step.new path
|
510
509
|
step.dependencies = nil
|
511
510
|
class << step
|
@@ -533,6 +532,7 @@ module Workflow
|
|
533
532
|
def dirty?
|
534
533
|
false
|
535
534
|
end
|
535
|
+
|
536
536
|
def updated?
|
537
537
|
true
|
538
538
|
end
|
@@ -38,7 +38,8 @@ end
|
|
38
38
|
|
39
39
|
parser = TSV::Parser.new TSV.get_stream(file), options
|
40
40
|
|
41
|
-
dumper = TSV::Dumper.new parser.options
|
41
|
+
dumper = TSV::Dumper.new parser.options.merge(:sep => "\t", :sep2 => '|')
|
42
|
+
dumper.init
|
42
43
|
|
43
44
|
options[:merge] = false if options[:merge] == "false"
|
44
45
|
|
@@ -68,7 +69,6 @@ Thread.new do
|
|
68
69
|
dumper.close
|
69
70
|
end
|
70
71
|
|
71
|
-
dumper.init
|
72
72
|
stream = dumper.stream
|
73
73
|
stream = TSV.collapse_stream(dumper.stream).stream if options[:merge]
|
74
74
|
|
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.23.
|
4
|
+
version: 5.23.37
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|