football-to-sqlite 0.0.1 → 0.1.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 +4 -4
- data/Manifest.txt +2 -0
- data/bin/football-to-sqlite +17 -0
- data/bin/football2sqlite +17 -0
- data/lib/football-to-sqlite.rb +71 -0
- data/lib/football-to-sqlite/version.rb +2 -2
- metadata +6 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3acac5aa99fe4a2b728953cc107528f257338ba7
|
|
4
|
+
data.tar.gz: 615c52687fc05748b2c18dbdd558be5242edc9cc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '084e903379dfd925c31324c27abf0d5afe8e8b6a23c2daae67b2e59ef8ab94afb22036d8093cb8913775e30ee85d350c1824ece7573234d51a79a1d7bc0c6fcd'
|
|
7
|
+
data.tar.gz: b6587e0a7215fe4a65ffdc64db9f894d556f023abc29b4693e7dad08c3699602591b50b2a9bd58c1cb095dc2cab6850f00e9875e4f4a93a549d9975a889fdde3
|
data/Manifest.txt
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
###################
|
|
4
|
+
# == DEV TIPS:
|
|
5
|
+
#
|
|
6
|
+
# For local testing run like:
|
|
7
|
+
#
|
|
8
|
+
# ruby -Ilib bin/football-to-sqlite
|
|
9
|
+
#
|
|
10
|
+
# Set the executable bit in Linux. Example:
|
|
11
|
+
#
|
|
12
|
+
# % chmod a+x bin/football-to-sqlite
|
|
13
|
+
#
|
|
14
|
+
|
|
15
|
+
require 'football-to-sqlite'
|
|
16
|
+
|
|
17
|
+
FootballToSqlite.main
|
data/bin/football2sqlite
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
###################
|
|
4
|
+
# == DEV TIPS:
|
|
5
|
+
#
|
|
6
|
+
# For local testing run like:
|
|
7
|
+
#
|
|
8
|
+
# ruby -Ilib bin/football2sqlite
|
|
9
|
+
#
|
|
10
|
+
# Set the executable bit in Linux. Example:
|
|
11
|
+
#
|
|
12
|
+
# % chmod a+x bin/football2sqlite
|
|
13
|
+
#
|
|
14
|
+
|
|
15
|
+
require 'football2sqlite'
|
|
16
|
+
|
|
17
|
+
FootballToSqlite.main
|
data/lib/football-to-sqlite.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'optparse'
|
|
2
|
+
|
|
1
3
|
require 'sportdb/readers'
|
|
2
4
|
|
|
3
5
|
require 'logutils/activerecord' ## NOTE: check - add to/include in/move to sportdb/models
|
|
@@ -9,6 +11,75 @@ require 'logutils/activerecord' ## NOTE: check - add to/include in/move to spo
|
|
|
9
11
|
require 'football-to-sqlite/version' # let version always go first
|
|
10
12
|
|
|
11
13
|
|
|
14
|
+
module FootballToSqlite
|
|
15
|
+
class Tool
|
|
16
|
+
|
|
17
|
+
def initialize
|
|
18
|
+
LogUtils::Logger.root.level = :info # set logging level to info
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def connect( dbpath )
|
|
23
|
+
puts "working directory: #{Dir.pwd}"
|
|
24
|
+
|
|
25
|
+
## todo/fix: make sure path exists
|
|
26
|
+
SportDb.connect( adapter: 'sqlite3',
|
|
27
|
+
database: dbpath )
|
|
28
|
+
|
|
29
|
+
## todo/fix: auto-migrate !!!!
|
|
30
|
+
SportDb.create_all
|
|
31
|
+
LogDb.setup # start logging to db (that is, save logs in logs table in db)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def run( args )
|
|
36
|
+
|
|
37
|
+
puts "-- optparse:"
|
|
38
|
+
opts = {}
|
|
39
|
+
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
|
+
|
|
50
|
+
end
|
|
51
|
+
optparser.parse!( args )
|
|
52
|
+
|
|
53
|
+
puts "opts:"
|
|
54
|
+
p opts
|
|
55
|
+
puts "args:"
|
|
56
|
+
p args
|
|
57
|
+
|
|
58
|
+
puts "-------"
|
|
59
|
+
puts
|
|
60
|
+
dbpath = args.shift
|
|
61
|
+
puts "dbpath: >#{dbpath}<"
|
|
62
|
+
puts "args:"
|
|
63
|
+
p args
|
|
64
|
+
|
|
65
|
+
connect( dbpath )
|
|
66
|
+
|
|
67
|
+
args.each do |arg|
|
|
68
|
+
puts "reading #{arg}..."
|
|
69
|
+
SportDb.read( arg )
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
puts "Done."
|
|
73
|
+
end # method run
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
end # class Tool
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def self.main( args=ARGV ) Tool.new.run( args ); end
|
|
80
|
+
end # module FootballToSqlite
|
|
81
|
+
|
|
82
|
+
|
|
12
83
|
|
|
13
84
|
|
|
14
85
|
puts SportDb::Module::FootballToSqlite.banner # say hello
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: football-to-sqlite
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gerald Bauer
|
|
@@ -74,7 +74,9 @@ dependencies:
|
|
|
74
74
|
version: '3.22'
|
|
75
75
|
description: football-to-sqlite - load football.txt datafiles into a sqlite database
|
|
76
76
|
email: opensport@googlegroups.com
|
|
77
|
-
executables:
|
|
77
|
+
executables:
|
|
78
|
+
- football-to-sqlite
|
|
79
|
+
- football2sqlite
|
|
78
80
|
extensions: []
|
|
79
81
|
extra_rdoc_files:
|
|
80
82
|
- CHANGELOG.md
|
|
@@ -85,6 +87,8 @@ files:
|
|
|
85
87
|
- Manifest.txt
|
|
86
88
|
- README.md
|
|
87
89
|
- Rakefile
|
|
90
|
+
- bin/football-to-sqlite
|
|
91
|
+
- bin/football2sqlite
|
|
88
92
|
- lib/football-to-sqlite.rb
|
|
89
93
|
- lib/football-to-sqlite/version.rb
|
|
90
94
|
- test/helper.rb
|