guard-falcon 0.8.3 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb874c7cb766cde71a8ea0a859fd03851ea91cbe9298a639df48a4acd6de3e75
4
- data.tar.gz: 36c86cd4316f6140388ce37765606ffb985bcc6bbdbc84a7e019b7517ede808f
3
+ metadata.gz: 3676ac57e79592600ac1dfc7ea5120895404ec3fe6b8986e113771e095c41fff
4
+ data.tar.gz: e26192fef8832eb9e5f3bda26375aa15d8298c451b1839115549d676cca45c89
5
5
  SHA512:
6
- metadata.gz: f823d899f2feaab6f65a80994d996b4b8ad009c0cf1483fed0d933468e4a843a2a8a781c6196effe68ebd939fdbc77eee69424cd2266b49384bf6a84a9dc2ae2
7
- data.tar.gz: 998aa3aaf126c5c7009263ebc746d614e773c424bc917508bb0b3302c742672f850760f15817fbcb926c1892da9aa58d77c0150b958c88d9b4ac9d9f8b08e418
6
+ metadata.gz: c167fcfd0dd061063c15653e5e95babe108965671b02ce227d641919bc1cc1ba99c198c7400be9e5f13c981c5356fdce1d565e1b1290d5e76030364f0cf23e96
7
+ data.tar.gz: 1b428c99e81026da466f423fbf3467633e21371cb8e509be824ef175a73d77469d6de336c655006ff3569162df9209edac55d42e8e84897aaa99dd745c13bb0d
@@ -30,6 +30,7 @@ require 'async/http/url_endpoint'
30
30
  require 'async/io/shared_endpoint'
31
31
 
32
32
  require 'falcon/server'
33
+ require 'falcon/endpoint'
33
34
 
34
35
  module Guard
35
36
  module Falcon
@@ -53,30 +54,30 @@ module Guard
53
54
  Compat::UI
54
55
  end
55
56
 
56
- private def bind_endpoint
57
+ private def build_endpoint
57
58
  # Support existing use cases where only port: is specified.
58
59
  if @options[:endpoint]
59
- endpoint = @options[:endpoint]
60
- elsif port = @options[:port]
61
- host = @options[:host] || 'localhost'
62
- endpoint = Async::IO::Endpoint.tcp(host, port, reuse_port: true)
60
+ return @options[:endpoint]
63
61
  else
64
- endpoint = Async::HTTP::URLEndpoint.parse("http://localhost:9292", reuse_port: true)
62
+ url = @options.fetch(:url, "http://localhost")
63
+ port = @options.fetch(:port, 9292)
64
+
65
+ return ::Falcon::Endpoint.parse(url, port: port)
65
66
  end
66
-
67
- Async::Reactor.run do
68
- Async::IO::SharedEndpoint.bound(endpoint)
69
- end.result
70
67
  end
71
68
 
72
69
  def endpoint
73
- @endpoint ||= bind_endpoint
70
+ @endpoint ||= build_endpoint
74
71
  end
75
72
 
76
73
  def run_server
74
+ shared_endpoint = Async::Reactor.run do
75
+ Async::IO::SharedEndpoint.bound(endpoint)
76
+ end.result
77
+
77
78
  logger.info("Starting Falcon HTTP server on #{endpoint}.")
78
79
 
79
- Async::Container::Forked.new(concurrency: @options[:concurrency]) do
80
+ container = Async::Container::Forked.new(concurrency: @options[:concurrency]) do
80
81
  begin
81
82
  rack_app, options = Rack::Builder.parse_file(@options[:config])
82
83
  rescue
@@ -85,12 +86,16 @@ module Guard
85
86
  end
86
87
 
87
88
  app = ::Falcon::Server.middleware(rack_app, verbose: @options[:verbose])
88
- server = ::Falcon::Server.new(app, @endpoint)
89
+ server = ::Falcon::Server.new(app, shared_endpoint, endpoint.protocol)
89
90
 
90
91
  Process.setproctitle "Guard::Falcon HTTP Server: #{endpoint}"
91
92
 
92
93
  server.run
93
94
  end
95
+
96
+ shared_endpoint.close
97
+
98
+ return container
94
99
  end
95
100
 
96
101
  def start
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Guard
22
22
  module Falcon
23
- VERSION = "0.8.3"
23
+ VERSION = "0.8.4"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-falcon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-07 00:00:00.000000000 Z
11
+ date: 2018-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: falcon