rbbt-util 5.17.53 → 5.17.54
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/lib/rbbt/util/log/progress/report.rb +1 -1
- data/lib/rbbt/util/misc/pipes.rb +38 -4
- data/test/rbbt/util/misc/test_pipes.rb +20 -0
- 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: 0eff9b6b56a7749a8fc52d8f0d9ffc155ea26063
|
4
|
+
data.tar.gz: d2cc3438a4cf6e5f9763c5b251033f6cdea12e8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c83cd765452233e52d64988cbc025d30d98ba122dd167b2c854088a4f3840d775dc6c1381612f40e41dd289fd24ccb1ddb1e9b20ba3682040247275b3f78779
|
7
|
+
data.tar.gz: 30ec09cac18261e1daa67b79071a6eeb918be77f4cb6c4283441de9094fb1bc93dcac2e8905038b086c7d4e9b2fbff67e57f82f58f7621f89a1603e55fc96265
|
@@ -85,7 +85,7 @@ module Log
|
|
85
85
|
if @max
|
86
86
|
return str << " " << Log.color(:yellow, "waiting on #{@max} #{bytes ? 'bytes' : 'items'}")
|
87
87
|
else
|
88
|
-
return str << " " << Log.color(:yellow, "waiting - #{Process.pid}")
|
88
|
+
return str << " " << Log.color(:yellow, "waiting - PID: #{Process.pid}")
|
89
89
|
end
|
90
90
|
end
|
91
91
|
str << " " << thr_msg
|
data/lib/rbbt/util/misc/pipes.rb
CHANGED
@@ -300,10 +300,12 @@ module Misc
|
|
300
300
|
def self.sort_stream(stream, header_hash = "#", cmd_args = "-u")
|
301
301
|
Misc.open_pipe do |sin|
|
302
302
|
begin
|
303
|
-
if defined? Step and Step === stream
|
304
|
-
|
305
|
-
|
306
|
-
end
|
303
|
+
#if defined? Step and Step === stream
|
304
|
+
# step = stream
|
305
|
+
# stream = stream.get_stream || stream.path.open
|
306
|
+
#end
|
307
|
+
|
308
|
+
stream = TSV.get_stream stream
|
307
309
|
|
308
310
|
line = stream.gets
|
309
311
|
while line =~ /^#{header_hash}/ do
|
@@ -491,4 +493,36 @@ module Misc
|
|
491
493
|
end
|
492
494
|
end
|
493
495
|
|
496
|
+
def self.compare_lines(stream1, stream2, args, sort = false)
|
497
|
+
if sort
|
498
|
+
stream1 = Misc.sort_stream stream1
|
499
|
+
stream2 = Misc.sort_stream stream2
|
500
|
+
remove_lines(stream1, stream2, false)
|
501
|
+
else
|
502
|
+
erase = []
|
503
|
+
|
504
|
+
if Path === stream1 or (String === stream1 and File.exists? stream1)
|
505
|
+
file1 = stream1
|
506
|
+
else
|
507
|
+
file1 = TmpFile.tmp_file
|
508
|
+
erase << file1
|
509
|
+
Open.write(file1, TSV.get_stream(stream1))
|
510
|
+
end
|
511
|
+
|
512
|
+
if Path === stream2 or (String === stream2 and File.exists? stream2)
|
513
|
+
file2 = stream2
|
514
|
+
else
|
515
|
+
file2 = TmpFile.tmp_file
|
516
|
+
erase << file2
|
517
|
+
Open.write(file2, TSV.get_stream(stream2))
|
518
|
+
end
|
519
|
+
|
520
|
+
CMD.cmd("comm #{args} '#{file1}' '#{file2}'", :pipe => true, :post => Proc.new{ erase.each{|f| FileUtils.rm f } })
|
521
|
+
end
|
522
|
+
end
|
523
|
+
|
524
|
+
def self.remove_lines(stream1, stream2, sort)
|
525
|
+
self.compare_lines(stream1, stream2, '-2 -3', sort)
|
526
|
+
end
|
527
|
+
|
494
528
|
end
|
@@ -87,4 +87,24 @@ row1 A B C
|
|
87
87
|
assert_equal text, io.read
|
88
88
|
end
|
89
89
|
end
|
90
|
+
|
91
|
+
def test_remove_lines
|
92
|
+
text1 =<<-EOF
|
93
|
+
line1
|
94
|
+
line2
|
95
|
+
line3
|
96
|
+
line4
|
97
|
+
EOF
|
98
|
+
text2 =<<-EOF
|
99
|
+
line3
|
100
|
+
line1
|
101
|
+
EOF
|
102
|
+
|
103
|
+
Log.severity = 0
|
104
|
+
TmpFile.with_file(text1) do |file1|
|
105
|
+
TmpFile.with_file(text2) do |file2|
|
106
|
+
ppp Misc.remove_lines(file1, file2, true).read
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
90
110
|
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.17.
|
4
|
+
version: 5.17.54
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|