guard-falcon 0.13.1 → 0.14.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: e138f9e0a7c2ec228f48a5ea9f0d1b4fd533786e79923b2fa45d979d89c677f3
4
- data.tar.gz: eb6414031e416a70b0a211bfd3abe3f0bd08f7df836d3e55e8f4be839deedd2b
3
+ metadata.gz: 2429f5321a048be77d11a9ceded01b6a5ecceae7541d33e9e87f2acd3aeee759
4
+ data.tar.gz: 12135bb50118469a193935832c95b48599f72b5051eebc6ff7152d26306a2030
5
5
  SHA512:
6
- metadata.gz: 0b9904d8b58e69085e9a144ac1292f8479696e419c27a575e80f83c38deea9feedcae66eb9fe101b06bbc06f5bda9d764ee90eaf3f2e48a333d914d3aa60b0c5
7
- data.tar.gz: cf7b0ac7af995a33c901c604e22cc81371df2da972537ba7c1b3fb2fd494ccc3ceb3eed47d0f70c21fcbc3523411ad98969c91833769de2b308fadf8bd28b062
6
+ metadata.gz: 82130f429075e607bbcb91d38c4d044bd9c43c3e2f325f102bf1c0d93a1beff4ebc693c65670e44d4b70b6ac3eabfca78bd9a967c5c9b18d19c180f42ee31536
7
+ data.tar.gz: e66a2343d9f846046c75d9a5cd84caa9f9c5211c66fcab08fd2a315ea1e410d003c36d88b7c9a55152e762b89ade012b04390ac2581a4fd0867cc1f4facb6ee3
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,89 +1,65 @@
1
- # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
20
2
 
21
- require 'guard/compat/plugin'
22
-
23
- require 'rack/builder'
3
+ # Released under the MIT License.
4
+ # Copyright, 2017-2024, by Samuel Williams.
5
+ # Copyright, 2018-2019, by Huba Nagy.
24
6
 
25
- require 'console/logger'
26
- require 'async/container'
7
+ require 'guard/compat/plugin'
27
8
 
28
- require 'falcon/server'
9
+ require 'falcon'
29
10
  require 'falcon/endpoint'
30
- require 'falcon/controller/serve'
11
+ require 'falcon/environment/rackup'
12
+ require 'falcon/environment/server'
13
+ require 'async/service'
14
+ require 'console'
31
15
 
32
16
  module Guard
33
17
  module Falcon
34
18
  class Plugin < Guard::Plugin
35
- DEFAULT_OPTIONS = {
36
- config: 'config.ru',
37
- count: 1,
38
- verbose: false,
39
- }
40
-
41
- def initialize(**options)
42
- super
19
+ module Environment
20
+ include ::Falcon::Environment::Server
21
+ include ::Falcon::Environment::Rackup
43
22
 
44
- @options = DEFAULT_OPTIONS.merge(options)
45
-
46
- @endpoint = nil
47
-
48
- @controller = ::Falcon::Controller::Serve.new(self)
49
- end
50
-
51
- def container_class
52
- Async::Container::Threaded
23
+ # The upstream endpoint that will handle incoming requests.
24
+ # @returns [Async::HTTP::Endpoint]
25
+ def endpoint
26
+ ::Falcon::Endpoint.parse(url).with(
27
+ reuse_address: true,
28
+ # reuse_port: true,
29
+ timeout: timeout,
30
+ )
31
+ end
53
32
  end
54
33
 
55
- def container_options
56
- {}
34
+ def self.default_environment(**options)
35
+ Async::Service::Environment.new(Environment).with(**options)
57
36
  end
58
37
 
59
- private def build_endpoint
60
- # Support existing use cases where only port: is specified.
61
- if @options[:endpoint]
62
- return @options[:endpoint]
38
+ def initialize(**options)
39
+ super
40
+
41
+ options[:root] ||= Dir.pwd
42
+ options[:name] ||= "falcon"
43
+
44
+ if paths = options[:paths]
45
+ @configuration = Async::Service::Configuration.load(paths)
63
46
  else
