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.

@@ -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? && (@regular_fields.any? || @references.any?) -%>
7
+ <% if @references.any? && @regular_fields.any? -%>
8
8
 
9
9
  <% end -%>
10
- <% @references.each do |ref| -%>
11
- attr_accessor :<%= ref[:referenced_model] %>_id
12
- <% end -%>
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
- namespace :<%= @app_name %> do
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 namespace becomes a base path mapping. URLs look like:
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
- namespace :api do
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, namespace: '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.2.19
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