kangaru 0.2.0 → 0.2.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/kangaru/application.rb +2 -12
- data/lib/kangaru/initialiser.rb +1 -1
- data/lib/kangaru/{injected_methods.rb → interface.rb} +16 -4
- data/lib/kangaru/version.rb +1 -1
- data/sig/kangaru/application.rbs +1 -3
- data/sig/kangaru/initialiser.rbs +0 -4
- data/sig/kangaru/interface.rbs +21 -0
- data/sig/kangaru.rbs +0 -5
- metadata +4 -4
- data/sig/kangaru/injected_methods.rbs +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14de853c7d43559d44b5dab8ca97090305697c8cb14245b9647b1f67d17036a6
|
4
|
+
data.tar.gz: 96572ecb84ae6cc4a74833d0456678bf66b8dcfbe701977ba6c920236cba5c64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad440db45f269703c52939c80b0534b527c54e3649e15f2206af920818b2f8b5529c52a9127364a74b7f72d38fe56976ee5a6d8fe610585365a67bcb46b30176
|
7
|
+
data.tar.gz: 67ca725ea8b804a30a0ea4769a0203af75601e546dcfe56dc237f308bda356cc6029e5c01921064044188d955c667e0d74e643f0d52cf309ebecf04403cf157c
|
data/Gemfile.lock
CHANGED
data/lib/kangaru/application.rb
CHANGED
@@ -24,11 +24,8 @@ module Kangaru
|
|
24
24
|
@router ||= Router.new(namespace:)
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
# most recent calls will overwrite older changes.
|
30
|
-
def configure(env = nil, &block)
|
31
|
-
block.call(config) if current_env?(env)
|
27
|
+
def configure(&block)
|
28
|
+
block.call(config)
|
32
29
|
end
|
33
30
|
|
34
31
|
def configured?
|
@@ -62,13 +59,6 @@ module Kangaru
|
|
62
59
|
|
63
60
|
private
|
64
61
|
|
65
|
-
# Returns true if nil as this is represents all envs.
|
66
|
-
def current_env?(env)
|
67
|
-
return true if env.nil?
|
68
|
-
|
69
|
-
Kangaru.env?(env)
|
70
|
-
end
|
71
|
-
|
72
62
|
def autoloader
|
73
63
|
@autoloader ||= Zeitwerk::Loader.new.tap do |loader|
|
74
64
|
loader.inflector = Zeitwerk::GemInflector.new(paths.source.to_s)
|
data/lib/kangaru/initialiser.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Kangaru
|
2
|
-
module
|
2
|
+
module Interface
|
3
3
|
def run!(*argv)
|
4
4
|
Kangaru.application!.run!(*argv)
|
5
5
|
end
|
@@ -8,11 +8,15 @@ module Kangaru
|
|
8
8
|
Kangaru.application!.config
|
9
9
|
end
|
10
10
|
|
11
|
-
def configure(env
|
12
|
-
|
11
|
+
def configure(env: nil, &)
|
12
|
+
return unless env_applies?(env)
|
13
|
+
|
14
|
+
Kangaru.application!.configure(&)
|
13
15
|
end
|
14
16
|
|
15
|
-
def
|
17
|
+
def config_path(path, env: nil)
|
18
|
+
return unless env_applies?(env)
|
19
|
+
|
16
20
|
Kangaru.application!.config_path = path
|
17
21
|
end
|
18
22
|
|
@@ -23,5 +27,13 @@ module Kangaru
|
|
23
27
|
def database
|
24
28
|
Kangaru.application!.database
|
25
29
|
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def env_applies?(env)
|
34
|
+
return true if env.nil?
|
35
|
+
|
36
|
+
Kangaru.env?(env)
|
37
|
+
end
|
26
38
|
end
|
27
39
|
end
|
data/lib/kangaru/version.rb
CHANGED
data/sig/kangaru/application.rbs
CHANGED
@@ -16,7 +16,7 @@ module Kangaru
|
|
16
16
|
|
17
17
|
def initialize: (source: String, namespace: Module) -> void
|
18
18
|
|
19
|
-
def configure:
|
19
|
+
def configure: { (Config) -> void } -> void
|
20
20
|
|
21
21
|
def configured?: -> bool
|
22
22
|
|
@@ -34,8 +34,6 @@ module Kangaru
|
|
34
34
|
|
35
35
|
@configured: bool
|
36
36
|
|
37
|
-
def current_env?: (Symbol?) -> bool
|
38
|
-
|
39
37
|
attr_reader autoloader: Zeitwerk::Loader
|
40
38
|
|
41
39
|
def validate_config!: -> void
|
data/sig/kangaru/initialiser.rbs
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Kangaru
|
2
|
+
module Interface
|
3
|
+
type env = Symbol?
|
4
|
+
|
5
|
+
def run!: (*String) -> void
|
6
|
+
|
7
|
+
def config: -> Config
|
8
|
+
|
9
|
+
def configure: (?env: env) { (Config) -> void } -> void
|
10
|
+
|
11
|
+
def apply_config!: -> void
|
12
|
+
|
13
|
+
def config_path: (String, ?env: env) -> void
|
14
|
+
|
15
|
+
def database: -> Database?
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def env_applies?: (Symbol?) -> bool
|
20
|
+
end
|
21
|
+
end
|
data/sig/kangaru.rbs
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kangaru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Welham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -127,7 +127,7 @@ files:
|
|
127
127
|
- lib/kangaru/initialisers/rspec.rb
|
128
128
|
- lib/kangaru/initialisers/rspec/kangaru_helper.rb
|
129
129
|
- lib/kangaru/initialisers/rspec/request_helper.rb
|
130
|
-
- lib/kangaru/
|
130
|
+
- lib/kangaru/interface.rb
|
131
131
|
- lib/kangaru/model.rb
|
132
132
|
- lib/kangaru/patches/constantise.rb
|
133
133
|
- lib/kangaru/patches/inflections.rb
|
@@ -174,7 +174,7 @@ files:
|
|
174
174
|
- sig/kangaru/inflectors/tokeniser.rbs
|
175
175
|
- sig/kangaru/initialiser.rbs
|
176
176
|
- sig/kangaru/initialisers/rspec.rbs
|
177
|
-
- sig/kangaru/
|
177
|
+
- sig/kangaru/interface.rbs
|
178
178
|
- sig/kangaru/model.rbs
|
179
179
|
- sig/kangaru/patches/constantise.rbs
|
180
180
|
- sig/kangaru/patches/inflections.rbs
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Kangaru
|
2
|
-
module InjectedMethods
|
3
|
-
interface _InjectedMethods
|
4
|
-
def run!: (*String) -> void
|
5
|
-
|
6
|
-
def config: -> Config
|
7
|
-
|
8
|
-
def configure: (?Symbol?) { (Config) -> void } -> void
|
9
|
-
|
10
|
-
def apply_config!: -> void
|
11
|
-
|
12
|
-
def import_config_from!: (String) -> void
|
13
|
-
|
14
|
-
def database: -> Database?
|
15
|
-
end
|
16
|
-
|
17
|
-
include _InjectedMethods
|
18
|
-
end
|
19
|
-
end
|