Class: Popper::CLI
- Inherits:
-
Thor
- Object
- Thor
- Popper::CLI
- Defined in:
- lib/popper/cli.rb
Instance Method Summary collapse
Instance Method Details
#__print_version ⇒ Object
56 57 58 |
# File 'lib/popper/cli.rb', line 56 def __print_version puts "Popper version:#{Popper::VERSION}" end |
#init ⇒ Object
47 48 49 50 51 52 |
# File 'lib/popper/cli.rb', line 47 def init Popper::Init.run() rescue => e puts e puts e.backtrace end |
#pop ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/popper/cli.rb', line 12 def pop if([:daemon]) Popper.init_logger() Process.daemon open([:pidfile] || "/var/run/popper.pid" , 'w') {|f| f << Process.pid} else Popper.init_logger(, true) end Popper.load_config() accounts = Popper.configure.accounts.map do |account| MailAccount.new(account) end.compact while true accounts.each(&:run) sleep(Popper.configure.interval) end rescue => e Popper.log.fatal(e) Popper.log.fatal(e.backtrace) end |
#print ⇒ Object
39 40 41 42 43 44 |
# File 'lib/popper/cli.rb', line 39 def print Popper.load_config() Popper.configure.accounts.each do |account| print_config(account) end end |