textfile 1.0.6 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -12
- data/Gemfile.lock +11 -50
- data/README.rdoc +1 -4
- data/VERSION +1 -1
- data/lib/textfile.rb +2 -2
- data/test/helper.rb +1 -23
- data/test/test_textfile.rb +17 -7
- data/textfile.gemspec +11 -12
- metadata +7 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 418d0366d4eaff4f35ecd09ee257105d0428a3ec
|
4
|
+
data.tar.gz: fb870556d34f23d75b736e5baab1e1f1585c6b6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b907fa75388ac74eeaf0b9088c7e3b1dd129b655672079dc1b7a629a2d13b33de5aa2e75f21c84224b7ae0790e5d663201585254c982e2f2b83d37e06be05765
|
7
|
+
data.tar.gz: d190faf3bb2c001a69bcb4a85d44418821064aac3d6d00be140c3279b497b5a1f15caf22126f2e4e78e7a9cd8b6d5d66368c3fce72537b7226c8354ad99c1de7
|
data/Gemfile
CHANGED
@@ -1,14 +1,3 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
5
2
|
|
6
|
-
|
7
|
-
# Include everything needed to run rake, tests, features, etc.
|
8
|
-
group :development do
|
9
|
-
gem "shoulda", ">= 0"
|
10
|
-
gem "rdoc", "~> 3.12"
|
11
|
-
|
12
|
-
gem 'coveralls'
|
13
|
-
gem "simplecov", ">= 0"
|
14
|
-
end
|
3
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,62 +1,23 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
textfile (1.1.0)
|
5
|
+
|
1
6
|
GEM
|
2
7
|
remote: http://rubygems.org/
|
3
8
|
specs:
|
4
|
-
activesupport (4.2.2)
|
5
|
-
i18n (~> 0.7)
|
6
|
-
json (~> 1.7, >= 1.7.7)
|
7
|
-
minitest (~> 5.1)
|
8
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
9
|
-
tzinfo (~> 1.1)
|
10
|
-
coveralls (0.8.10)
|
11
|
-
json (~> 1.8)
|
12
|
-
rest-client (>= 1.6.8, < 2)
|
13
|
-
simplecov (~> 0.11.0)
|
14
|
-
term-ansicolor (~> 1.3)
|
15
|
-
thor (~> 0.19.1)
|
16
|
-
tins (~> 1.6.0)
|
17
|
-
docile (1.1.5)
|
18
|
-
domain_name (0.5.20170223)
|
19
|
-
unf (>= 0.0.5, < 1.0.0)
|
20
|
-
http-cookie (1.0.3)
|
21
|
-
domain_name (~> 0.5)
|
22
|
-
i18n (0.8.1)
|
23
9
|
json (1.8.6)
|
24
|
-
|
25
|
-
minitest (5.10.1)
|
26
|
-
netrc (0.11.0)
|
10
|
+
minitest (5.10.2)
|
27
11
|
rdoc (3.12.2)
|
28
12
|
json (~> 1.4)
|
29
|
-
rest-client (1.8.0)
|
30
|
-
http-cookie (>= 1.0.2, < 2.0)
|
31
|
-
mime-types (>= 1.16, < 3.0)
|
32
|
-
netrc (~> 0.7)
|
33
|
-
shoulda (3.5.0)
|
34
|
-
shoulda-context (~> 1.0, >= 1.0.1)
|
35
|
-
shoulda-matchers (>= 1.4.1, < 3.0)
|
36
|
-
shoulda-context (1.2.2)
|
37
|
-
shoulda-matchers (2.8.0)
|
38
|
-
activesupport (>= 3.0.0)
|
39
|
-
simplecov (0.11.2)
|
40
|
-
docile (~> 1.1.0)
|
41
|
-
json (~> 1.8)
|
42
|
-
simplecov-html (~> 0.10.0)
|
43
|
-
simplecov-html (0.10.0)
|
44
|
-
term-ansicolor (1.5.0)
|
45
|
-
tins (~> 1.0)
|
46
|
-
thor (0.19.4)
|
47
|
-
thread_safe (0.3.6)
|
48
|
-
tins (1.6.0)
|
49
|
-
tzinfo (1.2.3)
|
50
|
-
thread_safe (~> 0.1)
|
51
|
-
unf (0.1.4)
|
52
|
-
unf_ext
|
53
|
-
unf_ext (0.0.7.2)
|
54
13
|
|
55
14
|
PLATFORMS
|
56
15
|
ruby
|
57
16
|
|
58
17
|
DEPENDENCIES
|
59
|
-
|
18
|
+
minitest (~> 5.0)
|
60
19
|
rdoc (~> 3.12)
|
61
|
-
|
62
|
-
|
20
|
+
textfile!
|
21
|
+
|
22
|
+
BUNDLED WITH
|
23
|
+
1.14.3
|
data/README.rdoc
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
{<img src="https://badge.fury.io/rb/textfile.svg" alt="Gem Version" />}[http://badge.fury.io/rb/textfile]
|
4
4
|
{<img src="https://travis-ci.org/varyonic/textfile.svg" />}[https://travis-ci.org/varyonic/textfile]
|
5
|
-
{<img src="https://coveralls.io/repos/varyonic/textfile/badge.png?branch=master" alt="Coverage Status" />}[https://coveralls.io/r/varyonic/textfile?branch=master]
|
6
5
|
{<img src="https://gemnasium.com/varyonic/textfile.svg" alt="Dependency Status" />}[https://gemnasium.com/varyonic/textfile]
|
7
6
|
{<img src="https://codeclimate.com/github/varyonic/textfile/badges/gpa.svg" />}[https://codeclimate.com/github/varyonic/textfile]
|
8
7
|
|
@@ -25,6 +24,4 @@ A common use case is to identify differences between exported datasets where the
|
|
25
24
|
|
26
25
|
== Copyright
|
27
26
|
|
28
|
-
Copyright (c) 2014 Piers Chambers. See LICENSE.txt for
|
29
|
-
further details.
|
30
|
-
|
27
|
+
Copyright (c) 2014-2017 Piers Chambers. See LICENSE.txt for further details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
data/lib/textfile.rb
CHANGED
@@ -3,7 +3,7 @@ require 'tempfile'
|
|
3
3
|
|
4
4
|
class Textfile
|
5
5
|
|
6
|
-
attr_accessor :path, :logger
|
6
|
+
attr_accessor :path, :tmpdir, :logger, :debug
|
7
7
|
|
8
8
|
# options
|
9
9
|
# * +:bufsiz+ - Passed to GNU sort to optimize performance.
|
@@ -75,7 +75,7 @@ class Textfile
|
|
75
75
|
attr_accessor :sorted
|
76
76
|
|
77
77
|
def with_tempcopy
|
78
|
-
tempcopy = Tempfile.new(['temp-','.txt'])
|
78
|
+
tempcopy = Tempfile.new(['temp-','.txt'], tmpdir)
|
79
79
|
tempcopy.write(File.read(@path))
|
80
80
|
tempcopy.close
|
81
81
|
yield tempcopy.path
|
data/test/helper.rb
CHANGED
@@ -1,25 +1,3 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
require 'coveralls'
|
3
|
-
|
4
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
5
|
-
SimpleCov::Formatter::HTMLFormatter,
|
6
|
-
Coveralls::SimpleCov::Formatter
|
7
|
-
]
|
8
|
-
|
9
|
-
module SimpleCov::Configuration
|
10
|
-
def clean_filters
|
11
|
-
@filters = []
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
SimpleCov.configure do
|
16
|
-
clean_filters
|
17
|
-
load_profile 'test_frameworks'
|
18
|
-
end
|
19
|
-
|
20
|
-
ENV["COVERAGE"] && SimpleCov.start do
|
21
|
-
add_filter "/.rvm/"
|
22
|
-
end
|
23
1
|
require 'rubygems'
|
24
2
|
require 'bundler'
|
25
3
|
begin
|
@@ -30,7 +8,7 @@ rescue Bundler::BundlerError => e
|
|
30
8
|
exit e.status_code
|
31
9
|
end
|
32
10
|
require "minitest/autorun"
|
33
|
-
require '
|
11
|
+
require 'minitest/unit'
|
34
12
|
|
35
13
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
36
14
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
data/test/test_textfile.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'helper'
|
3
3
|
|
4
|
-
|
4
|
+
describe Textfile do
|
5
5
|
def infile(*records)
|
6
6
|
file = Tempfile.new(self.class.name)
|
7
7
|
file.puts(records)
|
@@ -9,7 +9,7 @@ class TestTextfile < Minitest::Test
|
|
9
9
|
Textfile.new(file.path)
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
it "clear a file" do
|
13
13
|
textfile = infile('3','2','1')
|
14
14
|
|
15
15
|
textfile.clear
|
@@ -18,7 +18,7 @@ class TestTextfile < Minitest::Test
|
|
18
18
|
assert_equal([], file.read.split)
|
19
19
|
end
|
20
20
|
|
21
|
-
|
21
|
+
it "find the intersection of two datasets" do
|
22
22
|
tf1 = infile('3','2','1','b')
|
23
23
|
tf2 = infile('c','b','a','2')
|
24
24
|
|
@@ -28,7 +28,7 @@ class TestTextfile < Minitest::Test
|
|
28
28
|
assert_equal(['2','b'], file.read.split)
|
29
29
|
end
|
30
30
|
|
31
|
-
|
31
|
+
it "merge two datasets" do
|
32
32
|
tf1 = infile('3','2','1','b')
|
33
33
|
tf2 = infile('c','b','a','2')
|
34
34
|
|
@@ -38,7 +38,7 @@ class TestTextfile < Minitest::Test
|
|
38
38
|
assert_equal(['1','2','3','a','b','c'], file.read.split)
|
39
39
|
end
|
40
40
|
|
41
|
-
|
41
|
+
it "sort a simple file" do
|
42
42
|
textfile = infile(['3','2','1'])
|
43
43
|
|
44
44
|
textfile.send :sort
|
@@ -47,7 +47,7 @@ class TestTextfile < Minitest::Test
|
|
47
47
|
assert_equal(file.read.split, ['1', '2', '3'])
|
48
48
|
end
|
49
49
|
|
50
|
-
|
50
|
+
it "sort a file with very long records" do
|
51
51
|
textfile = infile('3'*9999,'2','1')
|
52
52
|
|
53
53
|
textfile.send :sort
|
@@ -56,7 +56,7 @@ class TestTextfile < Minitest::Test
|
|
56
56
|
assert_equal(file.read.split, ['1', '2', '3'*9999])
|
57
57
|
end
|
58
58
|
|
59
|
-
|
59
|
+
it "sort non-ASCII characters" do
|
60
60
|
textfile = infile('Muffler','MX Systems','Müller','MySQL')
|
61
61
|
|
62
62
|
textfile.send :sort
|
@@ -65,4 +65,14 @@ class TestTextfile < Minitest::Test
|
|
65
65
|
# OSX collation broken? Works on Linux.
|
66
66
|
assert_equal(file.read.split("\n"), ["Muffler", "Müller", "MX Systems", "MySQL"])
|
67
67
|
end
|
68
|
+
|
69
|
+
it "use an explicitly specified tmpdir" do
|
70
|
+
Dir.mktmpdir do |tmpdir|
|
71
|
+
textfile = infile('3', '2', '1')
|
72
|
+
textfile.tmpdir = tmpdir
|
73
|
+
textfile.debug = true
|
74
|
+
textfile.send :sort
|
75
|
+
assert_equal Dir["#{tmpdir}/temp-*.txt"].size, 1
|
76
|
+
end
|
77
|
+
end
|
68
78
|
end
|
data/textfile.gemspec
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "textfile"
|
3
|
-
s.version = "1.0
|
3
|
+
s.version = "1.1.0"
|
4
|
+
s.authors = ["Piers Chambers"]
|
5
|
+
s.email = "piers@varyonic.com"
|
6
|
+
|
7
|
+
s.summary = "Set-like wrapper around GNU comm and related textfile utilities."
|
8
|
+
s.description = "Set-like wrapper around GNU comm and related textfile utilities.\n\nA common use case is to identify differences between exported datasets where the datasets may exceed 100K rows and each row may exceed 4K characters."
|
9
|
+
s.homepage = "http://github.com/varyonic/textfile"
|
10
|
+
s.license = "MIT"
|
4
11
|
|
5
12
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
13
|
s.require_paths = ["lib"]
|
7
|
-
|
8
|
-
s.date = "2017-03-31"
|
9
|
-
s.description = "Set-like wrapper around GNU comm and related textfile utilities.\n\nA common use case is to identify differences between exported datasets where the datasets may exceed 100K rows and each row may exceed 4K characters."
|
10
|
-
s.email = "piers@varyonic.com"
|
14
|
+
|
11
15
|
s.extra_rdoc_files = [
|
12
16
|
"LICENSE.txt",
|
13
17
|
"README.rdoc"
|
@@ -26,12 +30,7 @@ Gem::Specification.new do |s|
|
|
26
30
|
"test/test_textfile.rb",
|
27
31
|
"textfile.gemspec"
|
28
32
|
]
|
29
|
-
s.homepage = "http://github.com/varyonic/textfile"
|
30
|
-
s.licenses = ["MIT"]
|
31
|
-
s.summary = "Set-like wrapper around GNU comm and related textfile utilities."
|
32
33
|
|
33
|
-
s.add_development_dependency
|
34
|
-
s.add_development_dependency
|
35
|
-
s.add_development_dependency(%q<coveralls>, [">= 0"])
|
36
|
-
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
34
|
+
s.add_development_dependency "minitest", '~> 5.0'
|
35
|
+
s.add_development_dependency "rdoc", "~> 3.12"
|
37
36
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: textfile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piers Chambers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: minitest
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '5.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rdoc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,34 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.12'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: coveralls
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: simplecov
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
41
|
description: |-
|
70
42
|
Set-like wrapper around GNU comm and related textfile utilities.
|
71
43
|
|