wikibot 0.2.1.1 → 0.2.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -1,10 +1,11 @@
1
1
  README.textile
2
2
  Rakefile
3
- lib/category.rb
4
- lib/class_ext.rb
5
- lib/hash_ext.rb
6
- lib/openhash.rb
7
- lib/page.rb
8
3
  lib/wikibot.rb
4
+ lib/wikibot/core/bot.rb
5
+ lib/wikibot/core/category.rb
6
+ lib/wikibot/core/page.rb
7
+ lib/wikibot/ext/hash.rb
8
+ lib/wikibot/vendor/openhash.rb
9
+ lib/wikibot/version.rb
9
10
  wikibot.gemspec
10
11
  Manifest
data/README.textile CHANGED
@@ -4,16 +4,61 @@ h2. About
4
4
 
5
5
  WikiBot was originally a PHP-based framework for bots I run on Wikipedia, however when it broke due to changes in mediawiki code, I decided to rewrite it in Ruby, using the MediaWiki API instead of screen-scraping. This is the result.
6
6
 
7
- As you'll notice, the features it provides are somewhat sparse at the moment, as I've only been adding features that I require. When I get more time, I'll flesh it out more.
7
+ By default, the bot uses the English Wikipedia. A different instance of MediaWiki can be used by specifying the @:api@ key when instantiating the class.
8
8
 
9
- h2. Gem Requirements
9
+ The bot is not yet fully-featured, in that it doesn't abstract every possible MediaWiki API feature. However, unsupported queries can be constructed and will return a Hash based on the result XML (see Examples).
10
10
 
11
- * "taf2-curb":taf2 (a fork of curb; using the base curb gem might work but is untested)
12
- * "xml-simple":xml
13
- * "deep_merge":dm
14
- * "andand":aa
11
+ h2. Installation
15
12
 
