Sha256: a0e0d1e6127bcd2007f1d005b6da34d1d9c6f2e5e42bd2c759a0b5158bc44307
Contents?: true
Size: 1.19 KB
Versions: 3
Compression:
Stored size: 1.19 KB
Contents
module Nginxtra module Action def initialize(thor, config) @thor = thor @config = config end # Run a daemon command to start or stop the nginx process. def daemon(action, additional_options = nil) action = "#{action} #{additional_options}" if additional_options run! "#{sudo}start-stop-daemon --#{action} --quiet --pidfile #{Nginxtra::Config.nginx_pidfile} --exec #{Nginxtra::Config.nginx_executable}" end private def run!(command) @thor.run command raise Nginxtra::Error::RunFailed, "The last run command failed" unless $?.success? # rubocop:disable Style/SpecialGlobalVars end def without_force Nginxtra::Action.ignore_force = true yield ensure Nginxtra::Action.ignore_force = false end def force? return false if Nginxtra::Action.ignore_force @thor.options["force"] end def interactive? !non_interactive? end def non_interactive? @thor.options["non-interactive"] end def sudo(force = false) "sudo " if (force || (@config && @config.require_root?)) && Process.uid != 0 end class << self attr_accessor :ignore_force end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nginxtra-1.10.1.13 | lib/nginxtra/action.rb |
nginxtra-1.10.1.12 | lib/nginxtra/action.rb |
nginxtra-1.8.1.12 | lib/nginxtra/action.rb |