rackup 0.1.0 → 0.2.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: a8147a54f57ff6cc1143ffb8b1d56284e4a587ca63aeeb21e491d83348d9dfcd
4
- data.tar.gz: 438c92e88aee281963b9a796c716feab222e6a16d34533f89278c42f8be1c34f
3
+ metadata.gz: a2f461ce1898be20b5206f2e36164aed062a6ce123f283d84400ee8f70eff6af
4
+ data.tar.gz: d4f73f7cb37cc02ac841f5e7ceb15abcde390de3cb099872735249878fdcf1e2
5
5
  SHA512:
6
- metadata.gz: 918d8410462f54b58b63defeb39b95fae57ae7da05f19dfee0479718d0b4422909b13a00c1a9f3e19f7e5fb4328b4240db0f7bbbc89d77f0df5e2d8a8e8b94f4
7
- data.tar.gz: c821f8a16afb6946aea5dee3bb0a9b070f782df68dfd979772c612dab61d5c983b3fceb32567ce24fac5aff4627157dfea35fee643170bf4ac75d92497308b52
6
+ metadata.gz: 75a3501c7a1bcbe1faf527c280259bc582651c6bb205ad5f37328ad22555ae3d8f51f7ef66ca80ba8b6d72c8c62bcea26878a7f284dc6738efe005f40001c039
7
+ data.tar.gz: 887ad57cc40e6b4cc97b3476baed14276b37d07588018f874f807ea079d1c586decc5669760e18981e6d5d8497d05fc2d3cad28bdebb84dc4f7a4366b2b81d9e
data/LICENSE.md ADDED
@@ -0,0 +1,22 @@
1
+ Released under the MIT license.
2
+
3
+ Copyright, 2007-2021, by [Leah Neukirchen](https://leahneukirchen.org).
4
+ Copyright, 2022, by [Samuel G. D. Williams](https://www.codeotaku.com).
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ warn "Rack::Handler is deprecated and replaced by Rackup::Handler"
4
+ require_relative '../rackup/handler'
5
+ module Rack
6
+ Handler = ::Rackup::Handler
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ warn "Rack::Server is deprecated and replaced by Rackup::Server"
4
+ require_relative '../rackup/server'
5
+ module Rack
6
+ Server = ::Rackup::Server
7
+ end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rack/handler'
4
-
5
3
  module Rackup
6
4
  # *Handlers* connect web servers with Rack.
7
5
  #
@@ -11,9 +9,26 @@ module Rackup
11
9
  # A second optional hash can be passed to include server-specific
12
10
  # configuration.
13
11
  module Handler
12
+ @handlers = {}
13
+
14
+ # Register a named handler class.
15
+ def self.register(name, klass)
16
+ if klass.is_a?(String)
17
+ warn "Calling Rackup::Handler.register with a string is deprecated, use the class/module itself.", uplevel: 1
18
+
19
+ klass = self.const_get(klass, false)
20
+ end
21
+
22
+ name = name.to_sym
23
+
24
+ @handlers[name] = klass
25
+ end
26
+
14
27
  def self.[](name)
28
+ name = name.to_sym
29
+
15
30
  begin
16
- Rack::Handler[name] || self.const_get(name, false)
31
+ @handlers[name] || self.const_get(name, false)
17
32
  rescue NameError
18
33
  # Ignore.
19
34
  end
@@ -28,17 +43,15 @@ module Rackup
28
43
  return server
29
44
  end
30
45
 
31
- require_handler("rack/handler", name)
46
+ begin
47
+ require_handler("rackup/handler", name)
48
+ rescue LoadError
49
+ require_handler("rack/handler", name)
50
+ end
32
51
 
33
52
  return self[name]
34
53
  end
35
54
 
36
- def self.register(name, klass)
37
- name = name.to_sym
38
-
39
- Rack::Handler.register(name, klass)
40
- end
41
-
42
55
  RACK_HANDLER = 'RACK_HANDLER'
43
56
  RACKUP_HANDLER = 'RACKUP_HANDLER'
44
57
 
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module Rackup
24
- VERSION = "0.1.0"
24
+ VERSION = "0.2.2"
25
25
  end
data/lib/rackup.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'rackup/handler'
2
4
  require_relative 'rackup/server'
3
5
  require_relative 'rackup/version'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rackup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rack Contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-03 00:00:00.000000000 Z
11
+ date: 2022-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 3.0.0.beta1
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'
26
+ version: 3.0.0.beta1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: webrick
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -110,11 +110,15 @@ dependencies:
110
110
  version: '0'
111
111
  description:
112
112
  email:
113
- executables: []
113
+ executables:
114
+ - rackup
114
115
  extensions: []
115
116
  extra_rdoc_files: []
116
117
  files:
118
+ - LICENSE.md
117
119
  - bin/rackup
120
+ - lib/rack/handler.rb
121
+ - lib/rack/server.rb
118
122
  - lib/rackup.rb
119
123
  - lib/rackup/handler.rb
120
124
  - lib/rackup/handler/cgi.rb