64
- url = @options.fetch(:url, "https://localhost")
65
- port = @options.fetch(:port, 9292)
47
+ @configuration = Async::Service::Configuration.new
48
+
49
+ # Compatibility
50
+ if rackup_path = options.delete(:config)
51
+ warn "The :config option is deprecated, please use :rackup_path instead.", uplevel: 1
52
+ options[:rackup_path] = rackup_path
53
+ end
66
54
 
67
- return ::Falcon::Endpoint.parse(url, port: port)
55
+ @configuration.add(self.class.default_environment(**options))
68
56
  end
69
- end
70
-
71
- def endpoint
72
- @endpoint ||= build_endpoint
73
- end
74
-
75
- def load_app
76
- rack_app, options = Rack::Builder.parse_file(@options[:config])
77
57
 
78
- return ::Falcon::Server.middleware(rack_app, verbose: @options[:verbose])
79
- end
80
-
81
- # As discussed in https://github.com/guard/guard/issues/713
82
- def logger
83
- Console.logger
58
+ @controller = ::Async::Service::Controller.new(@configuration.services.to_a)
84
59
  end
85
60
 
86
61
  def start
62
+ Console.info(self, "Starting...")
87
63
  @controller.start
88
64
  end
89
65
 
@@ -92,10 +68,12 @@ module Guard
92
68
  end
93
69
 
94
70
  def reload
71
+ Console.info(self, "Reloading...")
95
72
  @controller.restart
96
73
  end
97
74
 
98
75
  def stop
76
+ Console.info(self, "Stopping...")
99
77
  @controller.stop
100
78
  end
101
79
 
@@ -1,25 +1,10 @@
1
- # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2017-2024, by Samuel Williams.
20
5
 
21
6
  module Guard
22
7
  module Falcon
23
- VERSION = "0.13.1"
8
+ VERSION = "0.14.0"
24
9
  end
25
10
  end
data/lib/guard/falcon.rb CHANGED
@@ -1,22 +1,7 @@
1
- # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2017-2024, by Samuel Williams.
20
5
 
21
6
  require_relative 'falcon/plugin'
22
7
 
@@ -25,10 +10,5 @@ module Guard
25
10
  def self.new(*arguments, **options)
26
11
  Plugin.new(*arguments, **options)
27
12
  end
28
-
29
- # Workaround for https://github.com/guard/guard/pull/872
30
- def self.superclass
31
- nil
32
- end
33
13
  end
