gack 0.0.1 → 0.0.2

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: 332de1b51ed8daf7f6d759c03df4140612328e83b107aa51accc8a7f09097377
4
- data.tar.gz: b4b74b3ce6ae1ded331c7ecc0799b3e40e86a98b068c15dc967e208e1b97b30c
3
+ metadata.gz: acebea2c31845c1a12db7dc97364bef9c4cf9d9e8e6281cba1f20b0a089d4884
4
+ data.tar.gz: c738ab83620fab7e2bd44e7bb79bf5957e8672ecb71a12d171a8f1b7be8382b9
5
5
  SHA512:
6
- metadata.gz: dc0d59152ad07d7955109438e174e27bf408d6872d864aa46fff496a5d4c165505460a90110bf09d81411b604bd818357977d8483580d5fe8c170de8d19bfadf
7
- data.tar.gz: 177c947803a4584279d15135e961115f5f2d64cbfbebcf7dd2efa7ecdbf6c1f3d1cf200ee3dd5bc5748855db17ec7ec4532e4102cee24628ba658c93a0b81a60
6
+ metadata.gz: 477a842cd8fcbbfd11e40ea1b59863e259048cf294b819676af059104e19e50a0d1fdc7e9ab5670f6aec02cc1915e9712ee48e2f6ebecdbcf9e89e7c723ce6d9
7
+ data.tar.gz: '08136f42415eb3776ac82f8134a0feafed6e2bf242e890dbffa949b0510bf0ac28d74c068db71268aeea7ae71d77e50491f0dd3bba311fa38acc494110baeb11'
data/README.md CHANGED
@@ -32,7 +32,7 @@ Nginx will be used for the TLS handshake and termination:
32
32
  }
33
33
 
34
34
  server {
35
- # 195 is the default Gemini protocol port
35
+ # 1965 is the default Gemini protocol port
36
36
  listen 1965 ssl;
37
37
  proxy_pass backend;
38
38
 
@@ -5,5 +5,5 @@ require_relative 'gack/logger'
5
5
  require_relative 'gack/request'
6
6
  require_relative 'gack/response'
7
7
  require_relative 'gack/server'
8
- require_relative 'gack/sphere'
9
- require_relative 'gack/capsule'
8
+ require_relative 'gack/route'
9
+ require_relative 'gack/application'
@@ -2,23 +2,23 @@
2
2
 
3
3
  module Gack
4
4
  # The main DSL for making Gemini apps with Gack
5
- class Capsule
6
- def self.sphere(path, &handler)
7
- spheres << Gack::Sphere.new(path, &handler)
5
+ class Application
6
+ def self.route(path, &handler)
7
+ routes << Gack::Route.new(path, &handler)
8
8
  end
9
9
 
10
- def self.spheres
11
- @spheres ||= []
10
+ def self.routes
11
+ @routes ||= []
12
12
  end
13
13
 
14
14
  def self.run!
15
- new(spheres).run!
15
+ new(routes).run!
16
16
  end
17
17
 
18
- attr_reader :spheres
18
+ attr_reader :routes
19
19
 
20
- def initialize(spheres)
21
- @spheres = spheres
20
+ def initialize(routes)
21
+ @routes = routes
22
22
  end
23
23
 
24
24
  def run!
@@ -29,9 +29,9 @@ module Gack
29
29
  end
30
30
 
31
31
  def server_loop_handler(request)
32
- sphere = match_sphere(request.location)
33
- if sphere
34
- result = sphere.handle_request(request)
32
+ route = match_route(request.location)
33
+ if route
34
+ result = route.handle_request(request)
35
35
  if result.is_a?(Response)
36
36
  result
37
37
  else
@@ -42,8 +42,8 @@ module Gack
42
42
  end
43
43
  end
44
44
 
45
- def match_sphere(location)
46
- spheres.find { |s| s.path_match?(location) }
45
+ def match_route(location)
46
+ routes.find { |s| s.path_match?(location) }
47
47
  end
48
48
  end
49
49
  end
@@ -33,14 +33,14 @@ module Gack
33
33
 
34
34
  return "/#{split_request.last}" if split_request.size == 2
35
35
 
36
- "/#{split_request[1..-1].join('/')}"
36
+ "/#{split_request[1..].join('/')}"
37
37
  end
38
38
 
39
39
  def parse_input
40
40
  split_input = clean_request.split('?')
41
41
 
42
42
  if split_input.size > 2
43
- CGI.unescape(split_input[1..-1].join('?'))
43
+ CGI.unescape(split_input[1..].join('?'))
44
44
  else
45
45
  CGI.unescape(split_input.last)
46
46
  end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gack
4
- # Sphere is a Gemini request handler wrapper for a given path
5
- class Sphere
4
+ # Route is a Gemini request handler wrapper for a given path
5
+ class Route
6
6
  HandlerMissingError = Class.new(StandardError)
7
7
 
8
8
  attr_reader :path, :handler
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gack
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Peterson
@@ -89,13 +89,13 @@ files:
89
89
  - README.md
90
90
  - gack.gemspec
91
91
  - lib/gack.rb
92
- - lib/gack/capsule.rb
92
+ - lib/gack/application.rb
93
93
  - lib/gack/logger.rb
94
94
  - lib/gack/request.rb
95
95
  - lib/gack/response.rb
96
96
  - lib/gack/response/status_codes.rb
97
+ - lib/gack/route.rb
97
98
  - lib/gack/server.rb
98
- - lib/gack/sphere.rb
99
99
  - lib/gack/version.rb
100
100
  homepage: https://github.com/rawburt/gack
101
101
  licenses: