wikibot 0.2.3.1 → 0.2.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'lib/wikibot/version'
5
5
 
6
6
  Echoe.new('wikibot', WikiBot::VERSION) do |p|
7
7
  p.description = "Mediawiki Bot framework"
8
- p.url = "http://github.com/dvandersluis/wiki_bot"
8
+ p.url = "http://github.com/dvandersluis/wikibot"
9
9
  p.author = "Daniel Vandersluis"
10
10
  p.email = "daniel@codexed.com"
11
11
  p.ignore_pattern = ["tmp/*", "script/*"]
@@ -15,9 +15,23 @@ module WikiBot
15
15
 
16
16
  ###
17
17
  # Read from page
18
+ def exists?(reload = false)
19
+ @exists = nil if reload
20
+ @exists ||= begin
21
+ data = {
22
+ :action => :query,
23
+ :titles => @name
24
+ }
25
+
26
+ !@wiki_bot.query_api(:get, data).query.pages.page.include?("missing")
27
+ end
28
+ end
29
+
18
30
  def content(reload = false)
19
31
  @content = nil if reload
20
32
  @content ||= begin
33
+ return "" unless exists?
34
+
21
35
  data = {
22
36
  :action => :query,
23
37
  :titles => @name,
@@ -33,6 +47,8 @@ module WikiBot
33
47
  def text(reload = false)
34
48
  @text = nil if reload
35
49
  @text ||= begin
50
+ return "" unless exists?
51
+
36
52
  data = {
37
53
  :action => :parse,
38
54
  :page => @name
@@ -90,6 +106,7 @@ module WikiBot
90
106
  # Write to page
91
107
  def writable?
92
108
  return false if @wiki_bot.debug or @wiki_bot.readonly
109
+ return true unless content
93
110
 
94
111
  # Deny all bots
95
112
  return false if content.include?("{{nobots}}") or content.include?("{{bots|deny=all}}") or content.include?("{{bots|allow=none}}")
@@ -132,6 +149,8 @@ module WikiBot
132
149
  status = result.edit.result
133
150
  @wiki_bot.page_writes += 1
134
151
  raise WriteError, status unless status == "Success"
152
+
153
+ true
135
154
  end
136
155
  end
137
156
  end
@@ -1,3 +1,3 @@
1
1
  module WikiBot
2
- VERSION = "0.2.3.1"
2
+ VERSION = "0.2.4.1"
3
3
  end
data/wikibot.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{wikibot}
5
- s.version = "0.2.3.1"
5
+ s.version = "0.2.4.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Daniel Vandersluis"]
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.email = %q{daniel@codexed.com}
12
12
  s.extra_rdoc_files = ["README.textile", "lib/wikibot.rb", "lib/wikibot/core/bot.rb", "lib/wikibot/core/category.rb", "lib/wikibot/core/page.rb", "lib/wikibot/ext/hash.rb", "lib/wikibot/vendor/openhash.rb", "lib/wikibot/version.rb"]
13
13
  s.files = ["README.textile", "Rakefile", "lib/wikibot.rb", "lib/wikibot/core/bot.rb", "lib/wikibot/core/category.rb", "lib/wikibot/core/page.rb", "lib/wikibot/ext/hash.rb", "lib/wikibot/vendor/openhash.rb", "lib/wikibot/version.rb", "wikibot.gemspec", "Manifest"]
14
- s.homepage = %q{http://github.com/dvandersluis/wiki_bot}
14
+ s.homepage = %q{http://github.com/dvandersluis/wikibot}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Wikibot", "--main", "README.textile"]
16
16
  s.require_paths = ["lib"]
17
17
  s.rubyforge_project = %q{wikibot}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wikibot
3
3
  version: !ruby/object:Gem::Version
4
- hash: 81
4
+ hash: 77
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 3
9
+ - 4
10
10
  - 1
11
- version: 0.2.3.1
11
+ version: 0.2.4.1
12
12
  platform: ruby
13
13
  authors:
14
14
  - Daniel Vandersluis
@@ -112,7 +112,7 @@ files:
112
112
  - wikibot.gemspec
113
113
  - Manifest
114
114
  has_rdoc: true
115
- homepage: http://github.com/dvandersluis/wiki_bot
115
+ homepage: http://github.com/dvandersluis/wikibot
116
116
  licenses: []
117
117
 
118
118
  post_install_message: