safe_exec should be less verbose when reporting problems, since the
output might end up on IRC, and it should return a non-zero error code
when failing, so that $? get set correctly.
Giuseppe Bilotta [Sat, 21 Mar 2009 23:47:36 +0000 (00:47 +0100)]
Separate gemspec from Rakefile
The benefit of this separation is that hosting services such as GitHub
will automatically build a gem every time the version in the spec is
changed. The underside of this separation is that hosting services such
as GitHub will automatically build a gem every time the version is
changed.
To allow the automatic gem generation to trigger on the release of
0.9.15, we demoted the version in the spec to 0.9.14. This gimmick is
needed because the gem spec doesn't allow non-numeric versions.
Since the gemspec is now standalone, it uses Dir instead of FileList,
which is equivalent for our use case. Moreover, the Rakefile only
defines the gem tasks if the spec is present.
Giuseppe Bilotta [Sun, 15 Mar 2009 10:04:24 +0000 (11:04 +0100)]
rss: configurable announce method
Since the RSS update announcements do not expect any form of reply,
they could be considered the typical IRC message that should use
NOTICE rather than PRIVMSG.
However, for backwards compatibility and since NOTICEs are not always
appreciated (and since their handling from clients is not always
optimal, either), we still allow rss announces to use the traditional
method, and that is in fact selected as default. Explicit rss show
request always go with PRIVMSG.
Giuseppe Bilotta [Fri, 13 Mar 2009 10:50:27 +0000 (11:50 +0100)]
rss: refactor rss types loading
Make use of the new custom filter loading procedure to move most of the
type definitions into its own file (data/rbot/filters/rss.rb) and only
define some essential ones in the plugin itself.
As an added benefit, user types can be loaded from filters/rss.rb and
rss/types.rb in the botclass directory.
reaction: fix trigger regex to work with non-alphanumeric start/end.
only match on word boundaries at an end of a trigger if the character at
that end of the trigger is a word character. In other words, the
trigger "test" should require word boundaries on each side, but the
trigger "@test" should only require one on the right side.
messagemapper: fix regexp creation for double-optional templates
When a mapping template had a double optional key such as
'something [[double] optional]'
the resuting regexp moved the spacing between the (converted)
double brackets, requiring extra spacing before the 'optional'
keyword.
Fix by moving spacing inside all consecutive brackets before converting
brackets into their regexp form.
lastfm: clean up sort order events search mappings
Put some requirements for the sort_order specification, to prevent
lastfm events at alan lomax
to map lomax as a sort order. Also make the 'in' and 'order' words
optional within the optional sord order block, rather than aside, to
prevent them from being ignored in venue names.
Try loading rubygems as soon as we're set up, since it can be needed for
gettext and a number of other things. This also allows us to get rid of
some stupid convoluted tricks in utils.
irc: monkeypatch Singleton to make _load and _dump public.
This is to fix a possible bug in newer versions of ruby where _load was
declared private in singletons. This would lead to errors where Marshal
could not restore the Singleton. This "bug" was introduced to ruby
in revisions 16659 and 17396.
markov: ensure messages are cleaned before learning and replying.
Lines that began with or ended with spaces were breaking the learning
thread. The call to clean_str was moved down into learn_line (and
random_markov) so that all messages, including those being learned from
files, get cleaned.
Giuseppe Bilotta [Fri, 27 Feb 2009 20:40:16 +0000 (21:40 +0100)]
rss plugin: upper limit for watched feeds
Config option to set the maximum number of items that will be announced
when a feed updates. 0 means all of them, anything else clips the list
to the latest ones, and also announces that some of the updates will not
be listed.
Giuseppe Bilotta [Tue, 24 Feb 2009 20:48:34 +0000 (21:48 +0100)]
lastfm: catch all errors when connecting
Since httputil.get_response() can raise exceptions, catch them into an
appropriate block. Turn a missing response body into a runtime error to
handle this error conditions consistently with other exceptions.
Giuseppe Bilotta [Sat, 21 Feb 2009 19:03:53 +0000 (20:03 +0100)]
markov: try harder when generating strings
generate_strings() is now able to work with a single word. Additionally,
when the given lookup is not found in the database, it will try
lookups that start, and failing that include, the given one.