Class: Padrino::Cli::Launcher
- Inherits:
-
Thor
- Object
- Thor
- Padrino::Cli::Launcher
- Includes:
- Thor::Actions
- Defined in:
- lib/padrino-core/cli/launcher.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #chdir(dir) ⇒ Object protected
- #prepare(task) ⇒ Object protected
- #start(*args) ⇒ Object
- #stop ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
101 102 103 |
# File 'lib/padrino-core/cli/launcher.rb', line 101 def self.exit_on_failure? true end |
Instance Method Details
#chdir(dir) ⇒ Object (protected)
90 91 92 93 94 95 96 97 98 99 |
# File 'lib/padrino-core/cli/launcher.rb', line 90 def chdir(dir) return unless dir begin Dir.chdir(dir.to_s) rescue Errno::ENOENT puts "=> Specified Padrino root '#{dir}' does not appear to exist!" rescue Errno::EACCES puts "=> Specified Padrino root '#{dir}' cannot be accessed by the current user!" end end |
#prepare(task) ⇒ Object (protected)
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/padrino-core/cli/launcher.rb', line 71 def prepare(task) if .help? help(task.to_s) exit end if .environment ENV['RACK_ENV'] = .environment.to_s else ENV['RACK_ENV'] ||= 'development' end chdir(.chdir) return if File.exist?('config/boot.rb') puts "=> Could not find boot file in: #{options.chdir}/config/boot.rb !!!" abort end |
#start(*args) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/padrino-core/cli/launcher.rb', line 25 def start(*args) prepare :start require File.('adapter', __dir__) require File.('config/boot.rb') if [:server_options] puts () else Padrino::Cli::Adapter.start(args.last ? .merge(config: args.last).freeze : ) end end |
#stop ⇒ Object
40 41 42 43 44 |
# File 'lib/padrino-core/cli/launcher.rb', line 40 def stop prepare :stop require File.('adapter', __dir__) Padrino::Cli::Adapter.stop() end |