football-to-sqlite 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3acac5aa99fe4a2b728953cc107528f257338ba7
4
- data.tar.gz: 615c52687fc05748b2c18dbdd558be5242edc9cc
3
+ metadata.gz: 1d29ed5da5ccbe1e428ddc5b95c2e31b0d48bb63
4
+ data.tar.gz: f452ef032cfdbe2443f1717c8fa27a64bce067d1
5
5
  SHA512:
6
- metadata.gz: '084e903379dfd925c31324c27abf0d5afe8e8b6a23c2daae67b2e59ef8ab94afb22036d8093cb8913775e30ee85d350c1824ece7573234d51a79a1d7bc0c6fcd'
7
- data.tar.gz: b6587e0a7215fe4a65ffdc64db9f894d556f023abc29b4693e7dad08c3699602591b50b2a9bd58c1cb095dc2cab6850f00e9875e4f4a93a549d9975a889fdde3
6
+ metadata.gz: 37536591b5ba24d020d7db075027b165d5c1838b960748a4de5ab8eb30267d6231774fdf7d9dd122224eec26691a21f68ef3e2b04c43ca582ea49453c779bd25
7
+ data.tar.gz: b13d42d79be8f053ad70ef3005d19cbc6016472ec9f4355b2563ff92bab5cad4c899d14f89dbfb5e7f761413bb39101422d1dac2b7d85750aa3fa71842db8334
@@ -12,6 +12,6 @@
12
12
  # % chmod a+x bin/football2sqlite
13
13
  #
14
14
 
15
- require 'football2sqlite'
15
+ require 'football-to-sqlite'
16
16
 
17
17
  FootballToSqlite.main
@@ -22,41 +22,36 @@ end
22
22
  def connect( dbpath )
23
23
  puts "working directory: #{Dir.pwd}"
24
24
 
25
- ## todo/fix: make sure path exists
25
+ ## note:
26
+ ## File.dirname( 'test.db' ) returns '.'
27
+ ## thus, use expand_path first to get full path
28
+ ##
29
+ ## todo/check: move mkdir into connect (for (re)use) - why? why not?
30
+ FileUtils.mkdir_p( File.dirname( File.expand_path( dbpath ))) ## make sure path exists
31
+
26
32
  SportDb.connect( adapter: 'sqlite3',
27
- database: dbpath )
33
+ database: dbpath )
34
+
35
+ SportDb.auto_migrate!
28
36
 
29
- ## todo/fix: auto-migrate !!!!
30
- SportDb.create_all
31
37
  LogDb.setup # start logging to db (that is, save logs in logs table in db)
32
38
  end
33
39
 
34
40
 
35
41
  def run( args )
36
42
 
37
- puts "-- optparse:"
38
43
  opts = {}
39
44
  optparser = OptionParser.new do |parser|
40
- parser.banner = "Usage: football-to-sqlite [options] database PATH"
41
-
42
- # parser.on( "-d", "--download", "Download web pages" ) do |download|
43
- # opts[:download] = download
44
- # end
45
-
46
- # parser.on( "-p", "--push", "(Commit &) push changes to git" ) do |push|
47
- # opts[:push] = push
48
- # end
49
-
45
+ parser.banner = "Usage: football-to-sqlite [options] DATABASE PATHS..."
50
46
  end
51
47
  optparser.parse!( args )
52
48
 
53
- puts "opts:"
54
- p opts
55
- puts "args:"
56
- p args
49
+ if args.empty?
50
+ puts "!! ERROR - sqlite database name/path expected (e.g. sport.db)"
51
+ puts optparser.help
52
+ exit 1
53
+ end
57
54
 
58
- puts "-------"
59
- puts
60
55
  dbpath = args.shift
61
56
  puts "dbpath: >#{dbpath}<"
62
57
  puts "args:"
@@ -66,9 +61,26 @@ def run( args )
66
61
 
67
62
  args.each do |arg|
68
63
  puts "reading #{arg}..."
69
- SportDb.read( arg )
64
+ ## note: only support reading matchfiles for now (NOT zips & dirs or clubs & leagues etc.)
65
+ # SportDb.read_match( arg )
66
+ end
67
+
68
+ ## todo: check if stdin is always utf-8 or such?
69
+ unless STDIN.tty?
70
+ puts "reading STDIN..."
71
+ ## assume/ read stdin as utf8 - possible?
72
+ txt = STDIN.read
73
+ puts "[------------->>>"
74
+ puts txt
75
+ puts "<<<-------------]"
76
+ # SportDb.parse_match( txt )
77
+ puts "encoding: #{txt.encoding}"
70
78
  end
71
79
 
80
+
81
+ ## print some stats
82
+ SportDb.tables
83
+
72
84
  puts "Done."
73
85
  end # method run
74
86
 
@@ -4,7 +4,7 @@ module Module
4
4
  module FootballToSqlite
5
5
 
6
6
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
7
- MINOR = 1
7
+ MINOR = 2
8
8
  PATCH = 0
9
9
  VERSION = [MAJOR,MINOR,PATCH].join('.')
10
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: football-to-sqlite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-16 00:00:00.000000000 Z
11
+ date: 2020-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sportdb-readers