Class: Guard::Falcon::Plugin
- Inherits:
-
Plugin
- Object
- Plugin
- Guard::Falcon::Plugin
- Defined in:
- lib/guard/falcon/plugin.rb
Defined Under Namespace
Modules: Environment
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**options) ⇒ Plugin
constructor
A new instance of Plugin.
- #reload ⇒ Object
- #run_on_change(paths) ⇒ Object
- #running? ⇒ Boolean
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(**options) ⇒ Plugin
Returns a new instance of Plugin.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/guard/falcon/plugin.rb', line 38 def initialize(**) super [:root] ||= Dir.pwd [:name] ||= "falcon" if paths = [:paths] @configuration = Async::Service::Configuration.load(paths) else @configuration = Async::Service::Configuration.new # Compatibility if rackup_path = .delete(:config) warn "The :config option is deprecated, please use :rackup_path instead.", uplevel: 1 [:rackup_path] = rackup_path end @configuration.add(self.class.default_environment(**)) end @controller = ::Async::Service::Controller.new(@configuration.services.to_a) end |
Class Method Details
.default_environment(**options) ⇒ Object
34 35 36 |
# File 'lib/guard/falcon/plugin.rb', line 34 def self.default_environment(**) Async::Service::Environment.new(Environment).with(**) end |
Instance Method Details
#reload ⇒ Object
70 71 72 73 |
# File 'lib/guard/falcon/plugin.rb', line 70 def reload Console.info(self, "Reloading...") @controller.restart end |
#run_on_change(paths) ⇒ Object
80 81 82 |
# File 'lib/guard/falcon/plugin.rb', line 80 def run_on_change(paths) reload end |
#running? ⇒ Boolean
66 67 68 |
# File 'lib/guard/falcon/plugin.rb', line 66 def running? @controller.running? end |
#start ⇒ Object
61 62 63 64 |
# File 'lib/guard/falcon/plugin.rb', line 61 def start Console.info(self, "Starting...") @controller.start end |
#stop ⇒ Object
75 76 77 78 |
# File 'lib/guard/falcon/plugin.rb', line 75 def stop Console.info(self, "Stopping...") @controller.stop end |