34
- end
14
+ end
data/license.md ADDED
@@ -0,0 +1,23 @@
1
+ # MIT License
2
+
3
+ Copyright, 2017-2024, by Samuel Williams.
4
+ Copyright, 2018-2019, by Huba Nagy.
5
+ Copyright, 2020, by Olle Jonsson.
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
data/readme.md ADDED
@@ -0,0 +1,44 @@
1
+ # Guard::Falcon
2
+
3
+ Efficiently runs a asynchronous Falcon server, restarting it as required by guard.
4
+
5
+ [![Development Status](https://github.com/socketry/guard-falcon/workflows/Test/badge.svg)](https://github.com/socketry/guard-falcon/actions?workflow=Test)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ``` ruby
12
+ gem 'guard-falcon'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ ## Usage
20
+
21
+ Falcon can restart very quickly and is ideal for use with guard. In your `Guardfile`:
22
+
23
+ ``` ruby
24
+ guard :falcon do
25
+ end
26
+ ```
27
+
28
+ ## Contributing
29
+
30
+ We welcome contributions to this project.
31
+
32
+ 1. Fork it.
33
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
34
+ 3. Commit your changes (`git commit -am 'Add some feature'`).
35
+ 4. Push to the branch (`git push origin my-new-feature`).
36
+ 5. Create new Pull Request.
37
+
38
+ ### Developer Certificate of Origin
39
+
40
+ This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
41
+
42
+ ### Contributor Covenant
43
+
44
+ This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-falcon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.1
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -39,22 +39,8 @@ cert_chain:
39
39
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
40
40
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
41
41
  -----END CERTIFICATE-----
42
- date: 2022-08-06 00:00:00.000000000 Z
42
+ date: 2024-06-26 00:00:00.000000000 Z
43
43
  dependencies:
44
- - !ruby/object:Gem::Dependency
45
- name: async-container
46
- requirement: !ruby/object:Gem::Requirement
47
- requirements:
48
- - - "~>"
49
- - !ruby/object:Gem::Version
50
- version: '0.16'
51
- type: :runtime
52
- prerelease: false
53
- version_requirements: !ruby/object:Gem::Requirement
54
- requirements:
55
- - - "~>"
56
- - !ruby/object:Gem::Version
57
- version: '0.16'
58
44
  - !ruby/object:Gem::Dependency
59
45
  name: console
60
46
  requirement: !ruby/object:Gem::Requirement
@@ -111,62 +97,6 @@ dependencies:
111
97
  - - "~>"
112
98
  - !ruby/object:Gem::Version
113
99
  version: '1.2'
114
- - !ruby/object:Gem::Dependency
115
- name: bake-bundler
116
- requirement: !ruby/object:Gem::Requirement
117
- requirements:
118
- - - ">="
119
- - !ruby/object:Gem::Version
120
- version: '0'
121
- type: :development
122
- prerelease: false
123
- version_requirements: !ruby/object:Gem::Requirement
124
- requirements:
125
- - - ">="
126
- - !ruby/object:Gem::Version
127
- version: '0'
128
- - !ruby/object:Gem::Dependency
129
- name: bundler
130
- requirement: !ruby/object:Gem::Requirement
131
- requirements:
132
- - - ">="
133
- - !ruby/object:Gem::Version
134
- version: '0'
135
- type: :development
136
- prerelease: false
137
- version_requirements: !ruby/object:Gem::Requirement
138
- requirements:
139
- - - ">="
140
- - !ruby/object:Gem::Version
141
- version: '0'
142
- - !ruby/object:Gem::Dependency
143
- name: covered
144
- requirement: !ruby/object:Gem::Requirement
145
- requirements:
146
- - - ">="
147
- - !ruby/object:Gem::Version
148
- version: '0'
149
- type: :development
150
- prerelease: false
151
- version_requirements: !ruby/object:Gem::Requirement
152
- requirements:
153
- - - ">="
154
- - !ruby/object:Gem::Version
155
- version: '0'
156
- - !ruby/object:Gem::Dependency
157
- name: rspec
158
- requirement: !ruby/object:Gem::Requirement
159
- requirements:
160
- - - "~>"
161
- - !ruby/object:Gem::Version
162
- version: '3.6'
163
- type: :development
164
- prerelease: false
165
- version_requirements: !ruby/object:Gem::Requirement
166
- requirements:
167
- - - "~>"
168
- - !ruby/object:Gem::Version
169
- version: '3.6'
170
100
  description:
171
101
  email:
172
102
  executables: []
@@ -177,10 +107,13 @@ files:
177
107
  - lib/guard/falcon/plugin.rb
178
108
  - lib/guard/falcon/templates/Guardfile
179
109
  - lib/guard/falcon/version.rb
110
+ - license.md
111
+ - readme.md
180
112
  homepage: https://github.com/socketry/guard-falcon
181
113
  licenses:
182
114
  - MIT
183
- metadata: {}
115
+ metadata:
116
+ source_code_uri: https://github.com/socketry/guard-falcon.git
184
117
  post_install_message:
185
118
  rdoc_options: []
186
119
  require_paths:
@@ -189,14 +122,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
189
122
  requirements:
190
123
  - - ">="
191
124
  - !ruby/object:Gem::Version
192
- version: '0'
125
+ version: '3.1'
193
126
  required_rubygems_version: !ruby/object:Gem::Requirement
194
127
  requirements:
195
128
  - - ">="
196
129
  - !ruby/object:Gem::Version
197
130
  version: '0'
198
131
  requirements: []
199
- rubygems_version: 3.3.7
132
+ rubygems_version: 3.5.11
200
133
  signing_key:
201
134
  specification_version: 4
202
135
  summary: A guard plugin to run an instance of the falcon web server.
metadata.gz.sig CHANGED
Binary file