guard-falcon 0.10.0 → 0.11.0

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: aa18154a04c687d5d1d2dac1e5d897ac177fcd07ed82c04dcda9c31a1f8560e1
4
- data.tar.gz: 1c6691acb31d9d562da4b48e4f368e17752bc019207bc634eaca68db4e7ba950
3
+ metadata.gz: 597497205f8bbc9c367dd26c1fdc6fab587df1397b2c06981ebc5f11ce061fab
4
+ data.tar.gz: 7cad97652d3d9a06a617367c7651bf62df5839e47b3eee7026b5841d02a27f47
5
5
  SHA512:
6
- metadata.gz: 904c9f12f8fa454c30c77f49910c77e307f31216bd15c5b95935b92e5c389f56e77c4b54a3601034b6b0a35def5370ba5921ce08705bcda86fb515bd5861bf65
7
- data.tar.gz: 66d7af623938189f87417b6c34a4c0b11f31fce272627c0ed9a05fb39336df5fc3ff9100fb58f915c4d5987023aef8c25d49b02a8ff4728f2d91cf803fb3824c
6
+ metadata.gz: cb9c6d4fc693e84c44632ee976bc21e45641a29c0ebe301693052433a2f5872b76dec94ec6b6de0f56c60e0878ec874fb3f8aa32b227115b5c83059e485afbd9
7
+ data.tar.gz: 7d406b13031d492e86a5a06d6de6496f58c7b47a06fde871c8be8e735c12f5f21639cef47fc7b026d765dab5c7d747091bcc7c39f9169123c27e3cb894030467
@@ -1,21 +1,24 @@
1
1
  language: ruby
2
- sudo: false
3
- dist: trusty
2
+ dist: xenial
4
3
  cache: bundler
5
4
 
6
- before_script:
7
- - gem update --system
8
- - gem install bundler
9
-
10
- rvm:
11
- - 2.4
12
- - 2.5
13
- - 2.6
14
- - jruby-head
15
- - ruby-head
16
- - rbx-3
17
5
  matrix:
6
+ include:
7
+ - rvm: 2.4
8
+ - rvm: 2.5
9
+ - rvm: 2.6
10
+ - rvm: 2.7
11
+ - rvm: 2.6
12
+ env: COVERAGE=Summary,Coveralls
13
+ - rvm: 2.7
14
+ - rvm: truffleruby
15
+ - rvm: jruby-head
16
+ env: JRUBY_OPTS="--debug -X+O"
17
+ - rvm: ruby-head
18
+ - rvm: 2.6
19
+ os: osx
18
20
  allow_failures:
21
+ - rvm: truffleruby
19
22
  - rvm: ruby-head
20
23
  - rvm: jruby-head
21
- - rvm: rbx-3
24
+ - rvm: truffleruby
@@ -16,7 +16,9 @@ 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.31")
19
+ spec.add_dependency("falcon", "~> 0.35")
20
+
21
+ spec.add_dependency("async-container", "~> 0.16.0")
20
22
 
21
23
  spec.add_dependency("guard")
22
24
  spec.add_dependency("guard-compat", "~> 1.2")
@@ -18,12 +18,12 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
- require_relative 'falcon/controller'
21
+ require_relative 'falcon/plugin'
22
22
 
23
23
  module Guard
24
24
  module Falcon
25
25
  def self.new(*args)
26
- Controller.new(*args)
26
+ Plugin.new(*args)
27
27
  end
28
28
 
29
29
  # Workaround for https://github.com/guard/guard/pull/872
@@ -21,37 +21,39 @@
21
21
  require 'guard/compat/plugin'
22
22
 
23
23
  require 'rack/builder'
24
- require 'rack/server'
25
24
 
26
25
  require 'async/logger'
27
26
  require 'async/container'
28
27
 
29
- require 'async/io/host_endpoint'
30
- require 'async/io/shared_endpoint'
31
-
32
28
  require 'falcon/server'
33
29
  require 'falcon/endpoint'
30
+ require 'falcon/controller/serve'
34
31
 
35
32
  module Guard
36
33
  module Falcon
