Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

undefined local variable or method `groups' for #<LittleRedFlag::MailAgent::Mbsync::Config:0x000015add6cb68> (NameError) #6

Open
sassmann opened this issue Aug 23, 2017 · 5 comments

Comments

@sassmann
Copy link

After running

gem install little_red_flag
gem install pry

I'm seeing the following error:

sassmann@w541:~ > littleredflag
/home/sassmann/.gem/ruby/gems/little_red_flag-0.1.6/lib/little_red_flag/mail_agent/mbsync/config.rb:198:in `link_group_channels': undefined local variable or method `groups' for #<LittleRedFlag::MailAgent::Mbsync::Config:0x000015add6cb68> (NameError)
        from /home/sassmann/.gem/ruby/gems/little_red_flag-0.1.6/lib/little_red_flag/mail_agent/mbsync/config.rb:154:in `postprocess'
        from /home/sassmann/.gem/ruby/gems/little_red_flag-0.1.6/lib/little_red_flag/mail_agent/mbsync/config.rb:88:in `initialize'
        from /home/sassmann/.gem/ruby/gems/little_red_flag-0.1.6/lib/little_red_flag/mail_agent/mbsync.rb:10:in `new'
        from /home/sassmann/.gem/ruby/gems/little_red_flag-0.1.6/lib/little_red_flag/mail_agent/mbsync.rb:10:in `initialize'
        from /home/sassmann/.gem/ruby/gems/little_red_flag-0.1.6/lib/little_red_flag/mail_agent.rb:12:in `new'
        from /home/sassmann/.gem/ruby/gems/little_red_flag-0.1.6/lib/little_red_flag/mail_agent.rb:12:in `new'
        from /home/sassmann/.gem/ruby/gems/little_red_flag-0.1.6/bin/littleredflag:38:in `block in <top (required)>'
        from /home/sassmann/.gem/ruby/gems/little_red_flag-0.1.6/bin/littleredflag:38:in `map!'
        from /home/sassmann/.gem/ruby/gems/little_red_flag-0.1.6/bin/littleredflag:38:in `<top (required)>'
        from /home/sassmann/bin/littleredflag:22:in `load'
        from /home/sassmann/bin/littleredflag:22:in `<main>'

@rlue
Copy link
Owner

rlue commented Aug 23, 2017

Thanks for reporting. It's totally broken atm and needs a ground-up overhaul; at the very least, I've finally added a notice to the README. -_-'

@chilledfrogs
Copy link

Bit of a late comment, I know, but I stumbled upon this now and I'm getting relatively desperate to try and get this to work as I can't find any package that handles IDLE for me on my neomutt setup with mbsync... With me actually the error is similar but in a different place, and honestly despite the fact that I know a bit of Ruby I can't for the life of me figure out where is it supposed to be defined or anything of the sort, and the Ruby IMAP documentation is of zero help to me:

Traceback (most recent call last):
	13: from /home/allen/.gem/ruby/2.6.0/bin/littleredflag:23:in `<main>'
	12: from /home/allen/.gem/ruby/2.6.0/bin/littleredflag:23:in `load'
	11: from /home/allen/.gem/ruby/2.6.0/gems/little_red_flag-0.1.6/bin/littleredflag:38:in `<top (required)>'
	10: from /home/allen/.gem/ruby/2.6.0/gems/little_red_flag-0.1.6/bin/littleredflag:38:in `map!'
	 9: from /home/allen/.gem/ruby/2.6.0/gems/little_red_flag-0.1.6/bin/littleredflag:38:in `block in <top (required)>'
	 8: from /home/allen/.gem/ruby/2.6.0/gems/little_red_flag-0.1.6/lib/little_red_flag/mail_agent.rb:12:in `new'
	 7: from /home/allen/.gem/ruby/2.6.0/gems/little_red_flag-0.1.6/lib/little_red_flag/mail_agent.rb:12:in `new'
	 6: from /home/allen/.gem/ruby/2.6.0/gems/little_red_flag-0.1.6/lib/little_red_flag/mail_agent/mbsync.rb:10:in `initialize'
	 5: from /home/allen/.gem/ruby/2.6.0/gems/little_red_flag-0.1.6/lib/little_red_flag/mail_agent/mbsync.rb:10:in `new'
	 4: from /home/allen/.gem/ruby/2.6.0/gems/little_red_flag-0.1.6/lib/little_red_flag/mail_agent/mbsync/config.rb:88:in `initialize'
	 3: from /home/allen/.gem/ruby/2.6.0/gems/little_red_flag-0.1.6/lib/little_red_flag/mail_agent/mbsync/config.rb:153:in `postprocess'
	 2: from /home/allen/.gem/ruby/2.6.0/gems/little_red_flag-0.1.6/lib/little_red_flag/mail_agent/mbsync/config.rb:192:in `link_imapstore_accounts'
	 1: from /home/allen/.gem/ruby/2.6.0/gems/little_red_flag-0.1.6/lib/little_red_flag/mail_agent/mbsync/config.rb:192:in `each'
