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 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!', 'Comment: My first page')
23
+ mw.create('PageTitle', 'Hello world!', :summary => 'My first page')
24
24
 
25
25
  == Credits
26
26
 
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ require 'thread'
1
2
  require 'rake'
2
3
  require 'rake/gempackagetask'
3
4
  require 'rake/rdoctask'
@@ -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
- return make_api_request(form_data)
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.3"
8
+ VERSION = "0.4.4"
8
9
  end
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{mediawiki-gateway}
8
- s.version = "0.4.3"
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 = %q{2011-09-07}
13
- s.description = %q{}
14
- s.email = %q{jpatokal@iki.fi}
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 = %q{http://github.com/jpatokal/mediawiki-gateway}
47
+ s.homepage = "http://github.com/jpatokal/mediawiki-gateway"
48
48
  s.require_paths = ["lib"]
49
- s.rubygems_version = %q{1.3.7}
50
- s.summary = %q{Connect to the mediawiki API}
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
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Sample script for fetching a page's current contents in Wiki markup
4
4
  #
5
- require 'lib/media_wiki'
5
+ require './lib/media_wiki'
6
6
 
7
7
  config = MediaWiki::Config.new ARGV
8
8
  config.abort("Name of article is mandatory.") unless config.article
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- require 'lib/media_wiki'
2
+ require './lib/media_wiki'
3
3
 
4
4
  if ARGV.length <1
5
5
  raise "Syntax: delete_batch.rb <wiki-api-url> <startswith_pattern>"
@@ -1,4 +1,4 @@
1
- require 'lib/media_wiki'
1
+ require './lib/media_wiki'
2
2
 
3
3
  config = MediaWiki::Config.new ARGV
4
4
 
data/script/export_xml.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Export MediaWiki pages as XML
4
4
  #
5
- require 'lib/media_wiki'
5
+ require './lib/media_wiki'
6
6
 
7
7
  if ARGV.length < 3
8
8
  raise "Syntax: export_xml.rb <host> <user> <password> [page page page...]"
data/script/get_page.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Sample script for fetching a page's current contents in Wiki markup
4
4
  #
5
- require 'lib/media_wiki'
5
+ require './lib/media_wiki'
6
6
 
7
7
  if ARGV.length < 2
8
8
  raise "Syntax: get_page.rb <host> <name>"
data/script/import_xml.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Import a MediaWiki XML dump
4
4
  #
5
- require 'lib/media_wiki'
5
+ require './lib/media_wiki'
6
6
 
7
7
  if ARGV.length < 3
8
8
  raise "Syntax: import_xml.rb <host> <username> <password> <file>"
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Sample script for searching page contents in a Wiki
4
4
  #
5
- require 'lib/media_wiki'
5
+ require './lib/media_wiki'
6
6
 
7
7
  config = MediaWiki::Config.new ARGV
8
8
  config.abort("Please specify search key as article name (-a)") unless config.article
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Sample script for uploading files to Mediawiki Commons (interactive)
4
4
 
5
- require 'lib/media_wiki'
5
+ require './lib/media_wiki'
6
6
 
7
7
  config = MediaWiki::Config.new(ARGV, "upload")
8
8
  file = ARGV[0]
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Sample script for fetching a page's current contents in Wiki markup
4
4
  #
5
- require 'lib/media_wiki'
5
+ require './lib/media_wiki'
6
6
 
7
7
  config = MediaWiki::Config.new(ARGV, "upload")
8
8
  config.abort("Name of file to upload is mandatory.") unless ARGV[0]
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: 9
5
- prerelease: false
4
+ hash: 7
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 3
10
- version: 0.4.3
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: 2011-09-07 00:00:00 +10:00
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.3.7
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
- - spec/fake_media_wiki/api_pages.rb
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
+