bookscan 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,6 +2,12 @@ source "http://rubygems.org"
2
2
  # Add dependencies required to use your gem here.
3
3
  # Example:
4
4
  # gem "activesupport", ">= 2.3.5"
5
+ gem 'mutter'
6
+ gem 'keystorage', '> 0.1'
7
+ gem 'mechanize', '>= 1.0.0'
8
+ gem 'highline', '> 1.6'
9
+ gem 'progressbar', '>= 0.9.0'
10
+ gem 'httpclient', '>= 2.1.6.1'
5
11
 
6
12
  # Add dependencies to develop your gem here.
7
13
  # Include everything needed to run rake, tests, features, etc.
data/Rakefile CHANGED
@@ -21,12 +21,6 @@ Jeweler::Tasks.new do |gem|
21
21
  gem.authors = ["Yoshihiro TAKAHARA"]
22
22
  # Include your dependencies below. Runtime dependencies are required when using your gem,
23
23
  # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
- gem.add_runtime_dependency 'mutter'
25
- gem.add_runtime_dependency 'keystorage', '> 0.1'
26
- gem.add_runtime_dependency 'mechanize', '>= 1.0.0'
27
- gem.add_runtime_dependency 'highline', '> 1.6'
28
- gem.add_runtime_dependency 'progressbar', '>= 0.9.0'
29
- gem.add_runtime_dependency 'httpclient', '>= 2.1.6.1'
30
24
  # gem.add_development_dependency 'rspec', '> 1.2.3'
31
25
  end
32
26
  Jeweler::RubygemsDotOrgTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.2
1
+ 0.5.3
data/bookscan.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bookscan}
8
- s.version = "0.5.2"
8
+ s.version = "0.5.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Yoshihiro TAKAHARA"]
12
- s.date = %q{2011-01-21}
12
+ s.date = %q{2011-02-06}
13
13
  s.default_executable = %q{bookscan}
14
14
  s.description = %q{This is a scraper of Bookscan (http://www.bookscan.co.jp) Service.This is *NOT* a official software of Bookscan.}
15
15
  s.email = %q{y.takahara@gmail.com}
@@ -40,7 +40,7 @@ Gem::Specification.new do |s|
40
40
  s.homepage = %q{http://github.com/tumf/bookscan}
41
41
  s.licenses = ["MIT"]
42
42
  s.require_paths = ["lib"]
43
- s.rubygems_version = %q{1.4.2}
43
+ s.rubygems_version = %q{1.5.0}
44
44
  s.summary = %q{BookScan Scraper}
45
45
  s.test_files = [
46
46
  "test/helper.rb",
@@ -51,39 +51,39 @@ Gem::Specification.new do |s|
51
51
  s.specification_version = 3
52
52
 
53
53
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
54
- s.add_development_dependency(%q<shoulda>, [">= 0"])
55
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
56
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
57
- s.add_development_dependency(%q<rcov>, [">= 0"])
58
54
  s.add_runtime_dependency(%q<mutter>, [">= 0"])
59
55
  s.add_runtime_dependency(%q<keystorage>, ["> 0.1"])
60
56
  s.add_runtime_dependency(%q<mechanize>, [">= 1.0.0"])
61
57
  s.add_runtime_dependency(%q<highline>, ["> 1.6"])
62
58
  s.add_runtime_dependency(%q<progressbar>, [">= 0.9.0"])
63
59
  s.add_runtime_dependency(%q<httpclient>, [">= 2.1.6.1"])
60
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
61
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
62
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
63
+ s.add_development_dependency(%q<rcov>, [">= 0"])
64
64
  else
65
- s.add_dependency(%q<shoulda>, [">= 0"])
66
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
67
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
68
- s.add_dependency(%q<rcov>, [">= 0"])
69
65
  s.add_dependency(%q<mutter>, [">= 0"])
70
66
  s.add_dependency(%q<keystorage>, ["> 0.1"])
71
67
  s.add_dependency(%q<mechanize>, [">= 1.0.0"])
72
68
  s.add_dependency(%q<highline>, ["> 1.6"])
73
69
  s.add_dependency(%q<progressbar>, [">= 0.9.0"])
74
70
  s.add_dependency(%q<httpclient>, [">= 2.1.6.1"])
71
+ s.add_dependency(%q<shoulda>, [">= 0"])
72
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
73
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
74
+ s.add_dependency(%q<rcov>, [">= 0"])
75
75
  end
76
76
  else
77
- s.add_dependency(%q<shoulda>, [">= 0"])
78
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
79
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
80
- s.add_dependency(%q<rcov>, [">= 0"])
81
77
  s.add_dependency(%q<mutter>, [">= 0"])
82
78
  s.add_dependency(%q<keystorage>, ["> 0.1"])
83
79
  s.add_dependency(%q<mechanize>, [">= 1.0.0"])
84
80
  s.add_dependency(%q<highline>, ["> 1.6"])
85
81
  s.add_dependency(%q<progressbar>, [">= 0.9.0"])
86
82
  s.add_dependency(%q<httpclient>, [">= 2.1.6.1"])
83
+ s.add_dependency(%q<shoulda>, [">= 0"])
84
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
85
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
86
+ s.add_dependency(%q<rcov>, [">= 0"])
87
87
  end
88
88
  end
89
89
 
data/lib/bookscan.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  module Bookscan
3
3
  BSURL = "http://system.bookscan.co.jp"
4
4
  TUNE_TYPES = ["ipad","iphone4","kindle3","kindledx","android","sonyreader","nook","jpg"]
5
- TUNED_PATTERN = /((iphone4|ipad|kindle3|kindledx|android|sonyreader|nook|jpg)_([^>%]*\.pdf))/
5
+ TUNED_PATTERN = /((iphone4|ipad|kindle3|kindledx|android|sonyreader|nook|jpg)_([^>]*\.pdf))/
6
6
  end
@@ -161,9 +161,7 @@ module Bookscan
161
161
 
162
162
  length = 0;total = 0
163
163
  res = cli.head(url)
164
- if res.status == 302
165
- url = URI.parse(res.header["Location"].to_s)
166
- end
164
+ url = URI.parse(res.header["Location"].to_s) if res.status == 302
167
165
  total = cli.head(url).header["Content-Length"].to_s.to_i
168
166
  t = Thread.new {
169
167
  conn = cli.get_async(url)
@@ -11,7 +11,7 @@ require "bookscan/cache"
11
11
 
12
12
  module Bookscan
13
13
  COMMANDS = ["list","help", "login","logout","download","tune","update",
14
- "groups","tuned"]
14
+ "groups","tuned","tuning"]
15
15
 
16
16
  class Commands
17
17
  def initialize(cmd_options,options)
@@ -1,7 +1,14 @@
1
+ # -*- coding: utf-8 -*-
1
2
  require 'helper'
2
-
3
+ require 'bookscan/agent'
4
+ require 'pp'
3
5
  class TestBookscan < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ context "Bookscan::Agent" do
7
+ should "access to bookscan" do
8
+ Bookscan::Agent.new {|agent|
9
+ agent.getr("/")
10
+ assert(/ブックスキャン/ =~ agent.page.body,"access to top")
11
+ }
12
+ end
6
13
  end
7
14
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bookscan
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 2
10
- version: 0.5.2
9
+ - 3
10
+ version: 0.5.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Yoshihiro TAKAHARA
@@ -15,13 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-21 00:00:00 +09:00
18
+ date: 2011-02-06 00:00:00 +09:00
19
19
  default_executable: bookscan
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- type: :development
23
- name: shoulda
24
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ requirement: &id001 !ruby/object:Gem::Requirement
25
23
  none: false
26
24
  requirements:
27
25
  - - ">="
@@ -30,15 +28,30 @@ dependencies:
30
28
  segments:
31
29
  - 0
32
30
  version: "0"
31
+ version_requirements: *id001
32
+ name: mutter
33
33
  prerelease: false
34
- requirement: *id001
34
+ type: :runtime
35
35
  - !ruby/object:Gem::Dependency
36
- type: :development
37
- name: bundler
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
36
+ requirement: &id002 !ruby/object:Gem::Requirement
39
37
  none: false
40
38
  requirements:
41
- - - ~>
39
+ - - ">"
40
+ - !ruby/object:Gem::Version
41
+ hash: 9
42
+ segments:
43
+ - 0
44
+ - 1
45
+ version: "0.1"
46
+ version_requirements: *id002
47
+ name: keystorage
48
+ prerelease: false
49
+ type: :runtime
50
+ - !ruby/object:Gem::Dependency
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
42
55
  - !ruby/object:Gem::Version
43
56
  hash: 23
44
57
  segments:
@@ -46,74 +59,77 @@ dependencies:
46
59
  - 0
47
60
  - 0
48
61
  version: 1.0.0
62
+ version_requirements: *id003
63
+ name: mechanize
49
64
  prerelease: false
50
- requirement: *id002
65
+ type: :runtime
51
66
  - !ruby/object:Gem::Dependency
52
- type: :development
53
- name: jeweler
54
- version_requirements: &id003 !ruby/object:Gem::Requirement
67
+ requirement: &id004 !ruby/object:Gem::Requirement
55
68
  none: false
56
69
  requirements:
57
- - - ~>
70
+ - - ">"
58
71
  - !ruby/object:Gem::Version
59
- hash: 7
72
+ hash: 3
60
73
  segments:
61
74
  - 1
62
- - 5
63
- - 2
64
- version: 1.5.2
75
+ - 6
76
+ version: "1.6"
77
+ version_requirements: *id004
78
+ name: highline
65
79
  prerelease: false
66
- requirement: *id003
80
+ type: :runtime
67
81
  - !ruby/object:Gem::Dependency
68
- type: :development
69
- name: rcov
70
- version_requirements: &id004 !ruby/object:Gem::Requirement
82
+ requirement: &id005 !ruby/object:Gem::Requirement
71
83
  none: false
72
84
  requirements:
73
85
  - - ">="
74
86
  - !ruby/object:Gem::Version
75
- hash: 3
87
+ hash: 59
76
88
  segments:
77
89
  - 0
78
- version: "0"
90
+ - 9
91
+ - 0
92
+ version: 0.9.0
93
+ version_requirements: *id005
94
+ name: progressbar
79
95
  prerelease: false
80
- requirement: *id004
81
- - !ruby/object:Gem::Dependency
82
96
  type: :runtime
83
- name: mutter
84
- version_requirements: &id005 !ruby/object:Gem::Requirement
97
+ - !ruby/object:Gem::Dependency
98
+ requirement: &id006 !ruby/object:Gem::Requirement
85
99
  none: false
86
100
  requirements:
87
101
  - - ">="
88
102
  - !ruby/object:Gem::Version
89
- hash: 3
103
+ hash: 125
90
104
  segments:
91
- - 0
92
- version: "0"
105
+ - 2
106
+ - 1
107
+ - 6
108
+ - 1
109
+ version: 2.1.6.1
110
+ version_requirements: *id006
111
+ name: httpclient
93
112
  prerelease: false
94
- requirement: *id005
95
- - !ruby/object:Gem::Dependency
96
113
  type: :runtime
97
- name: keystorage
98
- version_requirements: &id006 !ruby/object:Gem::Requirement
114
+ - !ruby/object:Gem::Dependency
115
+ requirement: &id007 !ruby/object:Gem::Requirement
99
116
  none: false
100
117
  requirements:
101
- - - ">"
118
+ - - ">="
102
119
  - !ruby/object:Gem::Version
103
- hash: 9
120
+ hash: 3
104
121
  segments:
105
122
  - 0
106
- - 1
107
- version: "0.1"
123
+ version: "0"
124
+ version_requirements: *id007
125
+ name: shoulda
108
126
  prerelease: false
109
- requirement: *id006
127
+ type: :development
110
128
  - !ruby/object:Gem::Dependency
111
- type: :runtime
112
- name: mechanize
113
- version_requirements: &id007 !ruby/object:Gem::Requirement
129
+ requirement: &id008 !ruby/object:Gem::Requirement
114
130
  none: false
115
131
  requirements:
116
- - - ">="
132
+ - - ~>
117
133
  - !ruby/object:Gem::Version
118
134
  hash: 23
119
135
  segments:
@@ -121,56 +137,40 @@ dependencies:
121
137
  - 0
122
138
  - 0
123
139
  version: 1.0.0
140
+ version_requirements: *id008
141
+ name: bundler
124
142
  prerelease: false
125
- requirement: *id007
143
+ type: :development
126
144
  - !ruby/object:Gem::Dependency
127
- type: :runtime
128
- name: highline
129
- version_requirements: &id008 !ruby/object:Gem::Requirement
145
+ requirement: &id009 !ruby/object:Gem::Requirement
130
146
  none: false
131
147
  requirements:
132
- - - ">"
148
+ - - ~>
133
149
  - !ruby/object:Gem::Version
134
- hash: 3
150
+ hash: 7
135
151
  segments:
136
152
  - 1
137
- - 6
138
- version: "1.6"
153
+ - 5
154
+ - 2
155
+ version: 1.5.2
156
+ version_requirements: *id009
157
+ name: jeweler
139
158
  prerelease: false
140
- requirement: *id008
159
+ type: :development
141
160
  - !ruby/object:Gem::Dependency
142
- type: :runtime
143
- name: progressbar
144
- version_requirements: &id009 !ruby/object:Gem::Requirement
161
+ requirement: &id010 !ruby/object:Gem::Requirement
145
162
  none: false
146
163
  requirements:
147
164
  - - ">="
148
165
  - !ruby/object:Gem::Version
149
- hash: 59
166
+ hash: 3
150
167
  segments:
151
168
  - 0
152
- - 9
153
- - 0
154
- version: 0.9.0
155
- prerelease: false
156
- requirement: *id009
157
- - !ruby/object:Gem::Dependency
158
- type: :runtime
159
- name: httpclient
160
- version_requirements: &id010 !ruby/object:Gem::Requirement
161
- none: false
162
- requirements:
163
- - - ">="
164
- - !ruby/object:Gem::Version
165
- hash: 125
166
- segments:
167
- - 2
168
- - 1
169
- - 6
170
- - 1
171
- version: 2.1.6.1
169
+ version: "0"
170
+ version_requirements: *id010
171
+ name: rcov
172
172
  prerelease: false
173
- requirement: *id010
173
+ type: :development
174
174
  description: This is a scraper of Bookscan (http://www.bookscan.co.jp) Service.This is *NOT* a official software of Bookscan.
175
175
  email: y.takahara@gmail.com
176
176
  executables:
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  requirements: []
229
229
 
230
230
  rubyforge_project:
231
- rubygems_version: 1.4.2
231
+ rubygems_version: 1.5.0
232
232
  signing_key:
233
233
  specification_version: 3
234
234
  summary: BookScan Scraper