/home/allen/.gem/ruby/2.6.0/gems/little_red_flag-0.1.6/lib/little_red_flag/mail_agent/mbsync/config.rb:193:in `block in link_imapstore_accounts': undefined local variable or method `account' for #<LittleRedFlag::MailAgent::Mbsync::Config:0x000055c9eccd8e38> (NameError)

I know you said you're rebuilding it, but it's been 2 years or so so I'm mostly just wondering whether it's still active and if not, how to try and fix it myself...

@rlue
Copy link
Owner

rlue commented Apr 30, 2019

@chilledfrogs, thanks very much for your sustained interest in this package. It's been on indefinite hold for me, though it is a constant itch in the back of my head.

In the meantime, you may be interested in this thread from the isync (mbsync) mailing list:

I am using gnubiff -n --nogui on a headless machine to watch the IMAP server via IDLE and have it call mbsync to sync new mails as they arrive. I still need to look into systemd to have this run as a service to restarted automatically when it crashes.

@chilledfrogs
Copy link

@rlue, thanks a lot, I know the feeling, I will indeed look into it; this is really the only thing missing from a perfect neomutt setup on my machine 😅

@rlue
Copy link
Owner

rlue commented Jul 9, 2019

@chilledfrogs I'm getting ready to delete this repo, but before I do, I just wanted to let you know that I'm 99% of the way there to a solution with gnubiff. How does it work?

Gnubiff is intended to run as a GUI widget that's on all the time, and plays an alert sound when you get a new email. You manually configure gnubiff with your IMAP accounts, and it maintains an IDLE connection to them and performs an action whenever new mail comes in. It does not handle fetching mail.

You can customize the command that gnubiff runs when it sees new mail, so rather than playing an audio file, you can have it mbsync -a. As suggested in the isync mailing list I linked above, you can call gnubiff with the --nogui flag, and it will run in headless mode, with no GUI widget at all. Combine this with a systemd service, and you have background email fetching all the time. Here's how I have it set up:

  1. Configure gnubiff via its GUI:

    • under the “Mailboxes” section, add your IMAP accounts
    • under the “Commands” section, set “When new mail:” to mbsync -a
  2. Kill gnubiff.

  3. Create the following (user) systemd service:

    # ~/.local/share/systemd/user/gnubiff.service
    # (for other valid file locations, check `man systemd.unit`)
    
    [Unit]
    Description=Gnubiff Headless Email Fetcher
    After=network.target
    
    [Service]
    ExecStart=/usr/bin/gnubiff --noconfigure --nogui
    Restart=on-failure
    
    [Install]
    WantedBy=default.target
    
  4. Reload systemd units with

    systemctl --user daemon-reload
    
  5. Enable and start the service with

    systemctl --user enable gnubiff
    systemctl --user start gnubiff
    

Gnubiff will store its config file to ~/.gnubiffrc. If you’d prefer to store it under ~/.config, be sure to add the --config=/full/path/to/config option.


This works almost perfectly. For some reason, even though the systemd service launches at startup, gnubiff never actually gets around to calling mbsync -a (ever). To fix, it, I have to call systemctl --user restart gnubiff, just once, any time after startup/login. Then, it works flawlessly until the next time I restart.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants