kindai 1.6.2 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/kindai.gemspec +3 -4
- data/lib/kindai/book.rb +5 -0
- data/lib/kindai/util/database.rb +13 -2
- data/spec/book_spec.rb +4 -0
- metadata +80 -122
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.7.0
|
data/kindai.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{kindai}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.7.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["hitode909"]
|
12
|
-
s.date = %q{2011-05-
|
12
|
+
s.date = %q{2011-05-24}
|
13
13
|
s.default_executable = %q{kindai.rb}
|
14
14
|
s.description = %q{kindai.rb is kindai digital library downloader.}
|
15
15
|
s.email = %q{hitode909@gmail.com}
|
@@ -51,7 +51,7 @@ Gem::Specification.new do |s|
|
|
51
51
|
s.licenses = ["MIT"]
|
52
52
|
s.rdoc_options = ["--main", "README.rdoc", "--exclude", "spec"]
|
53
53
|
s.require_paths = ["lib"]
|
54
|
-
s.rubygems_version = %q{1.
|
54
|
+
s.rubygems_version = %q{1.5.2}
|
55
55
|
s.summary = %q{kindai digital library downloader}
|
56
56
|
s.test_files = [
|
57
57
|
"spec/book_downloader_spec.rb",
|
@@ -63,7 +63,6 @@ Gem::Specification.new do |s|
|
|
63
63
|
]
|
64
64
|
|
65
65
|
if s.respond_to? :specification_version then
|
66
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
67
66
|
s.specification_version = 3
|
68
67
|
|
69
68
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
data/lib/kindai/book.rb
CHANGED
data/lib/kindai/util/database.rb
CHANGED
@@ -7,6 +7,7 @@ require 'ostruct'
|
|
7
7
|
module Kindai::Util::Database
|
8
8
|
ENDPOINT = URI.parse 'http://gigaschema.appspot.com/hitode909/kindai.json'
|
9
9
|
|
10
|
+
# XXX: deprecated, page 1 only
|
10
11
|
def self.items
|
11
12
|
@items ||= JSON.parse(open(ENDPOINT).read)['data'].map{|item|
|
12
13
|
begin
|
@@ -21,7 +22,17 @@ module Kindai::Util::Database
|
|
21
22
|
end
|
22
23
|
|
23
24
|
def self.item_for_book(book)
|
24
|
-
|
25
|
+
path = ENDPOINT + "?group=#{book.key}"
|
26
|
+
JSON.parse(open(path).read)['data'].map{|item|
|
27
|
+
begin
|
28
|
+
hash = JSON.parse(item['value'])
|
29
|
+
self.validate(hash)
|
30
|
+
OpenStruct.new(hash)
|
31
|
+
rescue => error
|
32
|
+
Kindai::Util.logger.warn error
|
33
|
+
nil
|
34
|
+
end
|
35
|
+
}.compact.first
|
25
36
|
end
|
26
37
|
|
27
38
|
def self.save_item(book, info)
|
@@ -45,7 +56,7 @@ module Kindai::Util::Database
|
|
45
56
|
|
46
57
|
res = Net::HTTP.start(ENDPOINT.host, ENDPOINT.port){|http|
|
47
58
|
request = Net::HTTP::Post.new(ENDPOINT.path)
|
48
|
-
request.set_form_data({:value => send_data.to_json})
|
59
|
+
request.set_form_data({:value => send_data.to_json, :group => book.key})
|
49
60
|
http.request(request)
|
50
61
|
}
|
51
62
|
case res.code
|
data/spec/book_spec.rb
CHANGED
metadata
CHANGED
@@ -1,152 +1,114 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: kindai
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 6
|
9
|
-
- 2
|
10
|
-
version: 1.6.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.7.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- hitode909
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2011-05-19 00:00:00 +09:00
|
12
|
+
date: 2011-05-24 00:00:00.000000000 +09:00
|
19
13
|
default_executable: kindai.rb
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
24
16
|
name: nokogiri
|
25
|
-
|
17
|
+
requirement: &2156017080 !ruby/object:Gem::Requirement
|
26
18
|
none: false
|
27
|
-
requirements:
|
28
|
-
- -
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
|
31
|
-
segments:
|
32
|
-
- 0
|
33
|
-
version: "0"
|
34
|
-
requirement: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
36
23
|
type: :runtime
|
37
24
|
prerelease: false
|
25
|
+
version_requirements: *2156017080
|
26
|
+
- !ruby/object:Gem::Dependency
|
38
27
|
name: rmagick
|
39
|
-
|
28
|
+
requirement: &2156014800 !ruby/object:Gem::Requirement
|
40
29
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
version: "0"
|
48
|
-
requirement: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
50
34
|
type: :runtime
|
51
35
|
prerelease: false
|
36
|
+
version_requirements: *2156014800
|
37
|
+
- !ruby/object:Gem::Dependency
|
52
38
|
name: zipruby
|
53
|
-
|
39
|
+
requirement: &2156013420 !ruby/object:Gem::Requirement
|
54
40
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
segments:
|
60
|
-
- 0
|
61
|
-
version: "0"
|
62
|
-
requirement: *id003
|
63
|
-
- !ruby/object:Gem::Dependency
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
64
45
|
type: :runtime
|
65
46
|
prerelease: false
|
47
|
+
version_requirements: *2156013420
|
48
|
+
- !ruby/object:Gem::Dependency
|
66
49
|
name: json
|
67
|
-
|
50
|
+
requirement: &2156012280 !ruby/object:Gem::Requirement
|
68
51
|
none: false
|
69
|
-
requirements:
|
70
|
-
- -
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
|
73
|
-
|
74
|
-
- 1
|
75
|
-
- 4
|
76
|
-
version: "1.4"
|
77
|
-
requirement: *id004
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
type: :development
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.4'
|
56
|
+
type: :runtime
|
80
57
|
prerelease: false
|
58
|
+
version_requirements: *2156012280
|
59
|
+
- !ruby/object:Gem::Dependency
|
81
60
|
name: rspec
|
82
|
-
|
61
|
+
requirement: &2156011420 !ruby/object:Gem::Requirement
|
83
62
|
none: false
|
84
|
-
requirements:
|
63
|
+
requirements:
|
85
64
|
- - ~>
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
hash: 3
|
88
|
-
segments:
|
89
|
-
- 2
|
90
|
-
- 3
|
91
|
-
- 0
|
65
|
+
- !ruby/object:Gem::Version
|
92
66
|
version: 2.3.0
|
93
|
-
requirement: *id005
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
67
|
type: :development
|
96
68
|
prerelease: false
|
69
|
+
version_requirements: *2156011420
|
70
|
+
- !ruby/object:Gem::Dependency
|
97
71
|
name: bundler
|
98
|
-
|
72
|
+
requirement: &2156010180 !ruby/object:Gem::Requirement
|
99
73
|
none: false
|
100
|
-
requirements:
|
74
|
+
requirements:
|
101
75
|
- - ~>
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
hash: 23
|
104
|
-
segments:
|
105
|
-
- 1
|
106
|
-
- 0
|
107
|
-
- 0
|
76
|
+
- !ruby/object:Gem::Version
|
108
77
|
version: 1.0.0
|
109
|
-
requirement: *id006
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
78
|
type: :development
|
112
79
|
prerelease: false
|
80
|
+
version_requirements: *2156010180
|
81
|
+
- !ruby/object:Gem::Dependency
|
113
82
|
name: jeweler
|
114
|
-
|
83
|
+
requirement: &2156008360 !ruby/object:Gem::Requirement
|
115
84
|
none: false
|
116
|
-
requirements:
|
85
|
+
requirements:
|
117
86
|
- - ~>
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
hash: 7
|
120
|
-
segments:
|
121
|
-
- 1
|
122
|
-
- 5
|
123
|
-
- 2
|
87
|
+
- !ruby/object:Gem::Version
|
124
88
|
version: 1.5.2
|
125
|
-
requirement: *id007
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
89
|
type: :development
|
128
90
|
prerelease: false
|
91
|
+
version_requirements: *2156008360
|
92
|
+
- !ruby/object:Gem::Dependency
|
129
93
|
name: rcov
|
130
|
-
|
94
|
+
requirement: &2156004900 !ruby/object:Gem::Requirement
|
131
95
|
none: false
|
132
|
-
requirements:
|
133
|
-
- -
|
134
|
-
- !ruby/object:Gem::Version
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
requirement: *id008
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
type: :development
|
101
|
+
prerelease: false
|
102
|
+
version_requirements: *2156004900
|
140
103
|
description: kindai.rb is kindai digital library downloader.
|
141
104
|
email: hitode909@gmail.com
|
142
|
-
executables:
|
105
|
+
executables:
|
143
106
|
- kindai.rb
|
144
107
|
extensions: []
|
145
|
-
|
146
|
-
extra_rdoc_files:
|
108
|
+
extra_rdoc_files:
|
147
109
|
- LICENSE.txt
|
148
110
|
- README.rdoc
|
149
|
-
files:
|
111
|
+
files:
|
150
112
|
- Gemfile
|
151
113
|
- Gemfile.lock
|
152
114
|
- LICENSE.txt
|
@@ -176,42 +138,38 @@ files:
|
|
176
138
|
- spec/spread_spec.rb
|
177
139
|
has_rdoc: true
|
178
140
|
homepage: http://github.com/hitode909/kindairb
|
179
|
-
licenses:
|
141
|
+
licenses:
|
180
142
|
- MIT
|
181
143
|
post_install_message:
|
182
|
-
rdoc_options:
|
144
|
+
rdoc_options:
|
183
145
|
- --main
|
184
146
|
- README.rdoc
|
185
147
|
- --exclude
|
186
148
|
- spec
|
187
|
-
require_paths:
|
149
|
+
require_paths:
|
188
150
|
- lib
|
189
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
190
152
|
none: false
|
191
|
-
requirements:
|
192
|
-
- -
|
193
|
-
- !ruby/object:Gem::Version
|
194
|
-
|
195
|
-
segments:
|
153
|
+
requirements:
|
154
|
+
- - ! '>='
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
segments:
|
196
158
|
- 0
|
197
|
-
|
198
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
|
+
hash: 4261753351778255770
|
160
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
199
161
|
none: false
|
200
|
-
requirements:
|
201
|
-
- -
|
202
|
-
- !ruby/object:Gem::Version
|
203
|
-
|
204
|
-
segments:
|
205
|
-
- 0
|
206
|
-
version: "0"
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
207
166
|
requirements: []
|
208
|
-
|
209
167
|
rubyforge_project:
|
210
|
-
rubygems_version: 1.
|
168
|
+
rubygems_version: 1.5.2
|
211
169
|
signing_key:
|
212
170
|
specification_version: 3
|
213
171
|
summary: kindai digital library downloader
|
214
|
-
test_files:
|
172
|
+
test_files:
|
215
173
|
- spec/book_downloader_spec.rb
|
216
174
|
- spec/book_spec.rb
|
217
175
|
- spec/searcher_spec.rb
|