16
- [taf2]http://github.com/taf2/curb/tree/master
17
- [xml]http://xml-simple.rubyforge.org/
18
- [dm]http://rubyforge.org/projects/deepmerge/
19
- [aa]http://andand.rubyforge.org/
13
+ WikiBot is now a gem on rubygems, so installation is as simple as
14
+
15
+ bc. gem install wikibot
16
+
17
+ If you want to install manually, the following gem dependencies are required:
18
+
19
+ * "curb":curb >= 0.5.4.0 (the taf2-curb gem can be used as well)
20
+ * "xml-simple":xml >= 1.0.12
21
+ * "deep_merge":dm >= 0.1.0
22
+ * "andand":aa >= 1.3.1
23
+
24
+ h2. Usage
25
+
26
+ bc. wb = WikiBot::Bot.new( "username", "password", { options } )
27
+
28
+ When initializing a new WikiBot, the following options are available:
29
+
30
+ * @autologin@ (default: false) - specifies if the bot should log into the mediawiki automatically. @WikiBot::Bot#login@ can be used to login otherwise.
31
+ * @api@ (default: @http://en.wikipedia.org/w/api.php@) - the URL of the API to use
32
+ * @readonly@ (default: false) - if true, the bot will not perform any write operation
33
+ * @debug@ (default: false) - outputs Curb debug messages
34
+
35
+ Logging in is not required for queries that use @GET@, but is for queries that use @POST@.
36
+
37
+ h2. Examples
38
+
39
+ h3. Grabbing the text of a page
40
+
41
+ bc. wb = WikiBot::Bot.new("username", "password")
42
+ page = wb.page("Main Page")
43
+ text = page.text
44
+
45
+ h3. Setting up some options
46
+
47
+ bc. wb = WikiBot::Bot.new("username", "password", :autologin => true, :api => "http://fr.wikipedia.org/w/api.php")
48
+
49
+ h3. Performing an unsupported query
50
+
51
+ @WikiBot::Bot#query_api@ can be used to send an arbitrary query to the API. For this example, we'll get image info from the Main Page.
52
+
53
+ bc. wb = WikiBot::Bot.new("username", "password", :autologin => true)
54
+ query_data = {
55
+ :action => :query,
56
+ :prop => :images,
57
+ :titles => "Main Page"
58
+ }
59
+ xml_hash = wb.query_api(:get, query_data)
60
+
61
+ [curb]http://rubygems.org/gems/curb
62
+ [xml]http://rubygems.org/gems/xml-simple
63
+ [dm]http://rubygems.org/gems/deep_merge
64
+ [aa]http://rubygems.org/gems/andand
data/Rakefile CHANGED
@@ -1,15 +1,16 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
+ require 'lib/wikibot/version'
4
5
 
5
- Echoe.new('wikibot', '0.2.1.1') do |p|
6
+ Echoe.new('wikibot', WikiBot::VERSION) do |p|
6
7
  p.description = "Mediawiki Bot framework"
7
8
  p.url = "http://github.com/dvandersluis/wiki_bot"
8
9
  p.author = "Daniel Vandersluis"
9
10
  p.email = "daniel@codexed.com"
10
11
  p.ignore_pattern = ["tmp/*", "script/*"]
11
12
  p.development_dependencies = []
12
- p.runtime_dependencies = ['taf2-curb >=0.5.4.0', 'xml-simple >=1.0.12', 'deep_merge >=0.1.0', 'andand >=1.3.1']
13
+ p.runtime_dependencies = ['curb >=0.5.4.0', 'xml-simple >=1.0.12', 'deep_merge >=0.1.0', 'andand >=1.3.1']
13
14
  end
14
15
 
15
16
  Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
data/lib/wikibot.rb CHANGED
@@ -1,13 +1,9 @@
1
- require 'class_ext'
2
- require 'hash_ext'
3
- require 'openhash'
4
- require 'page'
5
- require 'category'
6
-
7
- require 'rubygems'
8
- require 'curb'
9
- require 'xmlsimple'
10
- require 'deep_merge'
1
+ require 'wikibot/ext/hash'
2
+ require 'wikibot/vendor/openhash'
3
+ require 'wikibot/core/bot'
4
+ require 'wikibot/core/page'
5
+ require 'wikibot/core/category'
6
+ require 'wikibot/version'
11
7
 
12
8
  module WikiBot
13
9
  class CurbError < StandardError
@@ -24,190 +20,4 @@ module WikiBot
24
20
  @info = info
25
21
  end
26
22
  end
27
-
28
- class Bot
29
- class LoginError < StandardError; end
30
-
31
- @@version = "0.2.1" # WikiBot version
32
-
33
- cattr_reader :version
34
- #cattr_accessor :cookiejar # Filename where cookies will be stored
35
-
36
- attr_reader :config
37
- attr_reader :api_hits # How many times the API was queried
38
- attr_accessor :page_writes # How many write operations were performed
39
- attr_accessor :debug # In debug mode, no writes will be made to the wiki
40
- attr_accessor :readonly # Writes will not be made
41
-
42
- def initialize(username, password, options = {})
43
- @cookies = OpenHash.new
44
- @api_hits = 0
45
- @page_writes = 0
46
-
47
- api = options[:api] || "http://en.wikipedia.org/w/api.php"
48
- auto_login = options[:auto_login] || false
49
- @readonly = options[:readonly] || false
50
- @debug = options[:debug] || false
51
-
52
- @config = {
53
- :username => username,
54
- :password => password,
55
- :api => api,
56
- :logged_in => false
57
- }.to_openhash
58
-
59
- # Set up cURL:
60
- @curl = Curl::Easy.new do |c|
61
- c.headers["User-Agent"] = "Mozilla/5.0 Curb/Taf2/0.2.8 WikiBot/#{@config.username}/#{@@version}"
62
- #c.enable_cookies = true
63
- #c.cookiejar = @@cookiejar
64
- end
65
-
66
- login if auto_login
67
- end
68
-
69
- def query_api(method, raw_data = {})
70
- # Send a query to the API and handle the response
71
- url = @config.api
72
- raw_data = raw_data.to_openhash
73
-
74
- raw_data[:format] = :xml if raw_data.format.nil?
75
-
76
- # Setup cookie headers for the request
77
- @curl.headers["Cookie"] = @cookies.inject([]) do |memo, pair|
78
- key, val = pair
79
- memo.push(CGI::escape(key) + "=" + CGI::escape(val))
80
- end.join("; ") unless @cookies.nil?
81
-
82
- response_xml = {}
83
-
84
- while true
85
- if method == :post
86
- data = raw_data.to_post_fields
87
- elsif method == :get
88
- url = url.chomp("?") + "?" + raw_data.to_querystring
89
- data = nil
90
- end
91
-
92
- @curl.url = url
93
- @curl.headers["Expect"] = nil # MediaWiki will give a 417 error if Expect is set
94
-
95
- if @debug
96
- @curl.on_debug do |type, data|
97
- p data
98
- end
99
- end
100
-
101
- # If Set-Cookie headers are given in the response, set the cookies
102
- @curl.on_header do |data|
103
- header, text = data.split(":").map(&:strip)
104
- if header == "Set-Cookie"
105
- parts = text.split(";")
106
- cookie_name, cookie_value = parts[0].split("=")
107
- @cookies[cookie_name] = cookie_value
108
- end
109
- data.length
110
- end
111
-
112
- params = ["http_#{method}".to_sym]
113
- params.push(*data) unless data.nil? or (data.is_a? Array and data.empty?)
114
- @curl.send(*params)
115
- @api_hits += 1
116
-
117
- raise CurbError.new(@curl) unless @curl.response_code == 200
118
-
119
- xml = XmlSimple.xml_in(@curl.body_str, {'ForceArray' => false})
120
- raise APIError.new(xml['error']['code'], xml['error']['info']) if xml['error']
121
-
122
- response_xml.deep_merge! xml
123
- if xml['query-continue']
124
- raw_data.merge! xml['query-continue'][xml['query-continue'].keys.first]
125
- else
126
- break
127
- end
128
- end
129
-
130
- response_xml.to_openhash
131
- end
132
-
133
- def logged_in?
134
- @config.logged_in
135
- end
136
-
137
- def login
138
- return if logged_in?
139
-
140
- data = {
141
- :action => :login,
142
- :lgname => @config.username,
143
- :lgpassword => @config.password
144
- }
145
-
146
- response = query_api(:post, data).login
147
-
148
- if response.result == "NeedToken"
149
- data = {
150
- :action => :login,
151
- :lgname => @config.username,
152
- :lgpassword => @config.password,
153
- :lgtoken => response.token
154
- }
155
-
156
- response = query_api(:post, data).login
157
- end
158
-
159
- raise LoginError, response.result unless response.result == "Success"
160
-
161
- @config.cookieprefix = response.cookieprefix
162
- @config.logged_in = true
163
- end
164
-
165
- def logout
166
- return unless logged_in?
167
-
168
- query_api(:post, { :action => :logout })
169
- @config.logged_in = false
170
- @config.edit_token = nil
171
- end
172
-
173
- def edit_token(page = "Main Page")
174
- return nil unless logged_in?
175
- @config.edit_token ||= begin
176
- data = {
177
- :action => :query,
178
- :prop => :info,
179
- :intoken => :edit,
180
- :titles => page
181
- }
182
-
183
- query_api(:get, data).query.pages.page.edittoken
184
- end
185
- end
186
-
187
- # Get wiki stats
188
- def stats
189
- data = {
190
- :action => :query,
191
- :meta => :siteinfo,
192
- :siprop => :statistics
193
- }
194
-
195
- query_api(:get, data).query.statistics
196
- end
197
-
198
- def page(name)
199
- WikiBot::Page.new(self, name)
200
- end
201
-
202
- def category(name)
203
- WikiBot::Category.new(self, name)
204
- end
205
-
206
- def format_date(date)
207
- # Formats a date into the Wikipedia format
208
- time = date.strftime("%H:%M")
209
- month = date.strftime("%B")
210
- "#{time}, #{date.day} #{month} #{date.year} (UTC)"
211
- end
212
- end
213
23
  end
@@ -0,0 +1,195 @@
1
+ require 'rubygems'
2
+ require 'curb'
3
+ require 'xmlsimple'
4
+ require 'deep_merge'
5
+ require 'zlib'
6
+
7
+ module WikiBot
8
+ class Bot
9
+ class LoginError < StandardError; end
10
+
11
+ attr_reader :config
12
+ attr_reader :api_hits # How many times the API was queried
13
+ attr_accessor :page_writes # How many write operations were performed
14
+ attr_accessor :debug # In debug mode, no writes will be made to the wiki
15
+ attr_accessor :readonly # Writes will not be made
16
+
17
+ def initialize(username, password, options = {})
18
+ @cookies = OpenHash.new
19
+ @api_hits = 0
20
+ @page_writes = 0
21
+
22
+ api = options[:api] || "http://en.wikipedia.org/w/api.php"
23
+ auto_login = options[:auto_login] || false
24
+ @readonly = options[:readonly] || false
25
+ @debug = options[:debug] || false
26
+
27
+ @config = {
28
+ :username => username,
29
+ :password => password,
30
+ :api => api,
31
+ :logged_in => false
32
+ }.to_openhash
33
+
34
+ # Set up cURL:
35
+ @curl = Curl::Easy.new do |c|
36
+ c.headers["User-Agent"] = self.user_agent
37
+ c.headers["Accept-Encoding"] = "gzip" # Request gzip-encoded content from MediaWiki
38
+ end
39
+
40
+ login if auto_login
41
+ end
42
+
43
+ def version
44
+ # Specifies the client bot's version
45
+ raise NotImplementedError
46
+ end
47
+
48
+ def user_agent
49
+ "#{@config.username}/#{self.version} WikiBot/#{WikiBot::VERSION} (https://github.com/dvandersluis/wikibot)"
50
+ end
51
+
52
+ def query_api(method, raw_data = {})
53
+ # Send a query to the API and handle the response
54
+ url = @config.api
55
+ raw_data = raw_data.to_openhash
56
+
57
+ raw_data[:format] = :xml if raw_data.format.nil?
58
+
59
+ # Setup cookie headers for the request
60
+ @curl.headers["Cookie"] = @cookies.inject([]) do |memo, pair|
61
+ key, val = pair
62
+ memo.push(CGI::escape(key) + "=" + CGI::escape(val))
63
+ end.join("; ") unless @cookies.nil?
64
+
65
+ response_xml = {}
66
+
67
+ while true
68
+ if method == :post
69
+ data = raw_data.to_post_fields
70
+ elsif method == :get
71
+ url = url.chomp("?") + "?" + raw_data.to_querystring
72
+ data = nil
73
+ end
74
+
75
+ @curl.url = url
76
+ @curl.headers["Expect"] = nil # MediaWiki will give a 417 error if Expect is set
77
+
78
+ @curl.on_debug { |type, data| p data } if @debug
79
+
80
+ @gzip = false
81
+ @curl.on_header do |data|
82
+ header, text = data.split(":").map(&:strip)
83
+ if header == "Set-Cookie"
84
+ # If Set-Cookie headers are given in the response, set the cookies
85
+ parts = text.split(";")
86
+ cookie_name, cookie_value = parts[0].split("=")
87
+ @cookies[cookie_name] = cookie_value
88
+ elsif header == "Content-Encoding"
89
+ # If the respons is gzip encoded we'll have to decode it before use
90
+ @gzip = true if text == "gzip"
91
+ end
92
+ data.length
93
+ end
94
+
95
+ params = ["http_#{method}".to_sym]
96
+ params.push(*data) unless data.nil? or (data.is_a? Array and data.empty?)
97
+ @curl.send(*params)
98
+ @api_hits += 1
99
+
100
+ raise CurbError.new(@curl) unless @curl.response_code == 200
101
+
102
+ body = @gzip ? Zlib::GzipReader.new(StringIO.new(@curl.body_str)).read : @curl.body_str
103
+
104
+ xml = XmlSimple.xml_in(body, {'ForceArray' => false})
105
+ raise APIError.new(xml['error']['code'], xml['error']['info']) if xml['error']
106
+
107
+ response_xml.deep_merge! xml
108
+ break unless xml['query-continue']
109
+ raw_data.merge! xml['query-continue'][xml['query-continue'].keys.first]
110
+ end
111
+
112
+ response_xml.to_openhash
113
+ end
114
+
115
+ def logged_in?
116
+ @config.logged_in
117
+ end
118
+
119
+ def login
120
+ return if logged_in?
121
+
122
+ data = {
123
+ :action => :login,
124
+ :lgname => @config.username,
125
+ :lgpassword => @config.password
126
+ }
127
+
128
+ response = query_api(:post, data).login
129
+
130
+ if response.result == "NeedToken"
131
+ data = {
132
+ :action => :login,
133
+ :lgname => @config.username,
134
+ :lgpassword => @config.password,
135
+ :lgtoken => response.token
136
+ }
137
+
138
+ response = query_api(:post, data).login
139
+ end
140
+
141
+ raise LoginError, response.result unless response.result == "Success"
142
+
143
+ @config.cookieprefix = response.cookieprefix
144
+ @config.logged_in = true
145
+ end
146
+
147
+ def logout
148
+ return unless logged_in?
149
+
150
+ query_api(:post, { :action => :logout })
151
+ @config.logged_in = false
152
+ @config.edit_token = nil
153
+ end
154
+
155
+ def edit_token(page = "Main Page")
156
+ return nil unless logged_in?
157
+ @config.edit_token ||= begin
158
+ data = {
159
+ :action => :query,
160
+ :prop => :info,
161
+ :intoken => :edit,
162
+ :titles => page
163
+ }
164
+
165
+ query_api(:get, data).query.pages.page.edittoken
166
+ end
167
+ end
168
+
169
+ # Get wiki stats
170
+ def stats
171
+ data = {
172
+ :action => :query,
173
+ :meta => :siteinfo,
174
+ :siprop => :statistics
175
+ }
176
+
177
+ query_api(:get, data).query.statistics
178
+ end
179
+
180
+ def page(name)
181
+ WikiBot::Page.new(self, name)
182
+ end
183
+
184
+ def category(name)
185
+ WikiBot::Category.new(self, name)
186
+ end
187
+
188
+ def format_date(date)
189
+ # Formats a date into the Wikipedia format
190
+ time = date.strftime("%H:%M")
191
+ month = date.strftime("%B")
192
+ "#{time}, #{date.day} #{month} #{date.year} (UTC)"
193
+ end
194
+ end
195
+ end
File without changes
@@ -88,8 +88,30 @@ module WikiBot
88
88
 
89
89
  ###
90
90
  # Write to page
91
+ def writable?
92
+ return false if @wiki_bot.debug or @wiki_bot.readonly
93
+
94
+ # Deny all bots
95
+ return false if content.include?("{{nobots}}") or content.include?("{{bots|deny=all}}") or content.include?("{{bots|allow=none}}")
96
+
97
+ # Allow all bots
98
+ return true if content.include?("{{bots}}") or content.include?("{{bots|allow=all}}") or content.include?("{{bots|deny=none}}")
99
+
100
+ # Username specific white/blacklist
101
+ if content =~ /\{\{bots\|(allow|deny)=([^\}]+)\}\}/
102
+ allow = Regexp.last_match(1)
103
+ usernames = Regexp.last_match(2).split(",")
104
+
105
+ return (allow == "allow") if usernames.include?(@wiki_bot.config.username)
106
+ return allow != "allow"
107
+ end
108
+
109
+ return true
110
+ end
111
+
91
112
  def write(text, summary, section = nil, minor = false)
