wikipedia-client 1.3.0 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ .rbenv-version
2
+ *.swp
3
+ *.tmp
4
+ *.log
5
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,71 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ wikipedia-client (1.3.2)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ addressable (2.3.5)
10
+ builder (3.2.2)
11
+ diff-lcs (1.2.4)
12
+ faraday (0.8.8)
13
+ multipart-post (~> 1.2.0)
14
+ git (1.2.6)
15
+ github_api (0.10.1)
16
+ addressable
17
+ faraday (~> 0.8.1)
18
+ hashie (>= 1.2)
19
+ multi_json (~> 1.4)
20
+ nokogiri (~> 1.5.2)
21
+ oauth2
22
+ hashie (2.0.5)
23
+ highline (1.6.19)
24
+ httpauth (0.2.0)
25
+ jeweler (1.8.8)
26
+ builder
27
+ bundler (~> 1.0)
28
+ git (>= 1.2.5)
29
+ github_api (= 0.10.1)
30
+ highline (>= 1.6.15)
31
+ nokogiri (= 1.5.10)
32
+ rake
33
+ rdoc
34
+ json (1.8.0)
35
+ jwt (0.1.8)
36
+ multi_json (>= 1.5)
37
+ multi_json (1.8.1)
38
+ multi_xml (0.5.5)
39
+ multipart-post (1.2.0)
40
+ nokogiri (1.5.10)
41
+ oauth2 (0.9.2)
42
+ faraday (~> 0.8)
43
+ httpauth (~> 0.2)
44
+ jwt (~> 0.1.4)
45
+ multi_json (~> 1.0)
46
+ multi_xml (~> 0.5)
47
+ rack (~> 1.2)
48
+ rack (1.5.2)
49
+ rake (10.1.0)
50
+ rdoc (4.0.1)
51
+ json (~> 1.4)
52
+ rspec (2.14.1)
53
+ rspec-core (~> 2.14.0)
54
+ rspec-expectations (~> 2.14.0)
55
+ rspec-mocks (~> 2.14.0)
56
+ rspec-core (2.14.5)
57
+ rspec-expectations (2.14.3)
58
+ diff-lcs (>= 1.1.3, < 2.0)
59
+ rspec-mocks (2.14.3)
60
+ thoughtbot-shoulda (2.11.1)
61
+
62
+ PLATFORMS
63
+ ruby
64
+
65
+ DEPENDENCIES
66
+ jeweler
67
+ rake
68
+ rdoc
69
+ rspec
70
+ thoughtbot-shoulda
71
+ wikipedia-client!
data/Rakefile CHANGED
@@ -1,23 +1,7 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
1
2
  require 'rubygems'
2
3
  require 'rake'
3
4
 
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "wikipedia-client"
8
- gem.summary = %Q{Ruby client for the Wikipedia API}
9
- gem.description = %Q{Ruby client for the Wikipedia API}
10
- gem.email = "mike.haugland@gmail.com"
11
- gem.homepage = "http://github.com/mhaugland/wikipedia-client"
12
- gem.authors = ["Cyril David", "Ken Pratt", "Mike Haugland"]
13
- gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
14
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
- end
16
- Jeweler::GemcutterTasks.new
17
- rescue LoadError
18
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
- end
20
-
21
5
  require 'rake/testtask'
22
6
  Rake::TestTask.new(:test) do |test|
23
7
  test.libs << 'lib' << 'test'
@@ -45,13 +29,12 @@ rescue LoadError
45
29
  end
46
30
  end
47
31
 
48
- task :spec => :check_dependencies
49
-
50
32
  task :default => :spec
51
33
 
52
34
  require 'rdoc/task'
35
+ require "wikipedia/version"
53
36
  Rake::RDocTask.new do |rdoc|
54
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
37
+ version = Wikipedia::VERSION
55
38
 
56
39
  rdoc.rdoc_dir = 'rdoc'
57
40
  rdoc.title = "wikipedia-client #{version}"
@@ -29,6 +29,7 @@ module Wikipedia
29
29
  :action => "query",
30
30
  :prop => %w{ revisions links extlinks images categories coordinates templates },
31
31
  :rvprop => "content",
32
+ :inprop => "url",
32
33
  :titles => title
33
34
  }.merge( options ) )
34
35
  end
@@ -19,7 +19,7 @@ module Wikipedia
19
19
  end
20
20
 
21
21
  def redirect?
