football-to-sqlite 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40d1867be227e045464b28b28fb470eaaa25b985
4
- data.tar.gz: fd14f55f64f729da43037d214455daca6d06c453
3
+ metadata.gz: 3acac5aa99fe4a2b728953cc107528f257338ba7
4
+ data.tar.gz: 615c52687fc05748b2c18dbdd558be5242edc9cc
5
5
  SHA512:
6
- metadata.gz: ef02351772ea1cf6bdeaa532188dc9b4c1cd0d8a80439016240d676408f60389cc0e73e3ced29e31de80467a6ffc5571954b400284d43dfbc8ca44376a7a1f87
7
- data.tar.gz: 27a30b8f779957a8364b8abcb44bcb483b37ba294c0226bee9c0d7c1a932ed9b5a7a2cc5728d3c11e823397f81cca2a1f5d8617c09bd10255ead5f96b8065ca8
6
+ metadata.gz: '084e903379dfd925c31324c27abf0d5afe8e8b6a23c2daae67b2e59ef8ab94afb22036d8093cb8913775e30ee85d350c1824ece7573234d51a79a1d7bc0c6fcd'
7
+ data.tar.gz: b6587e0a7215fe4a65ffdc64db9f894d556f023abc29b4693e7dad08c3699602591b50b2a9bd58c1cb095dc2cab6850f00e9875e4f4a93a549d9975a889fdde3
@@ -2,6 +2,8 @@ CHANGELOG.md
2
2
  Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
+ bin/football-to-sqlite
6
+ bin/football2sqlite
5
7
  lib/football-to-sqlite.rb
6
8
  lib/football-to-sqlite/version.rb
7
9
  test/helper.rb
@@ -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
@@ -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
@@ -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
@@ -4,8 +4,8 @@ module Module
4
4
  module FootballToSqlite
5
5
 
6
6
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
7
- MINOR = 0
8
- PATCH = 1
7
+ MINOR = 1
8
+ PATCH = 0
9
9
  VERSION = [MAJOR,MINOR,PATCH].join('.')
10
10
 
11
11
  def self.version
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.1
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