worlddb 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -4
- data/Rakefile +4 -2
- data/lib/worlddb/cli/main.rb +61 -1
- data/lib/worlddb/reader.rb +1 -3
- data/lib/worlddb/version.rb +1 -1
- metadata +57 -96
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
# worlddb
|
1
|
+
# worlddb - world.db Command Line Tool in Ruby
|
2
2
|
|
3
|
-
world.db
|
4
|
-
|
5
|
-
* [
|
3
|
+
* home :: [github.com/geraldb/world.db.ruby](https://github.com/geraldb/world.db.ruby)
|
4
|
+
* bugs :: [github.com/geraldb/world.db.ruby/issues](https://github.com/geraldb/world.db.ruby/issues)
|
5
|
+
* gem :: [rubygems.org/gems/worldb](https://rubygems.org/gems/worlddb)
|
6
|
+
* rdoc :: [rubydoc.info/gems/wrolddb](http://rubydoc.info/gems/worlddb)
|
7
|
+
* forum :: [groups.google.com/group/opensport](https://groups.google.com/group/opensport)
|
6
8
|
|
7
9
|
|
8
10
|
## Usage
|
data/Rakefile
CHANGED
@@ -19,7 +19,7 @@ Hoe.spec 'worlddb' do
|
|
19
19
|
self.email = 'opensport@googlegroups.com'
|
20
20
|
|
21
21
|
self.extra_deps = [
|
22
|
-
['textutils', '
|
22
|
+
['textutils', '>= 0.5.0'],
|
23
23
|
['commander', '~> 4.1.3'],
|
24
24
|
['activerecord', '~> 3.2'] # NB: will include activesupport,etc.
|
25
25
|
### ['sqlite3', '~> 1.3'] # NB: install on your own; remove dependency
|
@@ -58,6 +58,8 @@ namespace :dev do
|
|
58
58
|
task :env => BUILD_DIR do
|
59
59
|
require './lib/worlddb.rb'
|
60
60
|
|
61
|
+
LogUtils::Logger.root.level = :info
|
62
|
+
|
61
63
|
pp DB_CONFIG
|
62
64
|
ActiveRecord::Base.establish_connection( DB_CONFIG )
|
63
65
|
end
|
@@ -67,7 +69,7 @@ namespace :dev do
|
|
67
69
|
end
|
68
70
|
|
69
71
|
task :import => :env do
|
70
|
-
WorldDB.read_all # populate world tables
|
72
|
+
WorldDB.read_all( '../world.db' ) # populate world tables
|
71
73
|
WorldDB.stats
|
72
74
|
end
|
73
75
|
|
data/lib/worlddb/cli/main.rb
CHANGED
@@ -5,6 +5,7 @@ require 'commander/import'
|
|
5
5
|
require 'logutils/db' # add support for logging to db
|
6
6
|
require 'worlddb/cli/opts'
|
7
7
|
|
8
|
+
LogUtils::Logger.root.level = :info # set logging level to info
|
8
9
|
|
9
10
|
|
10
11
|
program :name, 'worlddb'
|
@@ -44,6 +45,10 @@ global_option '-i', '--include PATH', String, "Data path (default is #{myopts.da
|
|
44
45
|
global_option '-d', '--dbpath PATH', String, "Database path (default is #{myopts.db_path})"
|
45
46
|
global_option '-n', '--dbname NAME', String, "Database name (datault is #{myopts.db_name})"
|
46
47
|
|
48
|
+
global_option '-q', '--quiet', "Only show warnings, errors and fatal messages"
|
49
|
+
### todo/fix: just want --debug/--verbose flag (no single letter option wanted) - fix
|
50
|
+
global_option '-w', '--verbose', "Show debug messages"
|
51
|
+
|
47
52
|
|
48
53
|
def connect_to_db( options )
|
49
54
|
puts WorldDB.banner
|
@@ -68,6 +73,10 @@ command :create do |c|
|
|
68
73
|
c.syntax = 'worlddb create [options]'
|
69
74
|
c.description = 'Create DB schema'
|
70
75
|
c.action do |args, options|
|
76
|
+
|
77
|
+
LogUtils::Logger.root.level = :warn if options.quiet.present?
|
78
|
+
LogUtils::Logger.root.level = :debug if options.verbose.present?
|
79
|
+
|
71
80
|
myopts.merge_commander_options!( options.__hash__ )
|
72
81
|
connect_to_db( myopts )
|
73
82
|
|
@@ -84,6 +93,10 @@ command :setup do |c|
|
|
84
93
|
c.option '--delete', 'Delete all records'
|
85
94
|
|
86
95
|
c.action do |args, options|
|
96
|
+
|
97
|
+
LogUtils::Logger.root.level = :warn if options.quiet.present?
|
98
|
+
LogUtils::Logger.root.level = :debug if options.verbose.present?
|
99
|
+
|
87
100
|
myopts.merge_commander_options!( options.__hash__ )
|
88
101
|
connect_to_db( myopts )
|
89
102
|
|
@@ -115,6 +128,10 @@ command :load do |c|
|
|
115
128
|
c.option '--delete', 'Delete all records'
|
116
129
|
|
117
130
|
c.action do |args, options|
|
131
|
+
|
132
|
+
LogUtils::Logger.root.level = :warn if options.quiet.present?
|
133
|
+
LogUtils::Logger.root.level = :debug if options.verbose.present?
|
134
|
+
|
118
135
|
myopts.merge_commander_options!( options.__hash__ )
|
119
136
|
connect_to_db( myopts )
|
120
137
|
|
@@ -147,16 +164,59 @@ command :stats do |c|
|
|
147
164
|
c.syntax = 'worlddb stats [options]'
|
148
165
|
c.description = 'Show stats'
|
149
166
|
c.action do |args, options|
|
167
|
+
|
168
|
+
LogUtils::Logger.root.level = :warn if options.quiet.present?
|
169
|
+
LogUtils::Logger.root.level = :debug if options.verbose.present?
|
170
|
+
|
150
171
|
myopts.merge_commander_options!( options.__hash__ )
|
151
172
|
connect_to_db( myopts )
|
152
173
|
|
153
|
-
WorldDB.
|
174
|
+
WorldDB.tables
|
154
175
|
|
155
176
|
puts 'Done.'
|
156
177
|
end
|
157
178
|
end
|
158
179
|
|
159
180
|
|
181
|
+
command :props do |c|
|
182
|
+
c.syntax = 'worlddb props [options]'
|
183
|
+
c.description = 'Show props'
|
184
|
+
c.action do |args, options|
|
185
|
+
|
186
|
+
LogUtils::Logger.root.level = :warn if options.quiet.present?
|
187
|
+
LogUtils::Logger.root.level = :debug if options.verbose.present?
|
188
|
+
|
189
|
+
myopts.merge_commander_options!( options.__hash__ )
|
190
|
+
connect_to_db( myopts )
|
191
|
+
|
192
|
+
WorldDB.props
|
193
|
+
|
194
|
+
puts 'Done.'
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
|
199
|
+
command :logs do |c|
|
200
|
+
c.syntax = 'worlddb logs [options]'
|
201
|
+
c.description = 'Show logs'
|
202
|
+
c.action do |args, options|
|
203
|
+
|
204
|
+
LogUtils::Logger.root.level = :warn if options.quiet.present?
|
205
|
+
LogUtils::Logger.root.level = :debug if options.verbose.present?
|
206
|
+
|
207
|
+
myopts.merge_commander_options!( options.__hash__ )
|
208
|
+
connect_to_db( myopts )
|
209
|
+
|
210
|
+
LogDB::Models::Log.all.each do |log|
|
211
|
+
puts "[#{log.level}] -- #{log.msg}"
|
212
|
+
end
|
213
|
+
|
214
|
+
puts 'Done.'
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
|
219
|
+
|
160
220
|
command :test do |c|
|
161
221
|
c.syntax = 'worlddb test [options]'
|
162
222
|
c.description = 'Debug/test command suite'
|
data/lib/worlddb/reader.rb
CHANGED
data/lib/worlddb/version.rb
CHANGED
metadata
CHANGED
@@ -1,108 +1,79 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: worlddb
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.3.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 2
|
9
|
-
- 0
|
10
|
-
version: 1.2.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Gerald Bauer
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-02-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: textutils
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &73677590 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
- 4
|
32
|
-
- 0
|
33
|
-
version: 0.4.0
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.5.0
|
34
22
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: commander
|
38
23
|
prerelease: false
|
39
|
-
|
24
|
+
version_requirements: *73677590
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: commander
|
27
|
+
requirement: &73677370 !ruby/object:Gem::Requirement
|
40
28
|
none: false
|
41
|
-
requirements:
|
29
|
+
requirements:
|
42
30
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 61
|
45
|
-
segments:
|
46
|
-
- 4
|
47
|
-
- 1
|
48
|
-
- 3
|
31
|
+
- !ruby/object:Gem::Version
|
49
32
|
version: 4.1.3
|
50
33
|
type: :runtime
|
51
|
-
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: activerecord
|
54
34
|
prerelease: false
|
55
|
-
|
35
|
+
version_requirements: *73677370
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: activerecord
|
38
|
+
requirement: &73677160 !ruby/object:Gem::Requirement
|
56
39
|
none: false
|
57
|
-
requirements:
|
40
|
+
requirements:
|
58
41
|
- - ~>
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
segments:
|
62
|
-
- 3
|
63
|
-
- 2
|
64
|
-
version: "3.2"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '3.2'
|
65
44
|
type: :runtime
|
66
|
-
version_requirements: *id003
|
67
|
-
- !ruby/object:Gem::Dependency
|
68
|
-
name: rdoc
|
69
45
|
prerelease: false
|
70
|
-
|
46
|
+
version_requirements: *73677160
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rdoc
|
49
|
+
requirement: &73676940 !ruby/object:Gem::Requirement
|
71
50
|
none: false
|
72
|
-
requirements:
|
51
|
+
requirements:
|
73
52
|
- - ~>
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
|
76
|
-
segments:
|
77
|
-
- 3
|
78
|
-
- 10
|
79
|
-
version: "3.10"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.10'
|
80
55
|
type: :development
|
81
|
-
version_requirements: *id004
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: hoe
|
84
56
|
prerelease: false
|
85
|
-
|
57
|
+
version_requirements: *73676940
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: hoe
|
60
|
+
requirement: &73676720 !ruby/object:Gem::Requirement
|
86
61
|
none: false
|
87
|
-
requirements:
|
62
|
+
requirements:
|
88
63
|
- - ~>
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
|
91
|
-
segments:
|
92
|
-
- 3
|
93
|
-
- 3
|
94
|
-
version: "3.3"
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '3.3'
|
95
66
|
type: :development
|
96
|
-
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *73676720
|
97
69
|
description: worlddb - world.db command line tool
|
98
70
|
email: opensport@googlegroups.com
|
99
|
-
executables:
|
71
|
+
executables:
|
100
72
|
- worlddb
|
101
73
|
extensions: []
|
102
|
-
|
103
|
-
extra_rdoc_files:
|
74
|
+
extra_rdoc_files:
|
104
75
|
- Manifest.txt
|
105
|
-
files:
|
76
|
+
files:
|
106
77
|
- History.md
|
107
78
|
- Manifest.txt
|
108
79
|
- README.md
|
@@ -128,40 +99,30 @@ files:
|
|
128
99
|
- lib/worlddb/utils.rb
|
129
100
|
- lib/worlddb/version.rb
|
130
101
|
homepage: https://github.com/geraldb/world.db.ruby
|
131
|
-
licenses:
|
102
|
+
licenses:
|
132
103
|
- Public Domain
|
133
104
|
post_install_message:
|
134
|
-
rdoc_options:
|
105
|
+
rdoc_options:
|
135
106
|
- --main
|
136
107
|
- README.md
|
137
|
-
require_paths:
|
108
|
+
require_paths:
|
138
109
|
- lib
|
139
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
140
111
|
none: false
|
141
|
-
requirements:
|
142
|
-
- -
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
hash: 55
|
145
|
-
segments:
|
146
|
-
- 1
|
147
|
-
- 9
|
148
|
-
- 2
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
149
115
|
version: 1.9.2
|
150
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
117
|
none: false
|
152
|
-
requirements:
|
153
|
-
- -
|
154
|
-
- !ruby/object:Gem::Version
|
155
|
-
|
156
|
-
segments:
|
157
|
-
- 0
|
158
|
-
version: "0"
|
118
|
+
requirements:
|
119
|
+
- - ! '>='
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
159
122
|
requirements: []
|
160
|
-
|
161
123
|
rubyforge_project: worlddb
|
162
|
-
rubygems_version: 1.8.
|
124
|
+
rubygems_version: 1.8.17
|
163
125
|
signing_key:
|
164
126
|
specification_version: 3
|
165
127
|
summary: worlddb - world.db command line tool
|
166
128
|
test_files: []
|
167
|
-
|