Class: Nginxtra::Actions::Stop
- Inherits:
-
Object
- Object
- Nginxtra::Actions::Stop
- Includes:
- Nginxtra::Action
- Defined in:
- lib/nginxtra/actions/stop.rb
Overview
The Nginxtra::Actions::Stop class encapsulates stopping nginx.
Instance Method Summary collapse
- #no_need_to_stop ⇒ Object
- #should_stop? ⇒ Boolean
-
#stop ⇒ Object
Stop nginx and note the new last stop time.
- #stop_nginx ⇒ Object
- #update_last_stop ⇒ Object
Methods included from Nginxtra::Action
Instance Method Details
#no_need_to_stop ⇒ Object
14 15 16 |
# File 'lib/nginxtra/actions/stop.rb', line 14 def no_need_to_stop @thor.say "nginx is already stopped" end |
#should_stop? ⇒ Boolean
18 19 20 21 |
# File 'lib/nginxtra/actions/stop.rb', line 18 def should_stop? return true if force? Nginxtra::Config.nginx_running? end |
#stop ⇒ Object
Stop nginx and note the new last stop time.
8 9 10 11 12 |
# File 'lib/nginxtra/actions/stop.rb', line 8 def stop return no_need_to_stop unless should_stop? stop_nginx update_last_stop end |
#stop_nginx ⇒ Object
23 24 25 |
# File 'lib/nginxtra/actions/stop.rb', line 23 def stop_nginx daemon :stop end |
#update_last_stop ⇒ Object
27 28 29 |
# File 'lib/nginxtra/actions/stop.rb', line 27 def update_last_stop Nginxtra::Status[:last_stop_time] = Time.now end |