Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: Andrew Farrell <afarrell@MIT.EDU>
To: sup-talk@rubyforge.org
Subject: [sup-talk] before-poll.rb does not appear to be run. Where is PollManager defined?
Date: Tue, 31 May 2011 20:54:37 -0700	[thread overview]
Message-ID: <BANLkTikaFJ1B3DrsDyERJvmhU5QH-fwk1Q@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1007 bytes --]

Hello all,

I've just installed sup 0.8.1 from macports on OSX 10.6 with ruby version
1.8.7
It opens my maildir fine and I am pleased with its ability to organize mail
quickly.
I'm trying to add a before-poll.rb hook, but this appears not to be run.
At least, it is not running offlineIMAP and if I insert a divide-by-zero,
nothing explodes.
(If you care, I've attached that file.)
So, I went source-diving
into /opt/local/lib/ruby/gems/1.8/gems/sup-0.8.1/bin/sup,
but failed to find where PollManager or its method .poll is defined.
I strongly suspect it is in the gem referenced by "require 'sup' "
However, the only files so named that are in my PATH are this file itself
and a wrapper script that invokes it.
Do you know where else I might look for the definition of PollManager or
where I might look to find where it is requiring sup from?

context:
- I've never written a line of ruby.
- I'm inferring that "require 'sup' " is the equivalent of python's "from
sup import *"

thank you,
Andrew Farrell

[-- Attachment #1.2: Type: text/html, Size: 1305 bytes --]

[-- Attachment #2: before-poll.rb --]
[-- Type: application/octet-stream, Size: 759 bytes --]

# from http://sup.rubyforge.org/wiki/wiki.pl?TriggeringMailCollection
def offlineimap(*folders)
    cmd = "offlineimap -q -u Noninteractive.Basic"
    cmd << " -f #{folders * ','}" unless folders.compact.empty?
    `#{cmd} 2>&1`
end

def folder_names(sources)
    sources.map { |s| s.uri.split('/').last }
end

def inbox_sources(sources = SourceManager.sources)
    sources.find_all { |s| !s.archived? }.sort_by {|s| s.id }
end

if (@last_fetch || Time.at(0)) < Time.now - 120
    say "Running offlineimap..."
    # only check non-auto-archived sources on the first run
    log offlineimap(@last_fetch ? nil : folder_names(inbox_sources))
    File.open("~/touched", 'w') {|f| f.write("hello") } 
    say "Finished offlineimap run."
end
@last_fetch = Time.now

[-- Attachment #3: Type: text/plain, Size: 140 bytes --]

_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk

             reply	other threads:[~2011-06-01  4:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-01  3:54 Andrew Farrell [this message]
2011-06-01 11:52 ` Ruthard Baudach
2011-06-01 19:18   ` Andrew Farrell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTikaFJ1B3DrsDyERJvmhU5QH-fwk1Q@mail.gmail.com \
    --to=afarrell@mit.edu \
    --cc=sup-talk@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox