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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c88e11d5af7b1fee995bb3687917649c2f45825f493f9b5756589c79dadfe58e
4
- data.tar.gz: d65c7dd82e9c26d0fc0135499c746facf4fa30c0444188393ea765406abf793e
3
+ metadata.gz: 5f4f2f8fc400f0ee136d5a0d10032d7c15d3d0a9411bf9bbbb6608d896ddb13f
4
+ data.tar.gz: d2b70f2e5fa43fdc538eb7ae7ae06c620cf09efadf3b364a72889180b2dba02a
5
5
  SHA512:
6
- metadata.gz: 30e4e685a546d09f4086ab2c84c6960bf573989054b044b3f0047ebbe8a565652aa670b0f7fa1b22291e1eb3936b319a1dcb85dce39a7c7c1be1d5768e8b9f0c
7
- data.tar.gz: f08928eede9818c04c32afcf74d60b80b7c4867b31ca68d0927fbe82e892767d84d4c8f9d9937e9dc00ca5ae0fcea247c7dc03ff6b8bf2ec8a1cc6055dbcc4fe
6
+ metadata.gz: e810a25892496a161911863ff656e4626b705da64a692753bfa7b2fb2a36e9d8820293504a0202a951682b24494fb3d3437598cb8a047309113472ed4a81f946
7
+ data.tar.gz: 3ad46d63e9922281d2930d1f02f47cc473bb1ad247672f095bd5d6208cfcf91d1f25237da03c9194783b90be0cbb9e009dd58c16f3100a7e4530f687f3b34766
data/Gemfile CHANGED
@@ -4,6 +4,5 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :test do
7
- gem 'simplecov'
8
- gem 'coveralls', require: false
7
+ gem 'covered'
9
8
  end
@@ -37,7 +37,7 @@ module Guard
37
37
  class Controller < Plugin
38
38
  DEFAULT_OPTIONS = {
39
39
  config: 'config.ru',
40
- concurrency: 2,
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
- @container = nil
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
- Compat::UI
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 = Async::Reactor.run do
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
- container = Async::Container::Forked.new(concurrency: @options[:concurrency]) do
81
- begin
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
- Process.setproctitle "Guard::Falcon HTTP Server: #{endpoint}"
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
- server.run
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
- @container = run_server
101
+ @thread = run_server
103
102
  end
104
103
 
105
104
  def running?
106
- !@container.nil?
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 @container
116
- @container.stop
117
- @container = nil
114
+ if @thread
115
+ @thread.kill
116
+ @thread.join
117
+ @thread = nil
118
118
  end
119
119
  end
120
120
 
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Guard
22
22
  module Falcon
23
- VERSION = "0.8.7"
23
+ VERSION = "0.8.8"
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.7
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-01-20 00:00:00.000000000 Z
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.1
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.