22
- content && content.match(/\#REDIRECT\s+\[\[(.*?)\]\]/i)
22
+ content && content.match(/\#REDIRECT\s*\[\[(.*?)\]\]/i)
23
23
  end
24
24
 
25
25
  def redirect_title
@@ -32,6 +32,14 @@ module Wikipedia
32
32
  page['title']
33
33
  end
34
34
 
35
+ def fullurl
36
+ page['fullurl']
37
+ end
38
+
39
+ def editurl
40
+ page['editurl']
41
+ end
42
+
35
43
  def categories
36
44
  page['categories'].map {|c| c['title'] } if page['categories']
37
45
  end
@@ -75,7 +83,7 @@ module Wikipedia
75
83
  def image_metadata
76
84
  unless @cached_image_metadata
77
85
  if list = images
78
- filtered = list.select {|i| i =~ /^file:.+\.(jpg|jpeg|png|gif)$/i && !i.include?("LinkFA-star") }
86
+ filtered = list.select {|i| i =~ /:.+\.(jpg|jpeg|png|gif)$/i && !i.include?("LinkFA-star") }
79
87
  @cached_image_metadata = filtered.map {|title| Wikipedia.find_image(title) }
80
88
  end
81
89
  end
@@ -0,0 +1,3 @@
1
+ module Wikipedia
2
+ VERSION = "1.3.2"
3
+ end
@@ -106,3 +106,22 @@ describe Wikipedia::Client, ".find page (Edsger_Dijkstra)" do
106
106
  @page.image_urls.should == ["http://upload.wikimedia.org/wikipedia/commons/c/c9/Edsger_Dijkstra_1994.jpg", "http://upload.wikimedia.org/wikipedia/commons/d/d9/Edsger_Wybe_Dijkstra.jpg"]
107
107
  end
108
108
  end
109
+
110
+ describe Wikipedia::Client, ".find page (Rails) at jp" do
111
+ before(:each) do
112
+ Wikipedia.Configure { domain "ja.wikipedia.org" }
113
+ @client = Wikipedia::Client.new
114
+ @client.follow_redirects = false
115
+ end
116
+
117
+ it "should get a redirect when trying Rails" do
118
+ @page = @client.find('Rails')
119
+ @page.should be_redirect
120
+ end
121
+
122
+ it "should get a final page when follow_redirects is true" do
123
+ @client.follow_redirects = true
124
+ @page = @client.find('Rails')
125
+ @page.should_not be_redirect
126
+ end
127
+ end
@@ -17,4 +17,4 @@ describe Wikipedia, ".find" do
17
17
  page2 = Wikipedia.find('http://en.wikipedia.org/wiki/Getting_Things_Done')
18
18
  page1.title.should == page2.title
19
19
  end
20
- end
20
+ end
@@ -1,75 +1,37 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "wikipedia/version"
5
4
 
6
- Gem::Specification.new do |s|
7
- s.name = "wikipedia-client"
8
- s.version = "1.3.0"
5
+ spec = Gem::Specification.new do |s|
6
+ s.name = "wikipedia-client"
7
+ s.version = Wikipedia::VERSION
9
8
 
10
9
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Cyril David", "Ken Pratt", "Mike Haugland"]
12
- s.date = "2013-06-30"
13
- s.description = "Ruby client for the Wikipedia API"
14
- s.email = "mike.haugland@gmail.com"
15
- s.extra_rdoc_files = [
16
- "README.textile"
17
- ]
18
- s.files = [
19
- "MIT-LICENSE",
20
- "README.textile",
21
- "Rakefile",
22
- "VERSION",
23
- "init.rb",
24
- "install.rb",
25
- "lib/wikipedia.rb",
26
- "lib/wikipedia/client.rb",
27
- "lib/wikipedia/configuration.rb",
28
- "lib/wikipedia/page.rb",
29
- "lib/wikipedia/url.rb",
30
- "script/add_sanitization_test",
31
- "spec/fixtures/Edsger_Dijkstra.json",
32
- "spec/fixtures/Edsger_Dijkstra.yaml",
33
- "spec/fixtures/Edsger_Dijkstra_section_0.json",
34
- "spec/fixtures/Edsger_content.txt",
35
- "spec/fixtures/File_Edsger_Wybe_Dijkstra_jpg.json",
36
- "spec/fixtures/sanitization_samples/Ceawlin_of_Wessex-raw.txt",
37
- "spec/fixtures/sanitization_samples/Ceawlin_of_Wessex-sanitized.txt",
38
- "spec/fixtures/sanitization_samples/Edsger_W_Dijkstra-raw.txt",
39
- "spec/fixtures/sanitization_samples/Edsger_W_Dijkstra-sanitized.txt",
40
- "spec/fixtures/sanitization_samples/Flower_video_game-raw.txt",
41
- "spec/fixtures/sanitization_samples/Flower_video_game-sanitized.txt",
42
- "spec/fixtures/sanitization_samples/How_to_Lose_Friends__Alienate_People_film-raw.txt",
43
- "spec/fixtures/sanitization_samples/How_to_Lose_Friends__Alienate_People_film-sanitized.txt",
44
- "spec/fixtures/sanitization_samples/Kirsten_Dunst-raw.txt",
45
- "spec/fixtures/sanitization_samples/Kirsten_Dunst-sanitized.txt",
46
- "spec/fixtures/sanitization_samples/Large_Hadron_Collider-raw.txt",
47
- "spec/fixtures/sanitization_samples/Large_Hadron_Collider-sanitized.txt",
48
- "spec/fixtures/sanitization_samples/Metro_Goldwyn_Mayer-raw.txt",
49
- "spec/fixtures/sanitization_samples/Metro_Goldwyn_Mayer-sanitized.txt",
50
- "spec/fixtures/sanitization_samples/Middle_Ages-raw.txt",
51
- "spec/fixtures/sanitization_samples/Middle_Ages-sanitized.txt",
52
- "spec/fixtures/sanitization_samples/SMS_Elbing-raw.txt",
53
- "spec/fixtures/sanitization_samples/SMS_Elbing-sanitized.txt",
54
- "spec/fixtures/sanitization_samples/Sashimi-raw.txt",
55
- "spec/fixtures/sanitization_samples/Sashimi-sanitized.txt",
56
- "spec/fixtures/sanitization_samples/Superb_Fairywren-raw.txt",
57
- "spec/fixtures/sanitization_samples/Superb_Fairywren-sanitized.txt",
58
- "spec/fixtures/sanitization_samples/Velociraptor-raw.txt",
59
- "spec/fixtures/sanitization_samples/Velociraptor-sanitized.txt",
60
- "spec/lib/client_spec.rb",
61
- "spec/lib/sanitize_spec.rb",
62
- "spec/lib/url_spec.rb",
63
- "spec/lib/wikipedia_spec.rb",
64
- "spec/spec_helper.rb",
65
- "tasks/wikipedia_tasks.rake",
66
- "uninstall.rb",
67
- "wikipedia-client.gemspec"
68
- ]
69
- s.homepage = "http://github.com/mhaugland/wikipedia-client"
70
- s.require_paths = ["lib"]
10
+
11
+ s.license = 'MIT'
12
+ s.authors = ["Cyril David", "Ken Pratt", "Mike Haugland"]
13
+ s.date = "2013-06-30"
14
+ s.description = "Ruby client for the Wikipedia API"
15
+ s.email = "mike.haugland@gmail.com"
16
+
17
+ s.homepage = "http://github.com/mhaugland/wikipedia-client"
71
18
  s.rubygems_version = "1.8.23"
72
- s.summary = "Ruby client for the Wikipedia API"
19
+ s.summary = "Ruby client for the Wikipedia API"
20
+ s.platform = Gem::Platform::RUBY
21
+ s.files = `git ls-files`.split("\n")
22
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
24
+ s.has_rdoc = true
25
+ s.extra_rdoc_files = ['README.textile']
26
+ s.bindir = 'bin'
27
+
28
+ s.require_paths << 'lib'
29
+ s.rdoc_options << '--title' << 'wikipedia-client' << '--main' << '-ri'
30
+
31
+ s.add_development_dependency('rake')
32
+ s.add_development_dependency('rspec')
33
+ s.add_development_dependency('rdoc')
34
+ s.add_development_dependency('jeweler')
73
35
 
74
36
  if s.respond_to? :specification_version then
75
37
  s.specification_version = 3
@@ -83,4 +45,3 @@ Gem::Specification.new do |s|
83
45
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
84
46
  end
85
47
  end
86
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wikipedia-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,6 +13,70 @@ bindir: bin
13
13
  cert_chain: []
14
14
  date: 2013-06-30 00:00:00.000000000 Z
15
15
  dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rake
18
+ requirement: !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
23
+ version: '0'
24
+ type: :development
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ! '>='
30
+ - !ruby/object:Gem::Version
31
+ version: '0'
32
+ - !ruby/object:Gem::Dependency
33
+ name: rspec
34
+ requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ - !ruby/object:Gem::Dependency
49
+ name: rdoc
50
+ requirement: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ - !ruby/object:Gem::Dependency
65
+ name: jeweler
66
+ requirement: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ type: :development
73
+ prerelease: false
74
+ version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
16
80
  - !ruby/object:Gem::Dependency
17
81
  name: thoughtbot-shoulda
18
82
  requirement: !ruby/object:Gem::Requirement
@@ -36,10 +100,12 @@ extensions: []
36
100
  extra_rdoc_files:
37
101
  - README.textile
38
102
  files:
103
+ - .gitignore
104
+ - Gemfile
105
+ - Gemfile.lock
39
106
  - MIT-LICENSE
40
107
  - README.textile
41
108
  - Rakefile
42
- - VERSION
43
109
  - init.rb
44
110
  - install.rb
45
111
  - lib/wikipedia.rb
@@ -47,6 +113,7 @@ files:
47
113
  - lib/wikipedia/configuration.rb
48
114
  - lib/wikipedia/page.rb
49
115
  - lib/wikipedia/url.rb
116
+ - lib/wikipedia/version.rb
50
117
  - script/add_sanitization_test
51
118
  - spec/fixtures/Edsger_Dijkstra.json
52
119
  - spec/fixtures/Edsger_Dijkstra.yaml
@@ -86,11 +153,17 @@ files:
86
153
  - uninstall.rb
87
154
  - wikipedia-client.gemspec
88
155
  homepage: http://github.com/mhaugland/wikipedia-client
89
- licenses: []
156
+ licenses:
157
+ - MIT
90
158
  post_install_message:
91
- rdoc_options: []
159
+ rdoc_options:
160
+ - --title
161
+ - wikipedia-client
162
+ - --main
163
+ - -ri
92
164
  require_paths:
93
165
  - lib
166
+ - lib
94
167
  required_ruby_version: !ruby/object:Gem::Requirement
95
168
  none: false
96
169
  requirements:
@@ -109,4 +182,38 @@ rubygems_version: 1.8.23
109
182
  signing_key:
110
183
  specification_version: 3
111
184
  summary: Ruby client for the Wikipedia API
112
- test_files: []
185
+ test_files:
186
+ - spec/fixtures/Edsger_Dijkstra.json
187
+ - spec/fixtures/Edsger_Dijkstra.yaml
188
+ - spec/fixtures/Edsger_Dijkstra_section_0.json
189
+ - spec/fixtures/Edsger_content.txt
190
+ - spec/fixtures/File_Edsger_Wybe_Dijkstra_jpg.json
191
+ - spec/fixtures/sanitization_samples/Ceawlin_of_Wessex-raw.txt
192
+ - spec/fixtures/sanitization_samples/Ceawlin_of_Wessex-sanitized.txt
193
+ - spec/fixtures/sanitization_samples/Edsger_W_Dijkstra-raw.txt
194
+ - spec/fixtures/sanitization_samples/Edsger_W_Dijkstra-sanitized.txt
195
+ - spec/fixtures/sanitization_samples/Flower_video_game-raw.txt
196
+ - spec/fixtures/sanitization_samples/Flower_video_game-sanitized.txt
197
+ - spec/fixtures/sanitization_samples/How_to_Lose_Friends__Alienate_People_film-raw.txt
198
+ - spec/fixtures/sanitization_samples/How_to_Lose_Friends__Alienate_People_film-sanitized.txt
199
+ - spec/fixtures/sanitization_samples/Kirsten_Dunst-raw.txt
200
+ - spec/fixtures/sanitization_samples/Kirsten_Dunst-sanitized.txt
201
+ - spec/fixtures/sanitization_samples/Large_Hadron_Collider-raw.txt
202
+ - spec/fixtures/sanitization_samples/Large_Hadron_Collider-sanitized.txt
203
+ - spec/fixtures/sanitization_samples/Metro_Goldwyn_Mayer-raw.txt
204
+ - spec/fixtures/sanitization_samples/Metro_Goldwyn_Mayer-sanitized.txt
205
+ - spec/fixtures/sanitization_samples/Middle_Ages-raw.txt
206
+ - spec/fixtures/sanitization_samples/Middle_Ages-sanitized.txt
207
+ - spec/fixtures/sanitization_samples/SMS_Elbing-raw.txt
208
+ - spec/fixtures/sanitization_samples/SMS_Elbing-sanitized.txt
209
+ - spec/fixtures/sanitization_samples/Sashimi-raw.txt
210
+ - spec/fixtures/sanitization_samples/Sashimi-sanitized.txt
211
+ - spec/fixtures/sanitization_samples/Superb_Fairywren-raw.txt
212
+ - spec/fixtures/sanitization_samples/Superb_Fairywren-sanitized.txt
213
+ - spec/fixtures/sanitization_samples/Velociraptor-raw.txt
214
+ - spec/fixtures/sanitization_samples/Velociraptor-sanitized.txt
215
+ - spec/lib/client_spec.rb
216
+ - spec/lib/sanitize_spec.rb
217
+ - spec/lib/url_spec.rb
218
+ - spec/lib/wikipedia_spec.rb
219
+ - spec/spec_helper.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.3.0