Class: Lepus::CLI
- Inherits:
-
Thor
- Object
- Thor
- Lepus::CLI
- Defined in:
- lib/lepus/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
5 6 7 |
# File 'lib/lepus/cli.rb', line 5 def self.exit_on_failure? true end |
Instance Method Details
#start(*consumers) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/lepus/cli.rb', line 17 def start(*consumers) opts = (@options || {}).transform_keys(&:to_sym) if (list = consumers.flat_map { |c| c.split(",") }.map(&:strip).uniq.sort).any? opts[:consumers] = list end if (logfile = opts.delete(:logfile)) Lepus.logger = Logger.new(logfile) end if opts.delete(:debug) Lepus.logger.level = Logger::DEBUG end Lepus::Supervisor.start(**opts) end |
#web ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/lepus/cli.rb', line 37 def web port = ([:port] || 9292).to_i host = [:host] || "0.0.0.0" puts "Starting Lepus Web dashboard on http://#{host}:#{port}" puts "Press Ctrl+C to stop" if system("which rackup > /dev/null 2>&1") exec "rackup -p #{port} -o #{host} #{__dir__}/../../config.ru" else puts <<~MSG Rack is not installed. Please install it using the following command: gem install rack Then run the web dashboard again. MSG end end |