guard-falcon 0.8.1 → 0.8.2

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: cc106f7f62266b53e684a6f9ee45cdf381f01d3a05cfd6d0c6ec86edea119165
4
- data.tar.gz: f4b35e3e902962375aaf28595a71d82330805cd67c3f32a74aca9874ae8b93a4
3
+ metadata.gz: 7685a5e5552489ae5ab115648fb653dc2b24fbebb5f5cb09a9b693bd2e92f2af
4
+ data.tar.gz: d82ac65a1fbff7a313b6e4d5cd0cfae411c011fcb1e47cc6eef5ecd543f0fd73
5
5
  SHA512:
6
- metadata.gz: 7820f43182ae38f3ffd4e67a983a1d136a157b039e78a1f78cfb31af3de7c49c1b834f023ec99290dfe6d727718b2761dcfe3a416eb48a6146bf1c8c42e4e925
7
- data.tar.gz: fa220c38aa29747cbc6eb15b0d7383938a9802ec9f770ba0d5db739f8c1a4d451c1ee8d81b723932e6d8d42bf0f73a38f4d945449c732bd89a8ffbbb1eb587e9
6
+ metadata.gz: cbd56a403c2042b478338c45ef594fffa42d0e1932650f7096c4f93674a0fb30b01dac2635ec3133c5a7bf3c984d8c5e45f92910205c15395d1d3694b1aab8a5
7
+ data.tar.gz: c5296b93d397169bd5509097f7ce1474e321a3dc5ee94b9540d0c94295b0b8ae91b5b89bc8eba072b24b1965eff6c495fed8738b6b035be702a6a20435b2bf78
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
17
  spec.require_paths = ["lib"]
18
18
 
19
- spec.add_dependency("falcon", "~> 0.16.0")
19
+ spec.add_dependency("falcon", "~> 0.17.0")
20
20
 
21
21
  spec.add_dependency("guard")
22
22
  spec.add_dependency("guard-compat", "~> 1.2")
@@ -27,9 +27,9 @@ require 'async/container/forked'
27
27
 
28
28
  require 'async/io/host_endpoint'
29
29
  require 'async/http/url_endpoint'
30
+ require 'async/io/shared_endpoint'
30
31
 
31
32
  require 'falcon/server'
32
- require 'falcon/adapters/rack'
33
33
 
34
34
  module Guard
35
35
  module Falcon
@@ -37,12 +37,14 @@ module Guard
37
37
  DEFAULT_OPTIONS = {
38
38
  config: 'config.ru',
39
39
  concurrency: 2,
40
+ verbose: false,
40
41
  }
41
42
 
42
43
  def initialize(**options)
43
44
  super
44
45
 
45
46
  @options = DEFAULT_OPTIONS.merge(options)
47
+ @endpoint = nil
46
48
  @container = nil
47
49
  end
48
50
 
@@ -50,15 +52,8 @@ module Guard
50
52
  def logger
51
53
  Compat::UI
52
54
  end
53
-
54
- def run_server
55
- begin
56
- app, options = Rack::Builder.parse_file(@options[:config])
57
- rescue
58
- logger.error "Failed to load #{@options[:config]}: #{$!}"
59
- logger.error $!.backtrace
60
- end
61
-
55
+
56
+ private def bind_endpoint
62
57
  # Support existing use cases where only port: is specified.
63
58
  if @options[:endpoint]
64
59
  endpoint = @options[:endpoint]
@@ -69,10 +64,28 @@ module Guard
69
64
  endpoint = Async::HTTP::URLEndpoint.parse("http://localhost:9292", reuse_port: true)
70
65
  end
71
66
 
67
+ Async::Reactor.run do
68
+ Async::IO::SharedEndpoint.bound(endpoint)
69
+ end.result
70
+ end
71
+
72
+ def endpoint
73
+ @endpoint ||= bind_endpoint
74
+ end
75
+
76
+ def run_server
72
77
  logger.info("Starting Falcon HTTP server on #{endpoint}.")
73
78
 
74
79
  Async::Container::Forked.new(concurrency: @options[:concurrency]) do
75
- server = ::Falcon::Server.new(::Falcon::Adapters::Rack.new(app), endpoint)
80
+ begin
81
+ rack_app, options = Rack::Builder.parse_file(@options[:config])
82
+ rescue
83
+ logger.error "Failed to load #{@options[:config]}: #{$!}"
84
+ logger.error $!.backtrace
85
+ end
86
+
87
+ app = ::Falcon::Server.middleware(rack_app, verbose: @options[:verbose])
88
+ server = ::Falcon::Server.new(app, @endpoint)
76
89
 
77
90
  Process.setproctitle "Guard::Falcon HTTP Server: #{endpoint}"
78
91
 
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Guard
22
22
  module Falcon
23
- VERSION = "0.8.1"
23
+ VERSION = "0.8.2"
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.1
4
+ version: 0.8.2
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-06-27 00:00:00.000000000 Z
11
+ date: 2018-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: falcon
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.16.0
19
+ version: 0.17.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.16.0
26
+ version: 0.17.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: guard
29
29
  requirement: !ruby/object:Gem::Requirement