belt 0.2.19 → 0.3.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.
Potentially problematic release.
This version of belt might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +47 -0
- data/README.md +42 -3
- data/lib/belt/action_router.rb +21 -17
- data/lib/belt/cli/app_detection.rb +4 -2
- data/lib/belt/cli/auth_command.rb +75 -4
- data/lib/belt/cli/console_command.rb +17 -2
- data/lib/belt/cli/deploy_command.rb +10 -2
- data/lib/belt/cli/destroy_command.rb +3 -1
- data/lib/belt/cli/doctor_command.rb +166 -22
- data/lib/belt/cli/generate_command.rb +37 -37
- data/lib/belt/cli/index_command.rb +192 -0
- data/lib/belt/cli/lambda_config_command.rb +2 -1
- data/lib/belt/cli/routes_command/route_inference.rb +4 -3
- data/lib/belt/cli/routes_command.rb +0 -19
- data/lib/belt/cli/tables_command.rb +3 -1
- data/lib/belt/cli/views_command.rb +3 -9
- data/lib/belt/cli.rb +1 -0
- data/lib/belt/inflector.rb +8 -0
- data/lib/belt/route_dsl.rb +196 -85
- data/lib/belt/version.rb +1 -1
- data/lib/templates/generate/auth/cognito.tf.erb +0 -2
- data/lib/templates/generate/auth/frontend/ConfirmEmail.jsx +1 -1
- data/lib/templates/generate/auth/frontend/Login.jsx +2 -4
- data/lib/templates/generate/auth/frontend/SignUp.jsx +1 -1
- data/lib/templates/generate/auth/frontend/auth.css +157 -0
- data/lib/templates/generate/auth/frontend/auth.js +5 -1
- data/lib/templates/generate/model.rb.erb +4 -6
- data/lib/templates/new_app/AGENTS.md.erb +2 -2
- data/lib/templates/new_app/config/lambda/api.yml.erb +1 -0
- data/lib/templates/new_app/config/routes.rb.erb +3 -1
- data/lib/templates/new_app/lambda/api.rb.erb +1 -1
- metadata +31 -1
|
@@ -4,13 +4,11 @@ class <%= @class_name %> < ApplicationRecord
|
|
|
4
4
|
<% @references.each do |ref| -%>
|
|
5
5
|
belongs_to :<%= ref[:referenced_model] %>
|
|
6
6
|
<% end -%>
|
|
7
|
-
<% if @references.any? &&
|
|
7
|
+
<% if @references.any? && @regular_fields.any? -%>
|
|
8
8
|
|
|
9
9
|
<% end -%>
|
|
10
|
-
<% @
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<% @regular_fields.each do |field| -%>
|
|
14
|
-
attr_accessor :<%= field[:name] %>
|
|
10
|
+
<% all_accessors = @regular_fields.map { |f| ":#{f[:name]}" } -%>
|
|
11
|
+
<% if all_accessors.any? -%>
|
|
12
|
+
attr_accessor <%= all_accessors.join(', ') %>
|
|
15
13
|
<% end -%>
|
|
16
14
|
end
|
|
@@ -56,13 +56,13 @@ belt output <env> # terraform output
|
|
|
56
56
|
1. `config/routes.rb` defines routes using a DSL:
|
|
57
57
|
```ruby
|
|
58
58
|
Belt.application.routes.draw do
|
|
59
|
-
|
|
59
|
+
gateway :<%= @app_name %> do
|
|
60
60
|
resources :things, tables: [:things]
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
2. Conveyor Belt creates an API Gateway where the
|
|
65
|
+
2. Conveyor Belt creates an API Gateway where the gateway name becomes a base path mapping. URLs look like:
|
|
66
66
|
```
|
|
67
67
|
https://api.<env>.example.com/<%= @app_name %>/things
|
|
68
68
|
```
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
# timeout Lambda timeout in seconds (default: 30)
|
|
6
6
|
# memory_size Lambda memory in MB (default: 256)
|
|
7
7
|
# env_vars Environment variables (static values or ref() for Terraform values)
|
|
8
|
+
# iam_policy_arns Additional IAM policy ARNs to attach (supports ref())
|
|
8
9
|
# dynamodb_tables DynamoDB table access (by name — ARNs built by convention)
|
|
9
10
|
# s3_buckets S3 bucket access declarations
|
|
10
11
|
# sns_triggers SNS topic triggers
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
Belt.application.routes.draw do
|
|
2
|
-
|
|
2
|
+
# Creates an API Gateway named "api" with a default Lambda function of the same name.
|
|
3
|
+
# Use `function :other_name do ... end` inside to route specific paths to additional Lambdas.
|
|
4
|
+
gateway :api do
|
|
3
5
|
# Public stack-check / welcome (HTML for browsers, JSON for the SPA shell)
|
|
4
6
|
get "/", action: :show, controller: :welcome, auth: :none
|
|
5
7
|
# resources :posts
|
|
@@ -9,7 +9,7 @@ require_relative 'lib/routes/api_routes'
|
|
|
9
9
|
require_relative 'controllers/<%= @app_name %>/<%= r %>_controller'
|
|
10
10
|
<% end -%>
|
|
11
11
|
|
|
12
|
-
ROUTER = Belt::ActionRouter.new(routes: Routes::API,
|
|
12
|
+
ROUTER = Belt::ActionRouter.new(routes: Routes::API, gateway: 'api')
|
|
13
13
|
|
|
14
14
|
def execute(path:, body:, event:)
|
|
15
15
|
ROUTER.route(event: event, body: body)
|
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.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stowzilla
|
|
@@ -43,6 +43,20 @@ dependencies:
|
|
|
43
43
|
- - ">="
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
45
|
version: '7.0'
|
|
46
|
+
- !ruby/object:Gem::Dependency
|
|
47
|
+
name: irb
|
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
|
49
|
+
requirements:
|
|
50
|
+
- - ">="
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: '1.0'
|
|
53
|
+
type: :runtime
|
|
54
|
+
prerelease: false
|
|
55
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
56
|
+
requirements:
|
|
57
|
+
- - ">="
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
version: '1.0'
|
|
46
60
|
- !ruby/object:Gem::Dependency
|
|
47
61
|
name: lambda_loadout
|
|
48
62
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -57,6 +71,20 @@ dependencies:
|
|
|
57
71
|
- - "~>"
|
|
58
72
|
- !ruby/object:Gem::Version
|
|
59
73
|
version: '0.0'
|
|
74
|
+
- !ruby/object:Gem::Dependency
|
|
75
|
+
name: rdoc
|
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
|
77
|
+
requirements:
|
|
78
|
+
- - ">="
|
|
79
|
+
- !ruby/object:Gem::Version
|
|
80
|
+
version: '6.0'
|
|
81
|
+
type: :runtime
|
|
82
|
+
prerelease: false
|
|
83
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
84
|
+
requirements:
|
|
85
|
+
- - ">="
|
|
86
|
+
- !ruby/object:Gem::Version
|
|
87
|
+
version: '6.0'
|
|
60
88
|
description: Belt provides a collection of lightweight utilities for Ruby applications.
|
|
61
89
|
email:
|
|
62
90
|
- andy@stowzilla.com
|
|
@@ -95,6 +123,7 @@ files:
|
|
|
95
123
|
- lib/belt/cli/frontend_setup_command.rb
|
|
96
124
|
- lib/belt/cli/generate_command.rb
|
|
97
125
|
- lib/belt/cli/generator_registry.rb
|
|
126
|
+
- lib/belt/cli/index_command.rb
|
|
98
127
|
- lib/belt/cli/lambda_config_command.rb
|
|
99
128
|
- lib/belt/cli/logs_command.rb
|
|
100
129
|
- lib/belt/cli/new_command.rb
|
|
@@ -149,6 +178,7 @@ files:
|
|
|
149
178
|
- lib/templates/generate/auth/frontend/ProtectedRoute.jsx
|
|
150
179
|
- lib/templates/generate/auth/frontend/SignUp.jsx
|
|
151
180
|
- lib/templates/generate/auth/frontend/apiClient.js
|
|
181
|
+
- lib/templates/generate/auth/frontend/auth.css
|
|
152
182
|
- lib/templates/generate/auth/frontend/auth.js
|
|
153
183
|
- lib/templates/generate/controller.rb.erb
|
|
154
184
|
- lib/templates/generate/model.rb.erb
|