guard-falcon 0.8.7 → 0.8.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -2
- data/lib/guard/falcon/controller.rb +25 -25
- data/lib/guard/falcon/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f4f2f8fc400f0ee136d5a0d10032d7c15d3d0a9411bf9bbbb6608d896ddb13f
|
4
|
+
data.tar.gz: d2b70f2e5fa43fdc538eb7ae7ae06c620cf09efadf3b364a72889180b2dba02a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e810a25892496a161911863ff656e4626b705da64a692753bfa7b2fb2a36e9d8820293504a0202a951682b24494fb3d3437598cb8a047309113472ed4a81f946
|
7
|
+
data.tar.gz: 3ad46d63e9922281d2930d1f02f47cc473bb1ad247672f095bd5d6208cfcf91d1f25237da03c9194783b90be0cbb9e009dd58c16f3100a7e4530f687f3b34766
|
data/Gemfile
CHANGED
@@ -37,7 +37,7 @@ module Guard
|
|
37
37
|
class Controller < Plugin
|
38
38
|
DEFAULT_OPTIONS = {
|
39
39
|
config: 'config.ru',
|
40
|
-
|
40
|
+
count: 1,
|
41
41
|
verbose: false,
|
42
42
|
}
|
43
43
|
|
@@ -46,12 +46,12 @@ module Guard
|
|
46
46
|
|
47
47
|
@options = DEFAULT_OPTIONS.merge(options)
|
48
48
|
@endpoint = nil
|
49
|
-
@
|
49
|
+
@thread = nil
|
50
50
|
end
|
51
51
|
|
52
52
|
# As discussed in https://github.com/guard/guard/issues/713
|
53
53
|
def logger
|
54
|
-
|
54
|
+
Async.logger
|
55
55
|
end
|
56
56
|
|
57
57
|
private def build_endpoint
|
@@ -71,39 +71,38 @@ module Guard
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def run_server
|
74
|
-
shared_endpoint
|
74
|
+
@shared_endpoint ||= Async::Reactor.run do
|
75
75
|
Async::IO::SharedEndpoint.bound(endpoint)
|
76
76
|
end.wait
|
77
77
|
|
78
78
|
logger.info("Starting Falcon HTTP server on #{endpoint}.")
|
79
79
|
|
80
|
-
|
81
|
-
|
82
|
-
rack_app, options = Rack::Builder.parse_file(@options[:config])
|
83
|
-
rescue
|
84
|
-
logger.error "Failed to load #{@options[:config]}: #{$!}"
|
85
|
-
logger.error $!.backtrace
|
86
|
-
end
|
87
|
-
|
88
|
-
app = ::Falcon::Server.middleware(rack_app, verbose: @options[:verbose])
|
89
|
-
server = ::Falcon::Server.new(app, shared_endpoint, endpoint.protocol, endpoint.scheme)
|
80
|
+
return Thread.new do
|
81
|
+
container = Async::Container::Forked.new
|
90
82
|
|
91
|
-
|
83
|
+
container.run(count: @options[:count], restart: true, name: "Guard::Falcon: #{endpoint}") do
|
84
|
+
begin
|
85
|
+
rack_app, options = Rack::Builder.parse_file(@options[:config])
|
86
|
+
rescue => error
|
87
|
+
logger.error(error) {"Failed to load #{@options[:config]}"}
|
88
|
+
end
|
89
|
+
|
90
|
+
app = ::Falcon::Server.middleware(rack_app, verbose: @options[:verbose])
|
91
|
+
server = ::Falcon::Server.new(app, @shared_endpoint, endpoint.protocol, endpoint.scheme)
|
92
|
+
|
93
|
+
server.run
|
94
|
+
end
|
92
95
|
|
93
|
-
|
96
|
+
container.wait
|
94
97
|
end
|
95
|
-
|
96
|
-
shared_endpoint.close
|
97
|
-
|
98
|
-
return container
|
99
98
|
end
|
100
99
|
|
101
100
|
def start
|
102
|
-
@
|
101
|
+
@thread = run_server
|
103
102
|
end
|
104
103
|
|
105
104
|
def running?
|
106
|
-
!@
|
105
|
+
!@thread.nil?
|
107
106
|
end
|
108
107
|
|
109
108
|
def reload
|
@@ -112,9 +111,10 @@ module Guard
|
|
112
111
|
end
|
113
112
|
|
114
113
|
def stop
|
115
|
-
if @
|
116
|
-
@
|
117
|
-
@
|
114
|
+
if @thread
|
115
|
+
@thread.kill
|
116
|
+
@thread.join
|
117
|
+
@thread = nil
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
data/lib/guard/falcon/version.rb
CHANGED
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.
|
4
|
+
version: 0.8.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: falcon
|
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
|
-
rubygems_version: 3.0.
|
134
|
+
rubygems_version: 3.0.2
|
135
135
|
signing_key:
|
136
136
|
specification_version: 4
|
137
137
|
summary: A guard plugin to run an instance of the falcon web server.
|