module Boxlet
routes = {
- “/”, :get
-
> :index,¶ ↑
- “/auth”
-
> :auth,¶ ↑
- “/register_device”, :post
-
> :register_device,¶ ↑
- “/notifications”, :*
-
> :notifications,¶ ↑
- “/stats”, :post
-
> :stats,¶ ↑
- “/push_files”, :post
-
> :push_files,¶ ↑
- “/file_list”
-
> :file_list,¶ ↑
- “/file_info”
-
> :file_info,¶ ↑
- “/resync”, :get
-
> :resync,¶ ↑
- “/flashback”, :post
-
> :flashback,¶ ↑
- “/gallery”, :get
-
> :gallery,¶ ↑
- “/gallery/images”, :get
-
> :gallery_images,¶ ↑
- “/hello”, :get
-
> :hello,¶ ↑
}
Constants
- PUBLIC_COMMANDS
- VERSION
Attributes
config[RW]
raw_config[RW]
raw_params[RW]
runner[RW]
Public Instance Methods
debug?()
click to toggle source
# File lib/boxlet.rb, line 55 def debug? @config[:debug] == true end
log(level, message)
click to toggle source
# File lib/boxlet.rb, line 67 def log(level, message) @log.write(level, message) end
params()
click to toggle source
# File lib/boxlet.rb, line 63 def params @params end
run!(argv, command='run', config_file='config.yml', &blk)
click to toggle source
# File lib/boxlet.rb, line 22 def run!(argv, command='run', config_file='config.yml', &blk) populate_params!(argv, config_file) @log = Boxlet::Log.new(@config[:log_file], (debug? ? Logger::DEBUG : Logger::INFO)) @app = Boxlet::App.new command = command.to_s.to_sym case command when :run Boxlet.log(:debug, @config) @runner = Boxlet::Runner.new @runner.start(@app.bind, &blk) when :stop if @config[:daemonize] == true pid = File.read(@config[:pid_file]).to_i puts "Killing #{pid}..." Process.kill(Signal.list["TERM"], pid) end else if App::PUBLIC_COMMANDS.keys.include?(command) @app.send(command, argv) else print_menu end end @app end
stop!()
click to toggle source
# File lib/boxlet.rb, line 50 def stop! @runner.stop @app end