persondb 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: aa10af4e394c638075a36596fce234db307645e4
4
+ data.tar.gz: c410185d031420f2122b86f3c0c853ba3b2d7885
5
+ SHA512:
6
+ metadata.gz: a225a1f9699e149a6c540515bac204152828f825858ac5a86da0164bdc4aa657b90589ca35ab1515d00e2d33cdd02d8a1a58a1c67da7feeb4640b3578d5b24af
7
+ data.tar.gz: 94a36208e799bec83d98ed270edc740fd7178dcaaf2cf9bbf2b476288cac7bcd7938dbb6192222dd5ae2d103a55206a44f3031fb290efebcc0edf514eae3e363
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # persondb
2
2
 
3
- persondb gems - person schema n models for easy (re) use
3
+ persondb gems - person schema 'n' models for easy (re) use
4
4
 
5
- * home :: [github.com/geraldb/person.db.ruby](https://github.com/geraldb/person.db.ruby)
6
- * bugs :: [github.com/geraldb/person.db.ruby/issues](https://github.com/geraldb/person.db.ruby/issues)
5
+ * home :: [github.com/persondb/person.db.ruby](https://github.com/persondb/person.db.ruby)
6
+ * bugs :: [github.com/persondb/person.db.ruby/issues](https://github.com/persondb/person.db.ruby/issues)
7
7
  * gem :: [rubygems.org/gems/persondb](https://rubygems.org/gems/persondb)
8
8
  * rdoc :: [rubydoc.info/gems/persondb](http://rubydoc.info/gems/persondb)
9
9
 
data/Rakefile CHANGED
@@ -5,10 +5,10 @@ Hoe.spec 'persondb' do
5
5
 
6
6
  self.version = PersonDb::VERSION
7
7
 
8
- self.summary = 'persondb - person schema n models for easy (re)use'
8
+ self.summary = "persondb - person schema 'n' models for easy (re)use"
9
9
  self.description = summary
10
10
 
11
- self.urls = ['https://github.com/geraldb/person.db.ruby']
11
+ self.urls = ['https://github.com/persondb/person.db.ruby']
12
12
 
13
13
  self.author = 'Gerald Bauer'
14
14
  self.email = 'webslideshow@googlegroups.com'
@@ -21,7 +21,7 @@ Hoe.spec 'persondb' do
21
21
  ['props' ],
22
22
  ['logutils'],
23
23
  ['textutils'],
24
- ['worlddb'],
24
+ ['worlddb-models'],
25
25
  ['tagutils'], # tags n tagging tables
26
26
  ['activerecord-utils'], # extras e.g. rnd, find_by! for 3.x etc.
27
27
  ## 3rd party
@@ -31,8 +31,8 @@ Hoe.spec 'persondb' do
31
31
  self.licenses = ['Public Domain']
32
32
 
33
33
  self.spec_extras = {
34
- :required_ruby_version => '>= 1.9.2'
34
+ required_ruby_version: '>= 1.9.2'
35
35
  }
36
36
 
37
-
38
37
  end
38
+
@@ -1,17 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
- # core and stdlibs
4
- # todo: check already included in worlddb - thus, remove? why? why not?
5
- require 'json'
6
- require 'uri'
7
- require 'pp'
8
-
9
3
 
10
4
  # 3rd party gems / libs
11
- require 'worlddb' # note: let worlddb pull in all 3rd party gems / libs (do NOT duplicate here)
12
-
13
- ## fix: add/move to worlddb
14
- require 'logutils/db'
5
+ require 'worlddb/models' # note: let worlddb pull in all 3rd party gems / libs (do NOT duplicate here)
15
6
 
16
7
 
17
8
  ### our own code
@@ -83,6 +74,5 @@ module PersonDb
83
74
 
84
75
  end # module PersonDb
85
76
 
86
-
87
- puts PersonDb.banner # say hello
88
-
77
+ # say hello
78
+ puts PersonDb.banner if $DEBUG || (defined?($RUBYLIBS_DEBUG) && $RUBYLIBS_DEBUG)
@@ -1,4 +1,5 @@
1
- # encoding: UTF-8
1
+ # encoding: utf-8
2
+
2
3
 
3
4
  module PersonDb
4
5
 
@@ -11,23 +12,41 @@ class PersonReader
11
12
  # e.g. lets you use Usage instead of Model::Usage
12
13
  include Models
13
14
 
15
+ def self.from_zip( zip_file, entry_path, more_attribs={} )
16
+ ## get text content from zip
17
+ entry = zip_file.find_entry( entry_path )
18
+
19
+ text = entry.get_input_stream().read()
20
+ text = text.force_encoding( Encoding::UTF_8 )
14
21
 
15
- attr_reader :include_path
22
+ self.from_string( text, more_attribs )
23
+ end
16
24
 
17
- def initialize( include_path, opts = {} )
18
- @include_path = include_path
25
+ def self.from_file( path, more_attribs={} )
26
+ ## note: assume/enfore utf-8 encoding (with or without BOM - byte order mark)
27
+ ## - see textutils/utils.rb
28
+ text = File.read_utf8( path )
29
+ self.from_string( text, more_attribs )
19
30
  end
20
31
 
32
+ def self.from_string( text, more_attribs={} )
33
+ PersonReader.new( text, more_attribs )
34
+ end
35
+
21
36
 
22
- def read( name, more_attribs={} )
23
- reader = ValuesReaderV2.new( name, include_path, more_attribs )
37
+ def initialize( text, more_attribs={} )
38
+ ## todo/fix: how to add opts={} ???
39
+ @text = text
40
+ @more_attribs = more_attribs
41
+ end
42
+
43
+ def read()
44
+ reader = ValuesReader.from_string( @text, @more_attribs )
24
45
 
25
46
  reader.each_line do |new_attributes, values|
26
47
  Person.create_or_update_from_values( new_attributes, values )
27
48
  end # each lines
28
49
  end
29
50
 
30
-
31
51
  end # class PersonReader
32
52
  end # module PersonDb
33
-
@@ -1,5 +1,5 @@
1
1
 
2
2
  module PersonDb
3
- VERSION = '0.3.1'
3
+ VERSION = '0.4.0'
4
4
  end
5
5
 
@@ -1,15 +1,10 @@
1
- # encoding: UTF-8
1
+ # encoding: utf-8
2
2
 
3
3
  ## $:.unshift(File.dirname(__FILE__))
4
4
 
5
5
  ## minitest setup
6
-
7
- # require 'minitest/unit'
8
6
  require 'minitest/autorun'
9
7
 
10
- # include MiniTest::Unit # lets us use TestCase instead of MiniTest::Unit::TestCase
11
-
12
-
13
8
  # our own code
14
9
 
15
10
  require 'persondb'
@@ -4,7 +4,7 @@
4
4
  require 'helper'
5
5
 
6
6
 
7
- class TestModels < MiniTest::Unit::TestCase
7
+ class TestModels < MiniTest::Test
8
8
 
9
9
  def setup # runs before every test
10
10
  PersonDb.delete! # always clean-out tables
@@ -3,7 +3,7 @@
3
3
  require 'helper'
4
4
 
5
5
 
6
- class TestReader < MiniTest::Unit::TestCase
6
+ class TestReader < MiniTest::Test
7
7
 
8
8
  def setup # runs before every test
9
9
  PersonDb.delete! # always clean-out tables
@@ -19,8 +19,9 @@ class TestReader < MiniTest::Unit::TestCase
19
19
  def test_read
20
20
  br = Country.find_by_key!( 'br' )
21
21
 
22
- reader = PersonReader.new( PersonDb.test_data_path )
23
- reader.read( 'players/south-america/br-brazil/players', country_id: br.id )
22
+ path = "#{PersonDb.test_data_path}/players/south-america/br-brazil/players.txt"
23
+ reader = PersonReader.from_file( path, country_id: br.id )
24
+ reader.read()
24
25
 
25
26
  assert_equal 23, Person.count
26
27
  assert_equal 23, br.persons.count
metadata CHANGED
@@ -1,116 +1,142 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: persondb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
5
- prerelease:
4
+ version: 0.4.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Gerald Bauer
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-05-24 00:00:00.000000000 Z
11
+ date: 2014-12-05 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: props
16
- requirement: &75685120 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *75685120
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: logutils
27
- requirement: &75684720 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - ">="
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *75684720
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: textutils
38
- requirement: &75684280 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
- - - ! '>='
45
+ - - ">="
42
46
  - !ruby/object:Gem::Version
43
47
  version: '0'
44
48
  type: :runtime
45
49
  prerelease: false
46
- version_requirements: *75684280
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
47
55
  - !ruby/object:Gem::Dependency
48
- name: worlddb
49
- requirement: &75683770 !ruby/object:Gem::Requirement
50
- none: false
56
+ name: worlddb-models
57
+ requirement: !ruby/object:Gem::Requirement
51
58
  requirements:
52
- - - ! '>='
59
+ - - ">="
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  type: :runtime
56
63
  prerelease: false
57
- version_requirements: *75683770
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: tagutils
60
- requirement: &75683300 !ruby/object:Gem::Requirement
61
- none: false
71
+ requirement: !ruby/object:Gem::Requirement
62
72
  requirements:
63
- - - ! '>='
73
+ - - ">="
64
74
  - !ruby/object:Gem::Version
65
75
  version: '0'
66
76
  type: :runtime
67
77
  prerelease: false
68
- version_requirements: *75683300
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: activerecord-utils
71
- requirement: &75682920 !ruby/object:Gem::Requirement
72
- none: false
85
+ requirement: !ruby/object:Gem::Requirement
73
86
  requirements:
74
- - - ! '>='
87
+ - - ">="
75
88
  - !ruby/object:Gem::Version
76
89
  version: '0'
77
90
  type: :runtime
78
91
  prerelease: false
79
- version_requirements: *75682920
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
80
97
  - !ruby/object:Gem::Dependency
81
98
  name: activerecord
82
- requirement: &75682620 !ruby/object:Gem::Requirement
83
- none: false
99
+ requirement: !ruby/object:Gem::Requirement
84
100
  requirements:
85
- - - ! '>='
101
+ - - ">="
86
102
  - !ruby/object:Gem::Version
87
103
  version: '0'
88
104
  type: :runtime
89
105
  prerelease: false
90
- version_requirements: *75682620
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
91
111
  - !ruby/object:Gem::Dependency
92
112
  name: rdoc
93
- requirement: &75682000 !ruby/object:Gem::Requirement
94
- none: false
113
+ requirement: !ruby/object:Gem::Requirement
95
114
  requirements:
96
- - - ~>
115
+ - - "~>"
97
116
  - !ruby/object:Gem::Version
98
117
  version: '4.0'
99
118
  type: :development
100
119
  prerelease: false
101
- version_requirements: *75682000
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '4.0'
102
125
  - !ruby/object:Gem::Dependency
103
126
  name: hoe
104
- requirement: &75681240 !ruby/object:Gem::Requirement
105
- none: false
127
+ requirement: !ruby/object:Gem::Requirement
106
128
  requirements:
107
- - - ~>
129
+ - - "~>"
108
130
  - !ruby/object:Gem::Version
109
- version: '3.11'
131
+ version: '3.13'
110
132
  type: :development
111
133
  prerelease: false
112
- version_requirements: *75681240
113
- description: persondb - person schema n models for easy (re)use
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '3.13'
139
+ description: persondb - person schema 'n' models for easy (re)use
114
140
  email: webslideshow@googlegroups.com
115
141
  executables: []
116
142
  extensions: []
@@ -119,6 +145,7 @@ extra_rdoc_files:
119
145
  - Manifest.txt
120
146
  - README.md
121
147
  files:
148
+ - ".gemtest"
122
149
  - HISTORY.md
123
150
  - Manifest.txt
124
151
  - README.md
@@ -136,34 +163,32 @@ files:
136
163
  - test/helper.rb
137
164
  - test/test_models.rb
138
165
  - test/test_reader.rb
139
- - .gemtest
140
- homepage: https://github.com/geraldb/person.db.ruby
166
+ homepage: https://github.com/persondb/person.db.ruby
141
167
  licenses:
142
168
  - Public Domain
169
+ metadata: {}
143
170
  post_install_message:
144
171
  rdoc_options:
145
- - --main
172
+ - "--main"
146
173
  - README.md
147
174
  require_paths:
148
175
  - lib
149
176
  required_ruby_version: !ruby/object:Gem::Requirement
150
- none: false
151
177
  requirements:
152
- - - ! '>='
178
+ - - ">="
153
179
  - !ruby/object:Gem::Version
154
180
  version: 1.9.2
155
181
  required_rubygems_version: !ruby/object:Gem::Requirement
156
- none: false
157
182
  requirements:
158
- - - ! '>='
183
+ - - ">="
159
184
  - !ruby/object:Gem::Version
160
185
  version: '0'
161
186
  requirements: []
162
187
  rubyforge_project:
163
- rubygems_version: 1.8.17
188
+ rubygems_version: 2.4.2
164
189
  signing_key:
165
- specification_version: 3
166
- summary: persondb - person schema n models for easy (re)use
190
+ specification_version: 4
191
+ summary: persondb - person schema 'n' models for easy (re)use
167
192
  test_files:
168
193
  - test/test_models.rb
169
194
  - test/test_reader.rb