csvutils 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +3 -0
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/lib/csvutils.rb +109 -0
- data/lib/csvutils/cut.rb +47 -47
- data/lib/csvutils/head.rb +25 -0
- data/lib/csvutils/header.rb +28 -0
- data/lib/csvutils/split.rb +107 -107
- data/lib/csvutils/stat.rb +86 -0
- data/lib/csvutils/test.rb +1 -1
- data/lib/csvutils/utils.rb +13 -29
- data/lib/csvutils/version.rb +1 -1
- data/test/data/at-austria/AUT.csv +363 -363
- data/test/data/eng-england/2017-18/E0.csv +381 -381
- data/test/test_headers.rb +50 -41
- data/test/test_misc.rb +12 -1
- data/test/test_version.rb +20 -20
- metadata +6 -3
data/test/test_headers.rb
CHANGED
@@ -1,41 +1,50 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
###
|
4
|
-
# to run use
|
5
|
-
# ruby -I ./lib -I ./test test/test_headers.rb
|
6
|
-
|
7
|
-
|
8
|
-
require 'helper'
|
9
|
-
|
10
|
-
class TestHeaders < MiniTest::Test
|
11
|
-
|
12
|
-
|
13
|
-
##
|
14
|
-
# Div,Date,HomeTeam,AwayTeam,FTHG,FTAG,FTR,HTHG,HTAG,HTR,
|
15
|
-
# Referee,HS,AS,HST,AST,HF,AF,HC,AC,HY,AY,HR,AR,
|
16
|
-
# B365H,B365D,B365A,BWH,BWD,BWA,IWH,IWD,IWA,LBH,LBD,LBA,PSH,PSD,PSA,
|
17
|
-
# WHH,WHD,WHA,VCH,VCD,VCA,
|
18
|
-
# Bb1X2,BbMxH,BbAvH,BbMxD,BbAvD,BbMxA,BbAvA,BbOU,BbMx>2.5,BbAv>2.5,BbMx<2.5,BbAv<2.5,
|
19
|
-
# BbAH,BbAHh,BbMxAHH,BbAvAHH,BbMxAHA,BbAvAHA,PSCH,PSCD,PSCA
|
20
|
-
def test_eng
|
21
|
-
path = "#{CsvUtils.test_data_dir}/eng-england/2017-18/E0.csv"
|
22
|
-
|
23
|
-
headers = CsvUtils.header( path )
|
24
|
-
pp headers
|
25
|
-
|
26
|
-
assert_equal ['Date','HomeTeam','AwayTeam','FTHG','FTAG','HTHG','HTAG'], headers
|
27
|
-
end
|
28
|
-
|
29
|
-
###
|
30
|
-
# Country,League,Season,Date,Time,Home,Away,HG,AG,
|
31
|
-
# Res,PH,PD,PA,MaxH,MaxD,MaxA,AvgH,AvgD,AvgA
|
32
|
-
def test_at
|
33
|
-
path = "#{CsvUtils.test_data_dir}/at-austria/AUT.csv"
|
34
|
-
|
35
|
-
headers = CsvUtils.header( path )
|
36
|
-
pp headers
|
37
|
-
|
38
|
-
assert_equal ['Season','Date','Time','Home','Away','HG','AG'], headers
|
39
|
-
end
|
40
|
-
|
41
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###
|
4
|
+
# to run use
|
5
|
+
# ruby -I ./lib -I ./test test/test_headers.rb
|
6
|
+
|
7
|
+
|
8
|
+
require 'helper'
|
9
|
+
|
10
|
+
class TestHeaders < MiniTest::Test
|
11
|
+
|
12
|
+
|
13
|
+
##
|
14
|
+
# Div,Date,HomeTeam,AwayTeam,FTHG,FTAG,FTR,HTHG,HTAG,HTR,
|
15
|
+
# Referee,HS,AS,HST,AST,HF,AF,HC,AC,HY,AY,HR,AR,
|
16
|
+
# B365H,B365D,B365A,BWH,BWD,BWA,IWH,IWD,IWA,LBH,LBD,LBA,PSH,PSD,PSA,
|
17
|
+
# WHH,WHD,WHA,VCH,VCD,VCA,
|
18
|
+
# Bb1X2,BbMxH,BbAvH,BbMxD,BbAvD,BbMxA,BbAvA,BbOU,BbMx>2.5,BbAv>2.5,BbMx<2.5,BbAv<2.5,
|
19
|
+
# BbAH,BbAHh,BbMxAHH,BbAvAHH,BbMxAHA,BbAvAHA,PSCH,PSCD,PSCA
|
20
|
+
def test_eng
|
21
|
+
path = "#{CsvUtils.test_data_dir}/eng-england/2017-18/E0.csv"
|
22
|
+
|
23
|
+
headers = CsvUtils.header( path )
|
24
|
+
pp headers
|
25
|
+
|
26
|
+
assert_equal ['Date','HomeTeam','AwayTeam','FTHG','FTAG','HTHG','HTAG'], headers
|
27
|
+
end
|
28
|
+
|
29
|
+
###
|
30
|
+
# Country,League,Season,Date,Time,Home,Away,HG,AG,
|
31
|
+
# Res,PH,PD,PA,MaxH,MaxD,MaxA,AvgH,AvgD,AvgA
|
32
|
+
def test_at
|
33
|
+
path = "#{CsvUtils.test_data_dir}/at-austria/AUT.csv"
|
34
|
+
|
35
|
+
headers = CsvUtils.header( path )
|
36
|
+
pp headers
|
37
|
+
|
38
|
+
assert_equal ['Season','Date','Time','Home','Away','HG','AG'], headers
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_de
|
42
|
+
path = "#{CsvUtils.test_data_dir}/de-deutschland/bundesliga.csv"
|
43
|
+
|
44
|
+
headers = CsvUtils.header( path, sep: ';' )
|
45
|
+
pp headers
|
46
|
+
|
47
|
+
assert_equal ['Spielzeit','Saison','Spieltag','Datum','Uhrzeit','Heim','Gast','Ergebnis','Halbzeit'], headers
|
48
|
+
end
|
49
|
+
|
50
|
+
end # class TestHeaders
|
data/test/test_misc.rb
CHANGED
@@ -9,10 +9,14 @@ require 'helper'
|
|
9
9
|
|
10
10
|
class TestMiscellaneous < MiniTest::Test
|
11
11
|
|
12
|
-
def
|
12
|
+
def test_eng
|
13
13
|
path = "#{CsvUtils.test_data_dir}/eng-england/2017-18/E0.csv"
|
14
14
|
|
15
15
|
CsvUtils.test( path )
|
16
|
+
|
17
|
+
CsvUtils.stat( path )
|
18
|
+
CsvUtils.stat( path, 'HomeTeam', 'AwayTeam' )
|
19
|
+
|
16
20
|
assert true
|
17
21
|
end
|
18
22
|
|
@@ -20,6 +24,10 @@ class TestMiscellaneous < MiniTest::Test
|
|
20
24
|
path = "#{CsvUtils.test_data_dir}/de-deutschland/bundesliga.csv"
|
21
25
|
|
22
26
|
CsvUtils.test( path, sep: ';' )
|
27
|
+
|
28
|
+
CsvUtils.stat( path, sep: ';' )
|
29
|
+
CsvUtils.stat( path, 'Spielzeit', 'Saison', 'Heim', 'Gast', sep: ';' )
|
30
|
+
|
23
31
|
assert true
|
24
32
|
end
|
25
33
|
|
@@ -27,6 +35,9 @@ class TestMiscellaneous < MiniTest::Test
|
|
27
35
|
path = "#{CsvUtils.test_data_dir}/at-austria/AUT.csv"
|
28
36
|
|
29
37
|
CsvUtils.test( path )
|
38
|
+
|
39
|
+
CsvUtils.stat( path )
|
40
|
+
CsvUtils.stat( path, 'Season', 'Home', 'Away' )
|
30
41
|
assert true
|
31
42
|
end
|
32
43
|
|
data/test/test_version.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
###
|
4
|
-
# to run use
|
5
|
-
# ruby -I ./lib -I ./test test/test_version.rb
|
6
|
-
|
7
|
-
|
8
|
-
require 'helper'
|
9
|
-
|
10
|
-
class TestVersion < MiniTest::Test
|
11
|
-
|
12
|
-
def test_version
|
13
|
-
pp CsvUtils::VERSION
|
14
|
-
pp CsvUtils.banner
|
15
|
-
pp CsvUtils.root
|
16
|
-
|
17
|
-
assert true ## assume ok if we get here
|
18
|
-
end
|
19
|
-
|
20
|
-
end # class TestVersion
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###
|
4
|
+
# to run use
|
5
|
+
# ruby -I ./lib -I ./test test/test_version.rb
|
6
|
+
|
7
|
+
|
8
|
+
require 'helper'
|
9
|
+
|
10
|
+
class TestVersion < MiniTest::Test
|
11
|
+
|
12
|
+
def test_version
|
13
|
+
pp CsvUtils::VERSION
|
14
|
+
pp CsvUtils.banner
|
15
|
+
pp CsvUtils.root
|
16
|
+
|
17
|
+
assert true ## assume ok if we get here
|
18
|
+
end
|
19
|
+
|
20
|
+
end # class TestVersion
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csvutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
version: '3.16'
|
41
41
|
description: csvutils - tools 'n' scripts for working with comma-separated values
|
42
42
|
(csv) datafiles - the world's most popular tabular date interchange format in text
|
43
|
-
email:
|
43
|
+
email: wwwmake@googlegroups.com
|
44
44
|
executables: []
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files:
|
@@ -54,7 +54,10 @@ files:
|
|
54
54
|
- Rakefile
|
55
55
|
- lib/csvutils.rb
|
56
56
|
- lib/csvutils/cut.rb
|
57
|
+
- lib/csvutils/head.rb
|
58
|
+
- lib/csvutils/header.rb
|
57
59
|
- lib/csvutils/split.rb
|
60
|
+
- lib/csvutils/stat.rb
|
58
61
|
- lib/csvutils/test.rb
|
59
62
|
- lib/csvutils/utils.rb
|
60
63
|
- lib/csvutils/version.rb
|