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
- .exit_on_failure? ⇒ Boolean protected
Instance Method Summary collapse
- #chdir(dir) ⇒ Object protected
- #prepare(task) ⇒ Object protected
- #start(*args) ⇒ Object
- #stop ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean (protected)
98 99 100 |
# File 'lib/padrino-core/cli/launcher.rb', line 98 def self.exit_on_failure? true end |
Instance Method Details
#chdir(dir) ⇒ Object (protected)
87 88 89 90 91 92 93 94 95 96 |
# File 'lib/padrino-core/cli/launcher.rb', line 87 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)
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/padrino-core/cli/launcher.rb', line 70 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) unless File.exist?('config/boot.rb') puts "=> Could not find boot file in: #{.chdir}/config/boot.rb !!!" abort end end |
#start(*args) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/padrino-core/cli/launcher.rb', line 22 def start(*args) prepare :start require File.("../adapter", __FILE__) require File.('config/boot.rb') if [:server_options] puts () else Padrino::Cli::Adapter.start(args.last ? .merge(:config => args.last).freeze : ) end end |