92
- return if @wiki_bot.debug or @wiki_bot.readonly
113
+ return false unless @wiki_bot.logged_in?
114
+ return false unless writable?
93
115
 
94
116
  data = {
95
117
  :action => :edit,
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ module WikiBot
2
+ VERSION = "0.2.3.1"
3
+ end
data/wikibot.gemspec CHANGED
@@ -2,39 +2,39 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{wikibot}
5
- s.version = "0.2.1.1"
5
+ s.version = "0.2.3.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"]
9
- s.date = %q{2010-07-29}
9
+ s.date = %q{2012-02-07}
10
10
  s.description = %q{Mediawiki Bot framework}
11
11
  s.email = %q{daniel@codexed.com}
12
- s.extra_rdoc_files = ["README.textile", "lib/category.rb", "lib/class_ext.rb", "lib/hash_ext.rb", "lib/openhash.rb", "lib/page.rb", "lib/wikibot.rb"]
13
- s.files = ["README.textile", "Rakefile", "lib/category.rb", "lib/class_ext.rb", "lib/hash_ext.rb", "lib/openhash.rb", "lib/page.rb", "lib/wikibot.rb", "wikibot.gemspec", "Manifest"]
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
+ 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
14
  s.homepage = %q{http://github.com/dvandersluis/wiki_bot}
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}
18
- s.rubygems_version = %q{1.3.6}
18
+ s.rubygems_version = %q{1.3.7}
19
19
  s.summary = %q{Mediawiki Bot framework}
20
20
 
21
21
  if s.respond_to? :specification_version then
22
22
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
23
23
  s.specification_version = 3
24
24
 
25
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
26
- s.add_runtime_dependency(%q<taf2-curb>, [">= 0.5.4.0"])
25
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
+ s.add_runtime_dependency(%q<curb>, [">= 0.5.4.0"])
27
27
  s.add_runtime_dependency(%q<xml-simple>, [">= 1.0.12"])
28
28
  s.add_runtime_dependency(%q<deep_merge>, [">= 0.1.0"])
29
29
  s.add_runtime_dependency(%q<andand>, [">= 1.3.1"])
30
30
  else
31
- s.add_dependency(%q<taf2-curb>, [">= 0.5.4.0"])
31
+ s.add_dependency(%q<curb>, [">= 0.5.4.0"])
32
32
  s.add_dependency(%q<xml-simple>, [">= 1.0.12"])
33
33
  s.add_dependency(%q<deep_merge>, [">= 0.1.0"])
34
34
  s.add_dependency(%q<andand>, [">= 1.3.1"])
35
35
  end
36
36
  else
37
- s.add_dependency(%q<taf2-curb>, [">= 0.5.4.0"])
37
+ s.add_dependency(%q<curb>, [">= 0.5.4.0"])
38
38
  s.add_dependency(%q<xml-simple>, [">= 1.0.12"])
39
39
  s.add_dependency(%q<deep_merge>, [">= 0.1.0"])
40
40
  s.add_dependency(%q<andand>, [">= 1.3.1"])
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wikibot
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 81
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 2
9
+ - 3
8
10
  - 1
9
- - 1
10
- version: 0.2.1.1
11
+ version: 0.2.3.1
11
12
  platform: ruby
12
13
  authors:
13
14
  - Daniel Vandersluis
@@ -15,16 +16,18 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2010-07-29 00:00:00 -06:00
19
+ date: 2012-02-07 00:00:00 -07:00
19
20
  default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
22
- name: taf2-curb
23
+ name: curb
23
24
  prerelease: false
24
25
  requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
25
27
  requirements:
26
28
  - - ">="
27
29
  - !ruby/object:Gem::Version
30
+ hash: 119
28
31
  segments:
29
32
  - 0
30
33
  - 5
@@ -37,9 +40,11 @@ dependencies:
37
40
  name: xml-simple
38
41
  prerelease: false
39
42
  requirement: &id002 !ruby/object:Gem::Requirement
43
+ none: false
40
44
  requirements:
41
45
  - - ">="
42
46
  - !ruby/object:Gem::Version
47
+ hash: 15
43
48
  segments:
44
49
  - 1
45
50
  - 0
@@ -51,9 +56,11 @@ dependencies:
51
56
  name: deep_merge
52
57
  prerelease: false
53
58
  requirement: &id003 !ruby/object:Gem::Requirement
59
+ none: false
54
60
  requirements:
55
61
  - - ">="
56
62
  - !ruby/object:Gem::Version
63
+ hash: 27
57
64
  segments:
58
65
  - 0
59
66
  - 1
@@ -65,9 +72,11 @@ dependencies:
65
72
  name: andand
66
73
  prerelease: false
67
74
  requirement: &id004 !ruby/object:Gem::Requirement
75
+ none: false
68
76
  requirements:
69
77
  - - ">="
70
78
  - !ruby/object:Gem::Version
79
+ hash: 25
71
80
  segments:
72
81
  - 1
73
82
  - 3
@@ -83,21 +92,23 @@ extensions: []
83
92
 
84
93
  extra_rdoc_files:
85
94
  - README.textile
86
- - lib/category.rb
87
- - lib/class_ext.rb
88
- - lib/hash_ext.rb
89
- - lib/openhash.rb
90
- - lib/page.rb
91
95
  - lib/wikibot.rb
96
+ - lib/wikibot/core/bot.rb
97
+ - lib/wikibot/core/category.rb
98
+ - lib/wikibot/core/page.rb
99
+ - lib/wikibot/ext/hash.rb
100
+ - lib/wikibot/vendor/openhash.rb
101
+ - lib/wikibot/version.rb
92
102
  files:
93
103
  - README.textile
94
104
  - Rakefile
95
- - lib/category.rb
96
- - lib/class_ext.rb
97
- - lib/hash_ext.rb
98
- - lib/openhash.rb
99
- - lib/page.rb
100
105
  - lib/wikibot.rb
106
+ - lib/wikibot/core/bot.rb
107
+ - lib/wikibot/core/category.rb
108
+ - lib/wikibot/core/page.rb
109
+ - lib/wikibot/ext/hash.rb
110
+ - lib/wikibot/vendor/openhash.rb
111
+ - lib/wikibot/version.rb
101
112
  - wikibot.gemspec
102
113
  - Manifest
103
114
  has_rdoc: true
@@ -115,16 +126,20 @@ rdoc_options:
115
126
  require_paths:
116
127
  - lib
117
128
  required_ruby_version: !ruby/object:Gem::Requirement
129
+ none: false
118
130
  requirements:
119
131
  - - ">="
120
132
  - !ruby/object:Gem::Version
133
+ hash: 3
121
134
  segments:
122
135
  - 0
123
136
  version: "0"
124
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
+ none: false
125
139
  requirements:
126
140
  - - ">="
127
141
  - !ruby/object:Gem::Version
142
+ hash: 11
128
143
  segments:
129
144
  - 1
130
145
  - 2
@@ -132,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
147
  requirements: []
133
148
 
134
149
  rubyforge_project: wikibot
135
- rubygems_version: 1.3.6
150
+ rubygems_version: 1.3.7
136
151
  signing_key:
137
152
  specification_version: 3
138
153
  summary: Mediawiki Bot framework
data/lib/class_ext.rb DELETED
@@ -1,40 +0,0 @@
1
- # Borrowed from Rails
2
- class Class
3
- def cattr_reader(*syms)
4
- syms.flatten.each do |sym|
5
- next if sym.is_a?(Hash)
6
- class_eval(<<-EOS, __FILE__, __LINE__)
7
- unless defined? @@#{sym}
8
- @@#{sym} = nil
9
- end
10
-
11
- def self.#{sym}
12
- @@#{sym}
13
- end
14
-
15
- def #{sym}
16
- @@#{sym}
17
- end
18
- EOS
19
- end
20
- end
21
-
22
- def cattr_writer(*syms)
23
- syms.flatten.each do |sym|
24
- class_eval(<<-EOS, __FILE__, __LINE__)
25
- unless defined? @@#{sym}
26
- @@#{sym} = nil
27
- end
28
-
29
- def self.#{sym}=(obj)
30
- @@#{sym} = obj
31
- end
32
- EOS
33
- end
34
- end
35
-
36
- def cattr_accessor(*syms)
37
- cattr_reader(*syms)
38
- cattr_writer(*syms)
39
- end
40
- end