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
59 60 61 |
# File 'lib/popper/cli.rb', line 59 def __print_version puts "Popper version:#{Popper::VERSION}" end |
#init ⇒ Object
50 51 52 53 54 55 |
# File 'lib/popper/cli.rb', line 50 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 36 37 38 |
# 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 {|account| MailAccount.new(account)} interval = case when Popper.configure.global.respond_to?(:interval) Popper.configure.global.interval else 60 end while true accounts.each(&:run) sleep(interval) end rescue => e Popper.log.fatal(e) Popper.log.fatal(e.backtrace) end |
#print ⇒ Object
42 43 44 45 46 47 |
# File 'lib/popper/cli.rb', line 42 def print Popper.load_config() Popper.configure.accounts.each do |account| print_config(account) end end |