mediawiki-gateway 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +1 -1
- data/Rakefile +1 -0
- data/lib/media_wiki/gateway.rb +2 -1
- data/lib/media_wiki.rb +2 -1
- data/mediawiki-gateway.gemspec +8 -17
- data/script/README +4 -0
- data/script/create_page.rb +1 -1
- data/script/delete_batch.rb +1 -1
- data/script/download_batch.rb +1 -1
- data/script/export_xml.rb +1 -1
- data/script/get_page.rb +1 -1
- data/script/import_xml.rb +1 -1
- data/script/search_content.rb +1 -1
- data/script/upload_commons.rb +1 -1
- data/script/upload_file.rb +1 -1
- metadata +8 -15
data/README
CHANGED
@@ -20,7 +20,7 @@ Simple page creation script:
|
|
20
20
|
require 'media_wiki'
|
21
21
|
mw = MediaWiki::Gateway.new('http://my-wiki.example/w/api.php')
|
22
22
|
mw.login('RubyBot', 'pa$$w0rd')
|
23
|
-
mw.create('PageTitle', 'Hello world!',
|
23
|
+
mw.create('PageTitle', 'Hello world!', :summary => 'My first page')
|
24
24
|
|
25
25
|
== Credits
|
26
26
|
|
data/Rakefile
CHANGED
data/lib/media_wiki/gateway.rb
CHANGED
@@ -130,6 +130,7 @@ module MediaWiki
|
|
130
130
|
def create(title, content, options={})
|
131
131
|
form_data = {'action' => 'edit', 'title' => title, 'text' => content, 'summary' => (options[:summary] || ""), 'token' => get_token('edit', title)}
|
132
132
|
form_data['createonly'] = "" unless options[:overwrite]
|
133
|
+
form_data['section'] = options[:section].to_s if options[:section]
|
133
134
|
make_api_request(form_data)
|
134
135
|
end
|
135
136
|
|
@@ -433,7 +434,7 @@ module MediaWiki
|
|
433
434
|
# Returns MediaWiki XML dump
|
434
435
|
def export(page_titles)
|
435
436
|
form_data = {'action' => 'query', 'titles' => [page_titles].join('|'), 'export' => nil, 'exportnowrap' => nil}
|
436
|
-
|
437
|
+
make_api_request(form_data).first
|
437
438
|
end
|
438
439
|
|
439
440
|
# Get a list of all known namespaces
|
data/lib/media_wiki.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
require 'thread' # bizarre workaround for Rails 2.3.x/RubyGems incompatibility
|
1
2
|
require File.dirname(__FILE__) + '/media_wiki/config'
|
2
3
|
require File.dirname(__FILE__) + '/media_wiki/exception'
|
3
4
|
require File.dirname(__FILE__) + '/media_wiki/utils'
|
4
5
|
require File.dirname(__FILE__) + '/media_wiki/gateway'
|
5
6
|
|
6
7
|
module MediaWiki
|
7
|
-
VERSION = "0.4.
|
8
|
+
VERSION = "0.4.4"
|
8
9
|
end
|
data/mediawiki-gateway.gemspec
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.4.
|
7
|
+
s.name = "mediawiki-gateway"
|
8
|
+
s.version = "0.4.4"
|
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 =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = "2012-02-05"
|
13
|
+
s.description = ""
|
14
|
+
s.email = "jpatokal@iki.fi"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README"
|
17
17
|
]
|
@@ -44,21 +44,12 @@ Gem::Specification.new do |s|
|
|
44
44
|
"spec/spec_helper.rb",
|
45
45
|
"spec/utils_spec.rb"
|
46
46
|
]
|
47
|
-
s.homepage =
|
47
|
+
s.homepage = "http://github.com/jpatokal/mediawiki-gateway"
|
48
48
|
s.require_paths = ["lib"]
|
49
|
-
s.rubygems_version =
|
50
|
-
s.summary =
|
51
|
-
s.test_files = [
|
52
|
-
"spec/fake_media_wiki/api_pages.rb",
|
53
|
-
"spec/fake_media_wiki/app.rb",
|
54
|
-
"spec/fake_media_wiki/query_handling.rb",
|
55
|
-
"spec/gateway_spec.rb",
|
56
|
-
"spec/spec_helper.rb",
|
57
|
-
"spec/utils_spec.rb"
|
58
|
-
]
|
49
|
+
s.rubygems_version = "1.8.11"
|
50
|
+
s.summary = "Connect to the mediawiki API"
|
59
51
|
|
60
52
|
if s.respond_to? :specification_version then
|
61
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
62
53
|
s.specification_version = 3
|
63
54
|
|
64
55
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
data/script/README
CHANGED
@@ -1,5 +1,9 @@
|
|
1
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
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
|
+
|
3
7
|
Examples:
|
4
8
|
|
5
9
|
Check syntax for create page script
|
data/script/create_page.rb
CHANGED
data/script/delete_batch.rb
CHANGED
data/script/download_batch.rb
CHANGED
data/script/export_xml.rb
CHANGED
data/script/get_page.rb
CHANGED
data/script/import_xml.rb
CHANGED
data/script/search_content.rb
CHANGED
data/script/upload_commons.rb
CHANGED
data/script/upload_file.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mediawiki-gateway
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 7
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 4
|
10
|
+
version: 0.4.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jani Patokallio
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
19
|
-
default_executable:
|
18
|
+
date: 2012-02-05 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: rest-client
|
@@ -126,7 +125,6 @@ files:
|
|
126
125
|
- spec/import-test-data.xml
|
127
126
|
- spec/spec_helper.rb
|
128
127
|
- spec/utils_spec.rb
|
129
|
-
has_rdoc: true
|
130
128
|
homepage: http://github.com/jpatokal/mediawiki-gateway
|
131
129
|
licenses: []
|
132
130
|
|
@@ -156,14 +154,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
154
|
requirements: []
|
157
155
|
|
158
156
|
rubyforge_project:
|
159
|
-
rubygems_version: 1.
|
157
|
+
rubygems_version: 1.8.11
|
160
158
|
signing_key:
|
161
159
|
specification_version: 3
|
162
160
|
summary: Connect to the mediawiki API
|
163
|
-
test_files:
|
164
|
-
|
165
|
-
- spec/fake_media_wiki/app.rb
|
166
|
-
- spec/fake_media_wiki/query_handling.rb
|
167
|
-
- spec/gateway_spec.rb
|
168
|
-
- spec/spec_helper.rb
|
169
|
-
- spec/utils_spec.rb
|
161
|
+
test_files: []
|
162
|
+
|