mediawiki-gateway 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +34 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +71 -0
- data/README +15 -2
- data/Rakefile +3 -5
- data/config/hosts.yml +2 -2
- data/lib/media_wiki.rb +1 -1
- data/lib/media_wiki/gateway.rb +37 -4
- data/mediawiki-gateway.gemspec +52 -20
- data/samples/README +18 -0
- data/{script → samples}/create_page.rb +1 -1
- data/{script → samples}/delete_batch.rb +0 -0
- data/{script → samples}/download_batch.rb +0 -0
- data/{script → samples}/email_user.rb +0 -0
- data/{script → samples}/export_xml.rb +0 -0
- data/samples/get_page.rb +11 -0
- data/{script → samples}/import_xml.rb +0 -0
- data/{script → samples}/run_fake_media_wiki.rb +0 -0
- data/{script → samples}/search_content.rb +0 -0
- data/{script → samples}/semantic_query.rb +0 -0
- data/{script → samples}/upload_commons.rb +0 -0
- data/{script → samples}/upload_file.rb +0 -0
- data/spec/fake_media_wiki/app.rb +3 -3
- data/spec/fake_media_wiki/query_handling.rb +1 -1
- data/spec/gateway_spec.rb +20 -9
- data/spec/spec_helper.rb +3 -0
- data/spec/utils_spec.rb +3 -0
- metadata +307 -165
- data/script/README +0 -18
- data/script/get_page.rb +0 -12
data/.rvmrc
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
4
|
+
# development environment upon cd'ing into the directory
|
5
|
+
|
6
|
+
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
|
7
|
+
# Only full ruby name is supported here, for short names use:
|
8
|
+
# echo "rvm use 1.9.3" > .rvmrc
|
9
|
+
environment_id="ruby-1.9.3-p194@mediawiki-gateway"
|
10
|
+
|
11
|
+
# Uncomment the following lines if you want to verify rvm version per project
|
12
|
+
# rvmrc_rvm_version="1.14.5 (stable)" # 1.10.1 seams as a safe start
|
13
|
+
# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
|
14
|
+
# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
|
15
|
+
# return 1
|
16
|
+
# }
|
17
|
+
|
18
|
+
# First we attempt to load the desired environment directly from the environment
|
19
|
+
# file. This is very fast and efficient compared to running through the entire
|
20
|
+
# CLI and selector. If you want feedback on which environment was used then
|
21
|
+
# insert the word 'use' after --create as this triggers verbose mode.
|
22
|
+
if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
|
23
|
+
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
24
|
+
then
|
25
|
+
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
26
|
+
[[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
|
27
|
+
\. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
|
28
|
+
else
|
29
|
+
# If the environment file has not yet been created, use the RVM CLI to select.
|
30
|
+
rvm --create "$environment_id" || {
|
31
|
+
echo "Failed to create RVM environment '${environment_id}'."
|
32
|
+
return 1
|
33
|
+
}
|
34
|
+
fi
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mediawiki-gateway (0.5.2)
|
5
|
+
activesupport
|
6
|
+
mediawiki-gateway
|
7
|
+
rest-client (>= 1.3.0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
activemodel (3.2.8)
|
13
|
+
activesupport (= 3.2.8)
|
14
|
+
builder (~> 3.0.0)
|
15
|
+
activesupport (3.2.8)
|
16
|
+
i18n (~> 0.6)
|
17
|
+
multi_json (~> 1.0)
|
18
|
+
builder (3.0.0)
|
19
|
+
columnize (0.3.6)
|
20
|
+
debugger (1.2.0)
|
21
|
+
columnize (>= 0.3.1)
|
22
|
+
debugger-linecache (~> 1.1.1)
|
23
|
+
debugger-ruby_core_source (~> 1.1.3)
|
24
|
+
debugger-linecache (1.1.2)
|
25
|
+
debugger-ruby_core_source (>= 1.1.1)
|
26
|
+
debugger-ruby_core_source (1.1.3)
|
27
|
+
git (1.2.5)
|
28
|
+
i18n (0.6.0)
|
29
|
+
jeweler (1.8.4)
|
30
|
+
bundler (~> 1.0)
|
31
|
+
git (>= 1.2.5)
|
32
|
+
rake
|
33
|
+
rdoc
|
34
|
+
json (1.7.5)
|
35
|
+
mime-types (1.19)
|
36
|
+
multi_json (1.3.6)
|
37
|
+
rack (1.4.1)
|
38
|
+
rack-protection (1.2.0)
|
39
|
+
rack
|
40
|
+
rake (0.9.2.2)
|
41
|
+
rdoc (3.12)
|
42
|
+
json (~> 1.4)
|
43
|
+
rest-client (1.6.7)
|
44
|
+
mime-types (>= 1.16)
|
45
|
+
rr (1.0.4)
|
46
|
+
rspec (1.3.2)
|
47
|
+
sham_rack (1.3.4)
|
48
|
+
rack
|
49
|
+
simplecov (0.6.4)
|
50
|
+
multi_json (~> 1.0)
|
51
|
+
simplecov-html (~> 0.5.3)
|
52
|
+
simplecov-html (0.5.3)
|
53
|
+
sinatra (1.3.3)
|
54
|
+
rack (~> 1.3, >= 1.3.6)
|
55
|
+
rack-protection (~> 1.2)
|
56
|
+
tilt (~> 1.3, >= 1.3.3)
|
57
|
+
tilt (1.3.3)
|
58
|
+
|
59
|
+
PLATFORMS
|
60
|
+
ruby
|
61
|
+
|
62
|
+
DEPENDENCIES
|
63
|
+
activemodel
|
64
|
+
debugger
|
65
|
+
jeweler
|
66
|
+
mediawiki-gateway!
|
67
|
+
rr
|
68
|
+
rspec (~> 1.3)
|
69
|
+
sham_rack
|
70
|
+
simplecov
|
71
|
+
sinatra
|
data/README
CHANGED
@@ -7,7 +7,8 @@ A Ruby framework for MediaWiki API manipulation. Features out of the box:
|
|
7
7
|
* List, search operations work around API limits to fetch all results
|
8
8
|
* Support for maxlag detection and automated retries on 503
|
9
9
|
* Integrated logging
|
10
|
-
* Tested up to MediaWiki 1.
|
10
|
+
* Tested up to MediaWiki 1.22
|
11
|
+
* Should work with both Ruby 1.8 and 1.9
|
11
12
|
|
12
13
|
Gem: http://rubygems.org/gems/mediawiki-gateway
|
13
14
|
RDoc: http://rubydoc.info/gems/mediawiki-gateway
|
@@ -22,11 +23,23 @@ Simple page creation script:
|
|
22
23
|
mw.login('RubyBot', 'pa$$w0rd')
|
23
24
|
mw.create('PageTitle', 'Hello world!', :summary => 'My first page')
|
24
25
|
|
26
|
+
== Development environment
|
27
|
+
|
28
|
+
To compile and test MediaWiki::Gateway locally, Bundler and Ruby 1.9+ are expected.
|
29
|
+
|
30
|
+
rvm install 1.9.3-p194
|
31
|
+
bundle install
|
32
|
+
bundle exec rake -T
|
33
|
+
|
34
|
+
== Status
|
35
|
+
|
36
|
+
This gem is no longer in active development. Bugs will be fixed if reported, and pull requests that add new features are more than welcome, but asking for new features is unlikely to make them materialize out of thin air.
|
37
|
+
|
25
38
|
== Credits
|
26
39
|
|
27
40
|
Maintained by Jani Patokallio.
|
28
41
|
|
29
42
|
Thanks to:
|
30
43
|
* John Carney, Mike Williams, Daniel Heath and the rest of the Lonely Planet Atlas team.
|
31
|
-
* Github users for code contributions, see https://github.com/jpatokal/mediawiki-gateway/pulls
|
44
|
+
* Github users for code contributions, see https://github.com/jpatokal/mediawiki-gateway/pulls
|
32
45
|
|
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require 'rake'
|
|
3
3
|
require "rubygems/package_task"
|
4
4
|
require 'rdoc/task'
|
5
5
|
require 'spec/rake/spectask'
|
6
|
-
|
6
|
+
require_relative 'lib/media_wiki'
|
7
7
|
|
8
8
|
task :default => ['spec']
|
9
9
|
|
@@ -22,8 +22,6 @@ desc "Run all specs"
|
|
22
22
|
Spec::Rake::SpecTask.new('spec') do |t|
|
23
23
|
t.spec_files = FileList['spec/**/*.rb']
|
24
24
|
t.spec_opts = ['--debugger']
|
25
|
-
t.rcov = true
|
26
|
-
t.rcov_opts = ['--exclude', 'spec,gems']
|
27
25
|
end
|
28
26
|
|
29
27
|
|
@@ -42,9 +40,9 @@ begin
|
|
42
40
|
gemspec.add_development_dependency 'jeweler'
|
43
41
|
gemspec.add_development_dependency 'sham_rack'
|
44
42
|
gemspec.add_development_dependency 'rr'
|
45
|
-
gemspec.add_development_dependency '
|
43
|
+
gemspec.add_development_dependency 'simplecov'
|
46
44
|
gemspec.add_development_dependency 'rspec', '~> 1.3'
|
47
|
-
gemspec.add_development_dependency '
|
45
|
+
gemspec.add_development_dependency 'debugger'
|
48
46
|
gemspec.add_development_dependency 'sinatra'
|
49
47
|
gemspec.add_development_dependency 'activemodel'
|
50
48
|
end
|
data/config/hosts.yml
CHANGED
data/lib/media_wiki.rb
CHANGED
data/lib/media_wiki/gateway.rb
CHANGED
@@ -33,6 +33,7 @@ module MediaWiki
|
|
33
33
|
:maxlag => 5,
|
34
34
|
:retry_count => 3,
|
35
35
|
:retry_delay => 10,
|
36
|
+
:max_results => 500
|
36
37
|
}
|
37
38
|
@options = default_options.merge(options)
|
38
39
|
@wiki_url = url
|
@@ -325,11 +326,12 @@ module MediaWiki
|
|
325
326
|
# [key] Search key
|
326
327
|
# [namespaces] Array of namespace names to search (defaults to main only)
|
327
328
|
# [limit] Maximum number of hits to ask for (defaults to 500; note that Wikimedia Foundation wikis allow only 50 for normal users)
|
329
|
+
# [max_results] Maximum total number of results to return
|
328
330
|
#
|
329
331
|
# Returns array of page titles (empty if no matches)
|
330
|
-
def search(key, namespaces=nil, limit=@options[:limit])
|
332
|
+
def search(key, namespaces=nil, limit=@options[:limit], max_results=@options[:max_results])
|
331
333
|
titles = []
|
332
|
-
offset =
|
334
|
+
offset = 0
|
333
335
|
in_progress = true
|
334
336
|
|
335
337
|
form_data = { 'action' => 'query',
|
@@ -344,9 +346,10 @@ module MediaWiki
|
|
344
346
|
end
|
345
347
|
begin
|
346
348
|
form_data['sroffset'] = offset if offset
|
349
|
+
form_data['srlimit'] = [limit, max_results - offset.to_i].min
|
347
350
|
res, offset = make_api_request(form_data, '//query-continue/search/@sroffset')
|
348
351
|
titles += REXML::XPath.match(res, "//p").map { |x| x.attributes["title"] }
|
349
|
-
end while offset
|
352
|
+
end while offset && offset.to_i < max_results.to_i
|
350
353
|
titles
|
351
354
|
end
|
352
355
|
|
@@ -379,7 +382,7 @@ module MediaWiki
|
|
379
382
|
# Returns array of hashes containing the "item" attributes defined here: http://www.mediawiki.org/wiki/API:Usercontribs
|
380
383
|
def contributions(user, count = nil, options = {})
|
381
384
|
result = []
|
382
|
-
ucstart = nil
|
385
|
+
ucstart = options[:ucstart] or nil
|
383
386
|
begin
|
384
387
|
limit = [count, @options[:limit]].compact.min
|
385
388
|
form_data = options.merge(
|
@@ -474,6 +477,36 @@ module MediaWiki
|
|
474
477
|
!!(valid_page?(page) and page.attributes["redirect"])
|
475
478
|
end
|
476
479
|
|
480
|
+
# Get image list for given article[s]. Follows redirects.
|
481
|
+
#
|
482
|
+
# _article_or_pageid_ is the title or pageid of a single article
|
483
|
+
# _imlimit_ is the maximum number of images to return (defaults to 200)
|
484
|
+
#
|
485
|
+
# Example:
|
486
|
+
# images = mw.images('Gaborone')
|
487
|
+
# _images_ would contain ['File:Gaborone at night.jpg', 'File:Gaborone2.png', ...]
|
488
|
+
|
489
|
+
def images(article_or_pageid, imlimit = 200)
|
490
|
+
form_data = {'action' => 'query', 'prop' => 'images', 'imlimit' => imlimit, 'redirects' => true}
|
491
|
+
case article_or_pageid
|
492
|
+
when Fixnum
|
493
|
+
form_data['pageids'] = article_or_pageid
|
494
|
+
else
|
495
|
+
form_data['titles'] = article_or_pageid
|
496
|
+
end
|
497
|
+
xml, dummy = make_api_request(form_data)
|
498
|
+
page = xml.elements["query/pages/page"]
|
499
|
+
if valid_page? page
|
500
|
+
if xml.elements["query/redirects/r"]
|
501
|
+
# We're dealing with redirect here.
|
502
|
+
images(page.attributes["pageid"].to_i, imlimit)
|
503
|
+
else
|
504
|
+
imgs = REXML::XPath.match(page, "images/im").map { |x| x.attributes["title"] }
|
505
|
+
end
|
506
|
+
else
|
507
|
+
nil
|
508
|
+
end
|
509
|
+
end
|
477
510
|
# Requests image info from MediaWiki. Follows redirects.
|
478
511
|
#
|
479
512
|
# _file_name_or_page_id_ should be either:
|
data/mediawiki-gateway.gemspec
CHANGED
@@ -5,17 +5,20 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "mediawiki-gateway"
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jani Patokallio"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2013-07-29"
|
13
13
|
s.description = ""
|
14
14
|
s.email = "jpatokal@iki.fi"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README"
|
17
17
|
]
|
18
18
|
s.files = [
|
19
|
+
".rvmrc",
|
20
|
+
"Gemfile",
|
21
|
+
"Gemfile.lock",
|
19
22
|
"README",
|
20
23
|
"Rakefile",
|
21
24
|
"config/hosts.yml",
|
@@ -25,17 +28,19 @@ Gem::Specification.new do |s|
|
|
25
28
|
"lib/media_wiki/gateway.rb",
|
26
29
|
"lib/media_wiki/utils.rb",
|
27
30
|
"mediawiki-gateway.gemspec",
|
28
|
-
"
|
29
|
-
"
|
30
|
-
"
|
31
|
-
"
|
32
|
-
"
|
33
|
-
"
|
34
|
-
"
|
35
|
-
"
|
36
|
-
"
|
37
|
-
"
|
38
|
-
"
|
31
|
+
"samples/README",
|
32
|
+
"samples/create_page.rb",
|
33
|
+
"samples/delete_batch.rb",
|
34
|
+
"samples/download_batch.rb",
|
35
|
+
"samples/email_user.rb",
|
36
|
+
"samples/export_xml.rb",
|
37
|
+
"samples/get_page.rb",
|
38
|
+
"samples/import_xml.rb",
|
39
|
+
"samples/run_fake_media_wiki.rb",
|
40
|
+
"samples/search_content.rb",
|
41
|
+
"samples/semantic_query.rb",
|
42
|
+
"samples/upload_commons.rb",
|
43
|
+
"samples/upload_file.rb",
|
39
44
|
"spec/fake_media_wiki/api_pages.rb",
|
40
45
|
"spec/fake_media_wiki/app.rb",
|
41
46
|
"spec/fake_media_wiki/query_handling.rb",
|
@@ -46,44 +51,71 @@ Gem::Specification.new do |s|
|
|
46
51
|
]
|
47
52
|
s.homepage = "http://github.com/jpatokal/mediawiki-gateway"
|
48
53
|
s.require_paths = ["lib"]
|
49
|
-
s.rubygems_version = "1.8.
|
54
|
+
s.rubygems_version = "1.8.10"
|
50
55
|
s.summary = "Connect to the mediawiki API"
|
51
56
|
|
52
57
|
if s.respond_to? :specification_version then
|
53
58
|
s.specification_version = 3
|
54
59
|
|
55
60
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
61
|
+
s.add_runtime_dependency(%q<mediawiki-gateway>, [">= 0"])
|
62
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
63
|
+
s.add_development_dependency(%q<sham_rack>, [">= 0"])
|
64
|
+
s.add_development_dependency(%q<rr>, [">= 0"])
|
65
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
66
|
+
s.add_development_dependency(%q<rspec>, ["~> 1.3"])
|
67
|
+
s.add_development_dependency(%q<debugger>, [">= 0"])
|
68
|
+
s.add_development_dependency(%q<sinatra>, [">= 0"])
|
69
|
+
s.add_development_dependency(%q<activemodel>, [">= 0"])
|
56
70
|
s.add_runtime_dependency(%q<rest-client>, [">= 1.3.0"])
|
57
71
|
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
58
72
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
59
73
|
s.add_development_dependency(%q<sham_rack>, [">= 0"])
|
60
74
|
s.add_development_dependency(%q<rr>, [">= 0"])
|
61
|
-
s.add_development_dependency(%q<
|
75
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
62
76
|
s.add_development_dependency(%q<rspec>, ["~> 1.3"])
|
63
|
-
s.add_development_dependency(%q<
|
77
|
+
s.add_development_dependency(%q<debugger>, [">= 0"])
|
64
78
|
s.add_development_dependency(%q<sinatra>, [">= 0"])
|
65
79
|
s.add_development_dependency(%q<activemodel>, [">= 0"])
|
66
80
|
else
|
81
|
+
s.add_dependency(%q<mediawiki-gateway>, [">= 0"])
|
82
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
83
|
+
s.add_dependency(%q<sham_rack>, [">= 0"])
|
84
|
+
s.add_dependency(%q<rr>, [">= 0"])
|
85
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
86
|
+
s.add_dependency(%q<rspec>, ["~> 1.3"])
|
87
|
+
s.add_dependency(%q<debugger>, [">= 0"])
|
88
|
+
s.add_dependency(%q<sinatra>, [">= 0"])
|
89
|
+
s.add_dependency(%q<activemodel>, [">= 0"])
|
67
90
|
s.add_dependency(%q<rest-client>, [">= 1.3.0"])
|
68
91
|
s.add_dependency(%q<activesupport>, [">= 0"])
|
69
92
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
70
93
|
s.add_dependency(%q<sham_rack>, [">= 0"])
|
71
94
|
s.add_dependency(%q<rr>, [">= 0"])
|
72
|
-
s.add_dependency(%q<
|
95
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
73
96
|
s.add_dependency(%q<rspec>, ["~> 1.3"])
|
74
|
-
s.add_dependency(%q<
|
97
|
+
s.add_dependency(%q<debugger>, [">= 0"])
|
75
98
|
s.add_dependency(%q<sinatra>, [">= 0"])
|
76
99
|
s.add_dependency(%q<activemodel>, [">= 0"])
|
77
100
|
end
|
78
101
|
else
|
102
|
+
s.add_dependency(%q<mediawiki-gateway>, [">= 0"])
|
103
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
104
|
+
s.add_dependency(%q<sham_rack>, [">= 0"])
|
105
|
+
s.add_dependency(%q<rr>, [">= 0"])
|
106
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
107
|
+
s.add_dependency(%q<rspec>, ["~> 1.3"])
|
108
|
+
s.add_dependency(%q<debugger>, [">= 0"])
|
109
|
+
s.add_dependency(%q<sinatra>, [">= 0"])
|
110
|
+
s.add_dependency(%q<activemodel>, [">= 0"])
|
79
111
|
s.add_dependency(%q<rest-client>, [">= 1.3.0"])
|
80
112
|
s.add_dependency(%q<activesupport>, [">= 0"])
|
81
113
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
82
114
|
s.add_dependency(%q<sham_rack>, [">= 0"])
|
83
115
|
s.add_dependency(%q<rr>, [">= 0"])
|
84
|
-
s.add_dependency(%q<
|
116
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
85
117
|
s.add_dependency(%q<rspec>, ["~> 1.3"])
|
86
|
-
s.add_dependency(%q<
|
118
|
+
s.add_dependency(%q<debugger>, [">= 0"])
|
87
119
|
s.add_dependency(%q<sinatra>, [">= 0"])
|
88
120
|
s.add_dependency(%q<activemodel>, [">= 0"])
|
89
121
|
end
|
data/samples/README
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Samples for using MediaWiki::Gateway. These expect to be run from the MediaWiki::Gateway root directory with ./config/hosts.yml accessible and configured with real usernames, passwords etc. Remove Logger::DEBUG from samples for less verbose output.
|
2
|
+
|
3
|
+
All the samples use the local instance of MediaWiki::Gateway in ./lib. To use an installed gem, use this require line instead:
|
4
|
+
|
5
|
+
require 'media_wiki'
|
6
|
+
|
7
|
+
Examples:
|
8
|
+
|
9
|
+
Check syntax for create page sample script
|
10
|
+
|
11
|
+
ruby samples/create_page.rb
|
12
|
+
|
13
|
+
Pipe the content of "content.txt" into the page 'Sandbox:MediaWikiGatewayTest' on the English Wikipedia
|
14
|
+
|
15
|
+
ruby samples/create_page.rb -h en-wp -a Sandbox:MediaWikiGatewayTest <content.txt
|
16
|
+
*or*
|
17
|
+
ruby samples/create_page.rb --host en-wp --article Sandbox:MediaWikiGatewayTest <content.txt
|
18
|
+
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/samples/get_page.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Sample script for fetching a page's current contents in Wiki markup
|
4
|
+
#
|
5
|
+
require './lib/media_wiki'
|
6
|
+
|
7
|
+
config = MediaWiki::Config.new ARGV
|
8
|
+
config.abort("Name of article is mandatory.") unless config.article
|
9
|
+
|
10
|
+
mw = MediaWiki::Gateway.new(config.url, { :loglevel => Logger::DEBUG } )
|
11
|
+
puts mw.get(config.article)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/fake_media_wiki/app.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'sinatra/base'
|
3
|
-
|
4
|
-
|
3
|
+
require_relative 'api_pages'
|
4
|
+
require_relative 'query_handling'
|
5
5
|
|
6
6
|
# A simple Rack app that stubs out a web service, for testing.
|
7
7
|
|
@@ -36,7 +36,7 @@ module FakeMediaWiki
|
|
36
36
|
@pages.add('Foopage', 'Content')
|
37
37
|
@pages.add('Redirect', '#REDIRECT', true)
|
38
38
|
|
39
|
-
@extensions = { 'FooExtension' => 'r1', 'BarExtension' => 'r2' }
|
39
|
+
@extensions = { 'FooExtension' => 'r1', 'BarExtension' => 'r2', 'Semantic MediaWiki' => '1.5' }
|
40
40
|
|
41
41
|
@logged_in_users = []
|
42
42
|
end
|
@@ -76,7 +76,7 @@ module FakeMediaWiki
|
|
76
76
|
_.query do
|
77
77
|
_.search do
|
78
78
|
namespaces = params[:srnamespace] ? params[:srnamespace].split('|') : [ "0" ]
|
79
|
-
@pages.search(params[:srsearch], namespaces).each do |key, page|
|
79
|
+
@pages.search(params[:srsearch], namespaces).first(params[:srlimit].to_i).each do |key, page|
|
80
80
|
_.p(nil, { :title => page[:title], :ns => page[:namespace], :id => page[:pageid] })
|
81
81
|
end
|
82
82
|
end
|
data/spec/gateway_spec.rb
CHANGED
@@ -2,11 +2,11 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
# Kickstart fake media wiki app
|
4
4
|
require 'sham_rack'
|
5
|
-
|
5
|
+
require_relative 'fake_media_wiki/app'
|
6
6
|
$fake_media_wiki = FakeMediaWiki::App.new
|
7
7
|
unless $fake_media_wiki.instance_of? FakeMediaWiki::App
|
8
8
|
# This is a horrible workaround for some bizarre conflict with later versions of ShamRack/Rack/Sinatra/Builder/...
|
9
|
-
$fake_media_wiki = $fake_media_wiki.instance_eval('@app').instance_eval('@app').app.app.app.app.app
|
9
|
+
$fake_media_wiki = $fake_media_wiki.instance_eval('app').instance_eval('@app').instance_eval('@app').app.app.app.app.app
|
10
10
|
end
|
11
11
|
ShamRack.mount($fake_media_wiki, 'dummy-wiki.example')
|
12
12
|
|
@@ -321,7 +321,7 @@ describe MediaWiki::Gateway do
|
|
321
321
|
<edit new='' result='Success' pageid='8' title='A New Page' oldrevid='0' newrevid='8'/>
|
322
322
|
</api>
|
323
323
|
XML
|
324
|
-
Hash.from_xml(@page.to_s).should == Hash.from_xml(expected)
|
324
|
+
Hash.from_xml(@page.first.to_s).should == Hash.from_xml(expected)
|
325
325
|
end
|
326
326
|
|
327
327
|
end
|
@@ -344,7 +344,7 @@ describe MediaWiki::Gateway do
|
|
344
344
|
<edit result='Success' pageid='8' title='Main Page' oldrevid='1' newrevid='8'/>
|
345
345
|
</api>
|
346
346
|
XML
|
347
|
-
Hash.from_xml(@new_page.to_s).should == Hash.from_xml(expected)
|
347
|
+
Hash.from_xml(@new_page.first.to_s).should == Hash.from_xml(expected)
|
348
348
|
end
|
349
349
|
|
350
350
|
end
|
@@ -375,7 +375,7 @@ describe MediaWiki::Gateway do
|
|
375
375
|
<edit result='Success' pageid='8' title='Main Page' oldrevid='1' newrevid='8'/>
|
376
376
|
</api>
|
377
377
|
XML
|
378
|
-
Hash.from_xml(@edit_page.to_s).should == Hash.from_xml(expected)
|
378
|
+
Hash.from_xml(@edit_page.first.to_s).should == Hash.from_xml(expected)
|
379
379
|
end
|
380
380
|
|
381
381
|
end
|
@@ -403,7 +403,7 @@ describe MediaWiki::Gateway do
|
|
403
403
|
<upload result="Success" filename="sample_image.jpg"/>
|
404
404
|
</api>
|
405
405
|
XML
|
406
|
-
Hash.from_xml(@page.to_s).should == Hash.from_xml(expected)
|
406
|
+
Hash.from_xml(@page.first.to_s).should == Hash.from_xml(expected)
|
407
407
|
end
|
408
408
|
|
409
409
|
end
|
@@ -431,7 +431,7 @@ describe MediaWiki::Gateway do
|
|
431
431
|
end
|
432
432
|
|
433
433
|
it "should delete the page" do
|
434
|
-
Hash.from_xml(@page.to_s) == Hash.from_xml(delete_response)
|
434
|
+
Hash.from_xml(@page.first.to_s) == Hash.from_xml(delete_response)
|
435
435
|
end
|
436
436
|
end
|
437
437
|
|
@@ -610,6 +610,17 @@ describe MediaWiki::Gateway do
|
|
610
610
|
|
611
611
|
end
|
612
612
|
|
613
|
+
describe "with maximum number of results" do
|
614
|
+
|
615
|
+
before do
|
616
|
+
@search = @gateway.search("KEY", nil, 2, 1)
|
617
|
+
end
|
618
|
+
|
619
|
+
it "should return at most the maximum number of results asked" do
|
620
|
+
@search.should have(1).string
|
621
|
+
end
|
622
|
+
end
|
623
|
+
|
613
624
|
end
|
614
625
|
|
615
626
|
describe "#namespaces_by_prefix" do
|
@@ -672,7 +683,7 @@ describe MediaWiki::Gateway do
|
|
672
683
|
end
|
673
684
|
|
674
685
|
it "should import content" do
|
675
|
-
Hash.from_xml(@page.to_s) == Hash.from_xml(import_response)
|
686
|
+
Hash.from_xml(@page.first.to_s) == Hash.from_xml(import_response)
|
676
687
|
end
|
677
688
|
|
678
689
|
end
|
@@ -727,7 +738,7 @@ describe MediaWiki::Gateway do
|
|
727
738
|
end
|
728
739
|
|
729
740
|
it "should list all extensions" do
|
730
|
-
@extensions.should == { "FooExtension" => "r1", "BarExtension" => "r2" }
|
741
|
+
@extensions.should == { "FooExtension" => "r1", "BarExtension" => "r2", 'Semantic MediaWiki' => '1.5' }
|
731
742
|
end
|
732
743
|
|
733
744
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/utils_spec.rb
CHANGED
metadata
CHANGED
@@ -1,174 +1,323 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: mediawiki-gateway
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.2
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 5
|
9
|
-
- 1
|
10
|
-
version: 0.5.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Jani Patokallio
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
12
|
+
date: 2013-07-29 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: mediawiki-gateway
|
16
|
+
requirement: &2157655800 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2157655800
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: jeweler
|
27
|
+
requirement: &2157654600 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2157654600
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: sham_rack
|
38
|
+
requirement: &2157652460 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2157652460
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rr
|
49
|
+
requirement: &2157650880 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2157650880
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: simplecov
|
60
|
+
requirement: &2157666280 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *2157666280
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: &2157665280 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '1.3'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *2157665280
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: debugger
|
82
|
+
requirement: &2157664380 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *2157664380
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: sinatra
|
93
|
+
requirement: &2157663500 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *2157663500
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: activemodel
|
104
|
+
requirement: &2157662780 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *2157662780
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: jeweler
|
115
|
+
requirement: &2157661900 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *2157661900
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: sham_rack
|
126
|
+
requirement: &2157659740 !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: *2157659740
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: rr
|
137
|
+
requirement: &2157658740 !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
type: :development
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: *2157658740
|
146
|
+
- !ruby/object:Gem::Dependency
|
147
|
+
name: simplecov
|
148
|
+
requirement: &2157137500 !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
|
+
requirements:
|
151
|
+
- - ! '>='
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
type: :development
|
155
|
+
prerelease: false
|
156
|
+
version_requirements: *2157137500
|
157
|
+
- !ruby/object:Gem::Dependency
|
158
|
+
name: rspec
|
159
|
+
requirement: &2157135860 !ruby/object:Gem::Requirement
|
160
|
+
none: false
|
161
|
+
requirements:
|
162
|
+
- - ~>
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '1.3'
|
165
|
+
type: :development
|
22
166
|
prerelease: false
|
23
|
-
|
167
|
+
version_requirements: *2157135860
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: debugger
|
170
|
+
requirement: &2157135020 !ruby/object:Gem::Requirement
|
24
171
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
172
|
+
requirements:
|
173
|
+
- - ! '>='
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
type: :development
|
177
|
+
prerelease: false
|
178
|
+
version_requirements: *2157135020
|
179
|
+
- !ruby/object:Gem::Dependency
|
180
|
+
name: sinatra
|
181
|
+
requirement: &2157133780 !ruby/object:Gem::Requirement
|
182
|
+
none: false
|
183
|
+
requirements:
|
184
|
+
- - ! '>='
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
187
|
+
type: :development
|
188
|
+
prerelease: false
|
189
|
+
version_requirements: *2157133780
|
190
|
+
- !ruby/object:Gem::Dependency
|
191
|
+
name: activemodel
|
192
|
+
requirement: &2157133160 !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
194
|
+
requirements:
|
195
|
+
- - ! '>='
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '0'
|
198
|
+
type: :development
|
199
|
+
prerelease: false
|
200
|
+
version_requirements: *2157133160
|
201
|
+
- !ruby/object:Gem::Dependency
|
202
|
+
name: rest-client
|
203
|
+
requirement: &2157131580 !ruby/object:Gem::Requirement
|
204
|
+
none: false
|
205
|
+
requirements:
|
206
|
+
- - ! '>='
|
207
|
+
- !ruby/object:Gem::Version
|
33
208
|
version: 1.3.0
|
34
209
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: activesupport
|
38
210
|
prerelease: false
|
39
|
-
|
211
|
+
version_requirements: *2157131580
|
212
|
+
- !ruby/object:Gem::Dependency
|
213
|
+
name: activesupport
|
214
|
+
requirement: &2157129920 !ruby/object:Gem::Requirement
|
40
215
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
version: "0"
|
216
|
+
requirements:
|
217
|
+
- - ! '>='
|
218
|
+
- !ruby/object:Gem::Version
|
219
|
+
version: '0'
|
48
220
|
type: :runtime
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: jeweler
|
52
221
|
prerelease: false
|
53
|
-
|
222
|
+
version_requirements: *2157129920
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: jeweler
|
225
|
+
requirement: &2157679720 !ruby/object:Gem::Requirement
|
54
226
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
segments:
|
60
|
-
- 0
|
61
|
-
version: "0"
|
227
|
+
requirements:
|
228
|
+
- - ! '>='
|
229
|
+
- !ruby/object:Gem::Version
|
230
|
+
version: '0'
|
62
231
|
type: :development
|
63
|
-
version_requirements: *id003
|
64
|
-
- !ruby/object:Gem::Dependency
|
65
|
-
name: sham_rack
|
66
232
|
prerelease: false
|
67
|
-
|
233
|
+
version_requirements: *2157679720
|
234
|
+
- !ruby/object:Gem::Dependency
|
235
|
+
name: sham_rack
|
236
|
+
requirement: &2157678140 !ruby/object:Gem::Requirement
|
68
237
|
none: false
|
69
|
-
requirements:
|
70
|
-
- -
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
|
73
|
-
segments:
|
74
|
-
- 0
|
75
|
-
version: "0"
|
238
|
+
requirements:
|
239
|
+
- - ! '>='
|
240
|
+
- !ruby/object:Gem::Version
|
241
|
+
version: '0'
|
76
242
|
type: :development
|
77
|
-
version_requirements: *id004
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: rr
|
80
243
|
prerelease: false
|
81
|
-
|
244
|
+
version_requirements: *2157678140
|
245
|
+
- !ruby/object:Gem::Dependency
|
246
|
+
name: rr
|
247
|
+
requirement: &2157677380 !ruby/object:Gem::Requirement
|
82
248
|
none: false
|
83
|
-
requirements:
|
84
|
-
- -
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
|
87
|
-
segments:
|
88
|
-
- 0
|
89
|
-
version: "0"
|
249
|
+
requirements:
|
250
|
+
- - ! '>='
|
251
|
+
- !ruby/object:Gem::Version
|
252
|
+
version: '0'
|
90
253
|
type: :development
|
91
|
-
version_requirements: *id005
|
92
|
-
- !ruby/object:Gem::Dependency
|
93
|
-
name: rcov
|
94
254
|
prerelease: false
|
95
|
-
|
255
|
+
version_requirements: *2157677380
|
256
|
+
- !ruby/object:Gem::Dependency
|
257
|
+
name: simplecov
|
258
|
+
requirement: &2157676620 !ruby/object:Gem::Requirement
|
96
259
|
none: false
|
97
|
-
requirements:
|
98
|
-
- -
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
|
101
|
-
segments:
|
102
|
-
- 0
|
103
|
-
version: "0"
|
260
|
+
requirements:
|
261
|
+
- - ! '>='
|
262
|
+
- !ruby/object:Gem::Version
|
263
|
+
version: '0'
|
104
264
|
type: :development
|
105
|
-
version_requirements: *id006
|
106
|
-
- !ruby/object:Gem::Dependency
|
107
|
-
name: rspec
|
108
265
|
prerelease: false
|
109
|
-
|
266
|
+
version_requirements: *2157676620
|
267
|
+
- !ruby/object:Gem::Dependency
|
268
|
+
name: rspec
|
269
|
+
requirement: &2157675900 !ruby/object:Gem::Requirement
|
110
270
|
none: false
|
111
|
-
requirements:
|
271
|
+
requirements:
|
112
272
|
- - ~>
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
|
115
|
-
|
116
|
-
- 1
|
117
|
-
- 3
|
118
|
-
version: "1.3"
|
119
|
-
type: :development
|
120
|
-
version_requirements: *id007
|
121
|
-
- !ruby/object:Gem::Dependency
|
122
|
-
name: ruby-debug
|
123
|
-
prerelease: false
|
124
|
-
requirement: &id008 !ruby/object:Gem::Requirement
|
125
|
-
none: false
|
126
|
-
requirements:
|
127
|
-
- - ">="
|
128
|
-
- !ruby/object:Gem::Version
|
129
|
-
hash: 3
|
130
|
-
segments:
|
131
|
-
- 0
|
132
|
-
version: "0"
|
133
|
-
type: :development
|
134
|
-
version_requirements: *id008
|
135
|
-
- !ruby/object:Gem::Dependency
|
136
|
-
name: sinatra
|
273
|
+
- !ruby/object:Gem::Version
|
274
|
+
version: '1.3'
|
275
|
+
type: :development
|
137
276
|
prerelease: false
|
138
|
-
|
277
|
+
version_requirements: *2157675900
|
278
|
+
- !ruby/object:Gem::Dependency
|
279
|
+
name: debugger
|
280
|
+
requirement: &2157675100 !ruby/object:Gem::Requirement
|
139
281
|
none: false
|
140
|
-
requirements:
|
141
|
-
- -
|
142
|
-
- !ruby/object:Gem::Version
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
282
|
+
requirements:
|
283
|
+
- - ! '>='
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: '0'
|
286
|
+
type: :development
|
287
|
+
prerelease: false
|
288
|
+
version_requirements: *2157675100
|
289
|
+
- !ruby/object:Gem::Dependency
|
290
|
+
name: sinatra
|
291
|
+
requirement: &2157674320 !ruby/object:Gem::Requirement
|
292
|
+
none: false
|
293
|
+
requirements:
|
294
|
+
- - ! '>='
|
295
|
+
- !ruby/object:Gem::Version
|
296
|
+
version: '0'
|
147
297
|
type: :development
|
148
|
-
version_requirements: *id009
|
149
|
-
- !ruby/object:Gem::Dependency
|
150
|
-
name: activemodel
|
151
298
|
prerelease: false
|
152
|
-
|
299
|
+
version_requirements: *2157674320
|
300
|
+
- !ruby/object:Gem::Dependency
|
301
|
+
name: activemodel
|
302
|
+
requirement: &2157673340 !ruby/object:Gem::Requirement
|
153
303
|
none: false
|
154
|
-
requirements:
|
155
|
-
- -
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
|
158
|
-
segments:
|
159
|
-
- 0
|
160
|
-
version: "0"
|
304
|
+
requirements:
|
305
|
+
- - ! '>='
|
306
|
+
- !ruby/object:Gem::Version
|
307
|
+
version: '0'
|
161
308
|
type: :development
|
162
|
-
|
163
|
-
|
309
|
+
prerelease: false
|
310
|
+
version_requirements: *2157673340
|
311
|
+
description: ''
|
164
312
|
email: jpatokal@iki.fi
|
165
313
|
executables: []
|
166
|
-
|
167
314
|
extensions: []
|
168
|
-
|
169
|
-
extra_rdoc_files:
|
315
|
+
extra_rdoc_files:
|
170
316
|
- README
|
171
|
-
files:
|
317
|
+
files:
|
318
|
+
- .rvmrc
|
319
|
+
- Gemfile
|
320
|
+
- Gemfile.lock
|
172
321
|
- README
|
173
322
|
- Rakefile
|
174
323
|
- config/hosts.yml
|
@@ -178,19 +327,19 @@ files:
|
|
178
327
|
- lib/media_wiki/gateway.rb
|
179
328
|
- lib/media_wiki/utils.rb
|
180
329
|
- mediawiki-gateway.gemspec
|
181
|
-
-
|
182
|
-
-
|
183
|
-
-
|
184
|
-
-
|
185
|
-
-
|
186
|
-
-
|
187
|
-
-
|
188
|
-
-
|
189
|
-
-
|
190
|
-
-
|
191
|
-
-
|
192
|
-
-
|
193
|
-
-
|
330
|
+
- samples/README
|
331
|
+
- samples/create_page.rb
|
332
|
+
- samples/delete_batch.rb
|
333
|
+
- samples/download_batch.rb
|
334
|
+
- samples/email_user.rb
|
335
|
+
- samples/export_xml.rb
|
336
|
+
- samples/get_page.rb
|
337
|
+
- samples/import_xml.rb
|
338
|
+
- samples/run_fake_media_wiki.rb
|
339
|
+
- samples/search_content.rb
|
340
|
+
- samples/semantic_query.rb
|
341
|
+
- samples/upload_commons.rb
|
342
|
+
- samples/upload_file.rb
|
194
343
|
- spec/fake_media_wiki/api_pages.rb
|
195
344
|
- spec/fake_media_wiki/app.rb
|
196
345
|
- spec/fake_media_wiki/query_handling.rb
|
@@ -200,36 +349,29 @@ files:
|
|
200
349
|
- spec/utils_spec.rb
|
201
350
|
homepage: http://github.com/jpatokal/mediawiki-gateway
|
202
351
|
licenses: []
|
203
|
-
|
204
352
|
post_install_message:
|
205
353
|
rdoc_options: []
|
206
|
-
|
207
|
-
require_paths:
|
354
|
+
require_paths:
|
208
355
|
- lib
|
209
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
356
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
210
357
|
none: false
|
211
|
-
requirements:
|
212
|
-
- -
|
213
|
-
- !ruby/object:Gem::Version
|
214
|
-
|
215
|
-
segments:
|
358
|
+
requirements:
|
359
|
+
- - ! '>='
|
360
|
+
- !ruby/object:Gem::Version
|
361
|
+
version: '0'
|
362
|
+
segments:
|
216
363
|
- 0
|
217
|
-
|
218
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
364
|
+
hash: 575989764206727344
|
365
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
219
366
|
none: false
|
220
|
-
requirements:
|
221
|
-
- -
|
222
|
-
- !ruby/object:Gem::Version
|
223
|
-
|
224
|
-
segments:
|
225
|
-
- 0
|
226
|
-
version: "0"
|
367
|
+
requirements:
|
368
|
+
- - ! '>='
|
369
|
+
- !ruby/object:Gem::Version
|
370
|
+
version: '0'
|
227
371
|
requirements: []
|
228
|
-
|
229
372
|
rubyforge_project:
|
230
373
|
rubygems_version: 1.8.10
|
231
374
|
signing_key:
|
232
375
|
specification_version: 3
|
233
376
|
summary: Connect to the mediawiki API
|
234
377
|
test_files: []
|
235
|
-
|
data/script/README
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
Sample scripts using MediaWiki::Gateway. These expect to be run from the MediaWiki::Gateway root directory with ./config/hosts.yml accessible and configured with real usernames, passwords etc. Remove Logger::DEBUG from scripts for less verbose output.
|
2
|
-
|
3
|
-
All the script use the local instance of MediaWiki::Gateway in ./lib. To use an installed gem, use this require line instead:
|
4
|
-
|
5
|
-
require 'media_wiki'
|
6
|
-
|
7
|
-
Examples:
|
8
|
-
|
9
|
-
Check syntax for create page script
|
10
|
-
|
11
|
-
ruby script/create_page.rb
|
12
|
-
|
13
|
-
Pipe the content of "content.txt" into the page 'Sandbox:MediaWikiGatewayTest' on the English Wikipedia
|
14
|
-
|
15
|
-
ruby script/create_page.rb -h en-wp -a Sandbox:MediaWikiGatewayTest <content.txt
|
16
|
-
*or*
|
17
|
-
ruby script/create_page.rb --host en-wp --article Sandbox:MediaWikiGatewayTest <content.txt
|
18
|
-
|
data/script/get_page.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# Sample script for fetching a page's current contents in Wiki markup
|
4
|
-
#
|
5
|
-
require './lib/media_wiki'
|
6
|
-
|
7
|
-
if ARGV.length < 2
|
8
|
-
raise "Syntax: get_page.rb <host> <name>"
|
9
|
-
end
|
10
|
-
|
11
|
-
mw = MediaWiki::Gateway.new(ARGV[0])
|
12
|
-
puts mw.get(ARGV[1])
|