belt 0.0.5 → 0.0.7
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
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +4 -0
- data/lib/belt/version.rb +1 -1
- data/lib/belt.rb +26 -12
- data.tar.gz.sig +0 -0
- metadata +1 -2
- metadata.gz.sig +0 -0
- data/lib/belt/holster.rb +0 -46
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 14240a12050757c9936f1f57d941d98d23f79d0fc82b54f3c9d75217a5a00677
|
|
4
|
+
data.tar.gz: d8c545b345c138d8d84ca2dc170ea99ad8b5404310620cdf17c8092263a2f7fc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6bf259163e8b4c50e4d544fc671f8ed5408b6996563392ff5301de7c5e26ac9098e149d0eeadae028fe455ef92e409e8c187130a6c12b2652673c77be7c6afae
|
|
7
|
+
data.tar.gz: 93bd5dc850ad6bb17e771c9a12982b4b89f2df06b048404f0b66dec83d7cff74720ee2e0e9359b00fb85341834b0c774faf51539afbec5c9fcbf01815eb7cf7d
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.0.7
|
|
4
|
+
|
|
5
|
+
- Fixed `discover_gem_paths` to use `Gem.loaded_specs` instead of `Gem::Specification.each` — the latter silently returns nothing on Lambda's vendored bundle layout, causing gem controllers/models to not be found
|
|
6
|
+
|
|
3
7
|
## 0.0.5
|
|
4
8
|
|
|
5
9
|
- Eliminated regex from `Belt::ActionRouter` — uses pure segment-by-segment string comparison (resolves CodeQL alerts)
|
data/lib/belt/version.rb
CHANGED
data/lib/belt.rb
CHANGED
|
@@ -5,7 +5,6 @@ require_relative 'belt/parameters'
|
|
|
5
5
|
require_relative 'belt/observability'
|
|
6
6
|
require_relative 'belt/lambda_handler'
|
|
7
7
|
require_relative 'belt/action_router'
|
|
8
|
-
require_relative 'belt/holster'
|
|
9
8
|
|
|
10
9
|
module Belt
|
|
11
10
|
class AuthenticationError < StandardError; end
|
|
@@ -17,24 +16,39 @@ module Belt
|
|
|
17
16
|
class << self
|
|
18
17
|
attr_reader :controller_paths
|
|
19
18
|
|
|
20
|
-
#
|
|
19
|
+
# Auto-discover lambda/controllers dirs in all loaded gems
|
|
20
|
+
def gem_controller_paths
|
|
21
|
+
@gem_controller_paths ||= discover_gem_paths('lambda/controllers')
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Auto-discover lambda/models dirs in all loaded gems
|
|
25
|
+
def gem_model_paths
|
|
26
|
+
@gem_model_paths ||= discover_gem_paths('lambda/models')
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# All controller paths: app-defined + gem-discovered
|
|
21
30
|
def all_controller_paths
|
|
22
|
-
controller_paths +
|
|
31
|
+
controller_paths + gem_controller_paths
|
|
23
32
|
end
|
|
24
33
|
|
|
25
|
-
#
|
|
26
|
-
def
|
|
27
|
-
|
|
34
|
+
# All gem model paths that exist on disk
|
|
35
|
+
def all_model_paths
|
|
36
|
+
gem_model_paths
|
|
28
37
|
end
|
|
29
38
|
|
|
30
|
-
#
|
|
31
|
-
def
|
|
32
|
-
|
|
39
|
+
# Reset cached paths (useful in tests)
|
|
40
|
+
def reset_gem_paths!
|
|
41
|
+
@gem_controller_paths = nil
|
|
42
|
+
@gem_model_paths = nil
|
|
33
43
|
end
|
|
34
44
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
def discover_gem_paths(subdir)
|
|
48
|
+
Gem.loaded_specs.each_value.filter_map do |spec|
|
|
49
|
+
path = File.join(spec.gem_dir, subdir)
|
|
50
|
+
path if File.directory?(path)
|
|
51
|
+
end
|
|
38
52
|
end
|
|
39
53
|
end
|
|
40
54
|
end
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: belt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stowzilla
|
|
@@ -67,7 +67,6 @@ files:
|
|
|
67
67
|
- lib/belt/helpers/cors_origin.rb
|
|
68
68
|
- lib/belt/helpers/error_logging.rb
|
|
69
69
|
- lib/belt/helpers/response.rb
|
|
70
|
-
- lib/belt/holster.rb
|
|
71
70
|
- lib/belt/lambda_handler.rb
|
|
72
71
|
- lib/belt/observability.rb
|
|
73
72
|
- lib/belt/parameters.rb
|
metadata.gz.sig
CHANGED
|
Binary file
|
data/lib/belt/holster.rb
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Belt
|
|
4
|
-
class Holster
|
|
5
|
-
class << self
|
|
6
|
-
def inherited(subclass)
|
|
7
|
-
super
|
|
8
|
-
Belt.holsters << subclass
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
# Convention: gem root is two levels up from the holster file
|
|
12
|
-
def gem_root
|
|
13
|
-
@gem_root ||= File.expand_path('../..', caller_locations(1, 1).first.path)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
attr_writer :gem_root, :controllers_path, :models_path, :routes_path, :schema_path
|
|
17
|
-
|
|
18
|
-
# Defaults follow Belt project structure conventions
|
|
19
|
-
def controllers_path
|
|
20
|
-
@controllers_path || File.join(gem_root, 'lambda', 'controllers')
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def models_path
|
|
24
|
-
@models_path || File.join(gem_root, 'lambda', 'models')
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def routes_path
|
|
28
|
-
@routes_path || File.join(gem_root, 'infrastructure', 'routes.tf.rb')
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def schema_path
|
|
32
|
-
@schema_path || File.join(gem_root, 'infrastructure', 'schema.tf.rb')
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def holster_name
|
|
36
|
-
name&.split('::')&.first&.downcase || 'unknown'
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
@holsters = []
|
|
42
|
-
|
|
43
|
-
class << self
|
|
44
|
-
attr_reader :holsters
|
|
45
|
-
end
|
|
46
|
-
end
|