kirei 0.8.0 → 0.8.1

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: f72e562a33b62988fd08b474ad821c50c35e7439a2fe6eb0e5909b7310099ddc
4
- data.tar.gz: c1550bab74543280e4314b1847c8cc2ac80c575e2175efdb2c57bddeb0cd7f95
3
+ metadata.gz: 2bde9dc5680f9744ab2eb1d0fce8fce8019f2177ee263d1b8d6d82bb9c6fff73
4
+ data.tar.gz: 48732a443adf3d134fcf0fcdabc5e191b794f31a7966e36c1f83e80a9fe9585f
5
5
  SHA512:
6
- metadata.gz: ff42246d1757114996bf8094d80b47ebe2945e1df8551837389cad6c8dc7b96138ac398131d3b6ad07c7c0360b7758a77a06c3557716f22a07e6e4f99085a8bb
7
- data.tar.gz: c7ff2ebedf28620e1ec16774b3ff07eb4007fdc76c59c925aa9f3161c452075123e8e4ae17e2786c1a3016f81df0e0c93528813fb879a950a9cec41952351619
6
+ metadata.gz: f5a4a532eb8181cf02d7725bed41c8492eb11e0b879e4a51ad430674e220dbb5b26c1b5a44aa29790f6af8f7a1b9ccc132262bb239815f3c290c75c2e7edaaea
7
+ data.tar.gz: 604c5d622a63e5817e39b99d3029d2e15caa1c90a370cb44e9b2a0a321db8317c8da1686543a7267beef957abb149501c200fd0c5d2a148513210c7ab03e9ae5
data/README.md CHANGED
@@ -21,7 +21,7 @@ TL;DR:
21
21
 
22
22
  This gem follows SemVer, however only after a stable release 1.0.0 is made.
23
23
 
24
- A changelog is maintained in the [CHANGELOG.md](CHANGELOG.md) file and/or the GitHub Releases page.
24
+ A changelog is maintained via the [GitHub Releases page](https://github.com/swiknaba/kirei/releases).
25
25
 
26
26
  ## Installation
27
27
 
data/kirei.gemspec CHANGED
@@ -36,7 +36,6 @@ Gem::Specification.new do |spec|
36
36
  "sorbet/rbi/shims/**/*.rbi",
37
37
  "LICENSE",
38
38
  "README.md",
39
- "CHANGELOG.md",
40
39
  ]
41
40
 
42
41
  spec.bindir = "bin"
@@ -41,32 +41,9 @@ module Kirei
41
41
  @after_hooks.add(block) if block
42
42
  end
43
43
 
44
- sig { returns(String) }
45
- def req_host
46
- env.fetch("HTTP_HOST")
47
- end
48
-
49
- sig { returns(String) }
50
- def req_domain
51
- T.must(req_host.split(":").first).split(".").last(2).join(".")
52
- end
53
-
54
- sig { returns(T.nilable(String)) }
55
- def req_subdomain
56
- parts = T.must(req_host.split(":").first).split(".")
57
- return if parts.size <= 2
58
-
59
- T.must(parts[0..-3]).join(".")
60
- end
61
-
62
- sig { returns(Integer) }
63
- def req_port
64
- env.fetch("SERVER_PORT")&.to_i
65
- end
66
-
67
- sig { returns(T::Boolean) }
68
- def req_ssl?
69
- env.fetch("HTTPS", env.fetch("rack.url_scheme", "http")) == "https"
44
+ sig { returns(Routing::Request) }
45
+ def request
46
+ @request ||= T.let(Routing::Request.new(env: env), T.nilable(Routing::Request))
70
47
  end
71
48
 
72
49
  sig { returns(T::Hash[String, T.untyped]) }
@@ -0,0 +1,40 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Kirei
5
+ module Routing
6
+ class Request < T::Struct
7
+ extend T::Sig
8
+
9
+ const :env, T::Hash[String, T.untyped]
10
+
11
+ sig { returns(String) }
12
+ def host
13
+ env.fetch("HTTP_HOST")
14
+ end
15
+
16
+ sig { returns(String) }
17
+ def domain
18
+ T.must(host.split(":").first).split(".").last(2).join(".")
19
+ end
20
+
21
+ sig { returns(T.nilable(String)) }
22
+ def subdomain
23
+ parts = T.must(host.split(":").first).split(".")
24
+ return if parts.size <= 2
25
+
26
+ T.must(parts[0..-3]).join(".")
27
+ end
28
+
29
+ sig { returns(Integer) }
30
+ def port
31
+ env.fetch("SERVER_PORT")&.to_i
32
+ end
33
+
34
+ sig { returns(T::Boolean) }
35
+ def ssl?
36
+ env.fetch("HTTPS", env.fetch("rack.url_scheme", "http")) == "https"
37
+ end
38
+ end
39
+ end
40
+ end
data/lib/kirei/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Kirei
5
- VERSION = "0.8.0"
5
+ VERSION = "0.8.1"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kirei
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ludwig Reinmiedl
@@ -163,7 +163,6 @@ extensions: []
163
163
  extra_rdoc_files: []
164
164
  files:
165
165
  - ".irbrc"
166
- - CHANGELOG.md
167
166
  - README.md
168
167
  - bin/kirei
169
168
  - kirei.gemspec
@@ -198,6 +197,7 @@ files:
198
197
  - lib/kirei/routing/nilable_hooks_type.rb
199
198
  - lib/kirei/routing/rack_env_type.rb
200
199
  - lib/kirei/routing/rack_response_type.rb
200
+ - lib/kirei/routing/request.rb
201
201
  - lib/kirei/routing/route.rb
202
202
  - lib/kirei/routing/router.rb
203
203
  - lib/kirei/routing/verb.rb
data/CHANGELOG.md DELETED
@@ -1,16 +0,0 @@
1
- # Changelog
2
-
3
- ## [Unreleased]
4
-
5
- ## [0.1.0] - 2023-09-02
6
-
7
- - Initial release
8
- - added base model
9
- - added database connection
10
- - WIP: basic cli to scaffold a new project
11
-
12
- ## [0.2.0] - 2023-09-02
13
-
14
- - added routing
15
- - added base controller
16
- - added database tasks (create, drop, migrate, rollback, generate migration)