rwikibot 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/lib/rwikibot.rb +10 -15
- metadata +2 -2
data/CHANGELOG
CHANGED
data/lib/rwikibot.rb
CHANGED
@@ -26,24 +26,25 @@ class RWikiBot
|
|
26
26
|
# New bots hope for three attributes, but require none. The first is simply the name of the bot for logging purposes. The second is the debug level constant, and third is the logfile.
|
27
27
|
#
|
28
28
|
# Example: bot = RWikiBot.new("My Neat Bot", Logger::DEBUG, "./rwikibot.log")
|
29
|
-
def initialize (name = "
|
30
|
-
|
29
|
+
def initialize ( name = "TestBot", username = 'RWikiBot', password = 'rwikibot', domain = 'en', api_path = 'http://localhost:8888/wiki/api.php', wikicookieprefix = 'wikidb_wiki')
|
30
|
+
|
31
31
|
@botname = name
|
32
|
+
@config = Hash.new
|
32
33
|
|
33
34
|
#We log. Log4r in the house.
|
34
35
|
@wikibotlogger = Logger.new('rwikibot.log')
|
35
|
-
# @wikibotlogger.outputters = FileOutputter.new('f1', :filename => log_location, :trunc => false)
|
36
36
|
|
37
37
|
#INFO level is nice. I like it as production default because I like log files. Feel free to change. It will change once config loaded
|
38
|
-
@wikibotlogger.level =
|
38
|
+
@wikibotlogger.level = Logger::INFO
|
39
39
|
@wikibotlogger.info "New RWikiBot created. My name is #{@botname}"
|
40
40
|
|
41
|
-
#
|
42
|
-
@
|
43
|
-
|
41
|
+
# This had to come back since I was having config loading issues when being called from MediaWiki
|
42
|
+
@config['username'] = username
|
43
|
+
@config['password'] = password
|
44
|
+
@config['domain'] = domain
|
45
|
+
@config['api_path'] = api_path
|
46
|
+
@config['wikicookieprefix'] = wikicookieprefix
|
44
47
|
|
45
|
-
#now, the hash that will hold the config options
|
46
|
-
@config = config_file.fetch(config)
|
47
48
|
@config['logged_in'] = FALSE
|
48
49
|
@config['uri'] = URI.parse(@config.fetch('api_path'))
|
49
50
|
|
@@ -539,12 +540,6 @@ class RWikiBot
|
|
539
540
|
@wikibotlogger.debug "PAGE EXISTS? - Preparing request information..."
|
540
541
|
post_me = {'titles' => title}
|
541
542
|
|
542
|
-
if @config.fetch('logged_in')
|
543
|
-
post_me['lgusername'] = @config.fetch('lgusername')
|
544
|
-
post_me['lguserid'] = @config.fetch('lguserid')
|
545
|
-
post_me['lgtoken'] = @config.fetch('lgtoken')
|
546
|
-
end
|
547
|
-
|
548
543
|
#Make the request
|
549
544
|
@wikibotlogger.debug "PAGE EXISTS? - Asking make_request to verify page existence..."
|
550
545
|
page_exists_result = make_request('query', post_me)
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rwikibot
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2007-03-
|
6
|
+
version: 1.0.8
|
7
|
+
date: 2007-03-13 00:00:00 -05:00
|
8
8
|
summary: A library for creating MediaWiki bots.
|
9
9
|
require_paths:
|
10
10
|
- lib
|