37
- class Controller < Plugin
34
+ class Plugin < Guard::Plugin
38
35
  DEFAULT_OPTIONS = {
39
36
  config: 'config.ru',
40
37
  count: 1,
41
38
  verbose: false,
42
39
  }
43
-
40
+
44
41
  def initialize(**options)
45
42
  super
46
43
 
47
44
  @options = DEFAULT_OPTIONS.merge(options)
45
+
48
46
  @endpoint = nil
49
- @container = nil
47
+
48
+ @controller = ::Falcon::Controller::Serve.new(self)
50
49
  end
51
-
52
- # As discussed in https://github.com/guard/guard/issues/713
53
- def logger
54
- Async.logger
50
+
51
+ def container_class
52
+ Async::Container::Threaded
53
+ end
54
+
55
+ def container_options
56
+ {}
55
57
  end
56
58
 
57
59
  private def build_endpoint
@@ -70,49 +72,33 @@ module Guard
70
72
  @endpoint ||= build_endpoint
71
73
  end
72
74
 
73
- def run_server(container = Async::Container::Threaded.new)
74
- @bound_endpoint ||= Async::Reactor.run do
75
- Async::IO::SharedEndpoint.bound(endpoint)
76
- end.wait
77
-
78
- logger.info("Starting Falcon HTTP server on #{endpoint}.")
79
-
80
- container.run(count: @options[:count], restart: true, name: "Guard::Falcon: #{endpoint}") do
81
- begin
82
- rack_app, options = Rack::Builder.parse_file(@options[:config])
83
- rescue => error
84
- logger.error(error) {"Failed to load #{@options[:config]}"}
85
- end
86
-
87
- app = ::Falcon::Server.middleware(rack_app, verbose: @options[:verbose])
88
- server = ::Falcon::Server.new(app, @bound_endpoint, endpoint.protocol, endpoint.scheme)
89
-
90
- server.run
91
- end
75
+ def load_app
76
+ rack_app, options = Rack::Builder.parse_file(@options[:config])
92
77
 
93
- return container
78
+ return ::Falcon::Server.middleware(rack_app, verbose: @options[:verbose]), options
94
79
  end
95
-
80
+
81
+ # As discussed in https://github.com/guard/guard/issues/713
82
+ def logger
83
+ Async.logger
84
+ end
85
+
96
86
  def start
97
- @container = run_server
87
+ @controller.start
98
88
  end
99
-
89
+
100
90
  def running?
101
- !@container.nil?
91
+ @controller.running?
102
92
  end
103
-
93
+
104
94
  def reload
105
- stop
106
- start
95
+ @controller.restart
107
96
  end
108
-
97
+
109
98
  def stop
110
- if @container
111
- @container.stop(false)
112
- @container = nil
113
- end
99
+ @controller.stop
114
100
  end
115
-
101
+
116
102
  def run_on_change(paths)
117
103
  reload
118
104
  end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Guard
22
22
  module Falcon
23
- VERSION = "0.10.0"
23
+ VERSION = "0.11.0"
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.10.0
4
+ version: 0.11.0
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-07-05 00:00:00.000000000 Z
11
+ date: 2020-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: falcon
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.31'
19
+ version: '0.35'
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.31'
26
+ version: '0.35'
27
+ - !ruby/object:Gem::Dependency
28
+ name: async-container
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.16.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.16.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: guard
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -110,7 +124,7 @@ files:
110
124
  - Rakefile
111
125
  - guard-falcon.gemspec
112
126
  - lib/guard/falcon.rb
113
- - lib/guard/falcon/controller.rb
127
+ - lib/guard/falcon/plugin.rb
114
128
  - lib/guard/falcon/templates/Guardfile
115
129
  - lib/guard/falcon/version.rb
116
130
  homepage: https://github.com/socketry/guard-falcon
@@ -131,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
145
  - !ruby/object:Gem::Version
132
146
  version: '0'
133
147
  requirements: []
134
- rubygems_version: 3.0.3
148
+ rubygems_version: 3.0.6
135
149
  signing_key:
136
150
  specification_version: 4
137
151
  summary: A guard plugin to run an instance of the falcon web server.