belt 0.1.4 → 0.1.6
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/lib/belt/action_router.rb +7 -0
- data/lib/belt/assets/belt-default.jpg +0 -0
- data/lib/belt/assets/welcome.css +112 -0
- data/lib/belt/cli/app_detection.rb +17 -1
- data/lib/belt/cli/deploy_command.rb +495 -0
- data/lib/belt/cli/environment_command.rb +12 -7
- data/lib/belt/cli/generate_command.rb +165 -10
- data/lib/belt/cli/new_command.rb +168 -25
- data/lib/belt/cli/server_command.rb +302 -0
- data/lib/belt/cli/setup_command.rb +40 -6
- data/lib/belt/cli.rb +12 -11
- data/lib/belt/controllers/welcome_controller.rb +46 -0
- data/lib/belt/rendering.rb +136 -0
- data/lib/belt/version.rb +1 -1
- data/lib/belt/views/welcome/show.html.erb +51 -0
- data/lib/belt.rb +2 -0
- data/lib/belt_controller/base.rb +2 -0
- data/lib/templates/environment/main.tf.erb +17 -3
- data/lib/templates/environment/outputs.tf.erb +9 -0
- data/lib/templates/new_app/infrastructure/routes.tf.rb.erb +2 -1
- data/lib/templates/new_app/lambda/api.rb.erb +2 -2
- data/lib/templates/new_app/lambda/controllers/application_controller.rb.erb +1 -1
- data/lib/templates/new_app/lambda/lib/routes/routes.rb.erb +2 -1
- metadata +9 -1
data/lib/belt_controller/base.rb
CHANGED
|
@@ -6,10 +6,12 @@ require_relative '../belt/parameters'
|
|
|
6
6
|
require_relative '../belt/helpers/response'
|
|
7
7
|
require_relative '../belt/helpers/error_logging'
|
|
8
8
|
require_relative '../belt/helpers/cors_origin'
|
|
9
|
+
require_relative '../belt/rendering'
|
|
9
10
|
|
|
10
11
|
module BeltController
|
|
11
12
|
class Base
|
|
12
13
|
include Belt::Helpers::Response
|
|
14
|
+
include Belt::Rendering
|
|
13
15
|
|
|
14
16
|
attr_reader :event, :body
|
|
15
17
|
|
|
@@ -20,7 +20,7 @@ provider "aws" {
|
|
|
20
20
|
|
|
21
21
|
default_tags {
|
|
22
22
|
tags = {
|
|
23
|
-
Project =
|
|
23
|
+
Project = var.app_name
|
|
24
24
|
Environment = var.environment
|
|
25
25
|
ManagedBy = "Terraform"
|
|
26
26
|
}
|
|
@@ -33,10 +33,24 @@ provider "conveyor-belt" {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
resource "conveyor_belt" "main" {
|
|
36
|
+
provider = conveyor-belt
|
|
36
37
|
source = "${path.module}/../routes.tf.rb"
|
|
37
38
|
app_name = var.app_name
|
|
38
39
|
lambda_source_dir = "${path.module}/../../lambda"
|
|
39
|
-
lambda_shared_dirs = ["controllers", "helpers", "lib", "models", "
|
|
40
|
+
lambda_shared_dirs = ["controllers", "helpers", "lib", "models", "views"]
|
|
40
41
|
frontend_urls = ["http://localhost:3000"]
|
|
41
|
-
friendly_errors =
|
|
42
|
+
friendly_errors = var.environment != "prod"
|
|
43
|
+
|
|
44
|
+
# Per-lambda configuration: env vars, timeouts, memory
|
|
45
|
+
lambda_config = {
|
|
46
|
+
api = {
|
|
47
|
+
# timeout = 30
|
|
48
|
+
# memory_size = 256
|
|
49
|
+
|
|
50
|
+
env_vars = {
|
|
51
|
+
WELCOME_TITLE = "Welcome to ${var.app_name}"
|
|
52
|
+
WELCOME_SUBTITLE = "API Gateway → Lambda → DynamoDB — all connected."
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
42
56
|
}
|
|
@@ -10,12 +10,12 @@ ActiveItem.configure do |config|
|
|
|
10
10
|
config.environment = ENV['ENVIRONMENT']
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
require_relative 'lib/routes
|
|
13
|
+
require_relative 'lib/routes/api_routes'
|
|
14
14
|
<% @resources&.each do |r| -%>
|
|
15
15
|
require_relative 'controllers/<%= @app_name %>/<%= r %>_controller'
|
|
16
16
|
<% end -%>
|
|
17
17
|
|
|
18
|
-
ROUTER = Belt::ActionRouter.new(routes: Routes
|
|
18
|
+
ROUTER = Belt::ActionRouter.new(routes: Routes::API, namespace: 'api')
|
|
19
19
|
|
|
20
20
|
def execute(path:, body:, event:)
|
|
21
21
|
ROUTER.route(event: event, body: body)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Routes
|
|
4
|
-
|
|
4
|
+
API = [
|
|
5
|
+
{ verb: 'GET', path: '/', controller: 'welcome', action: 'show' },
|
|
5
6
|
# { verb: 'GET', path: '/posts', controller: 'posts', action: 'index' },
|
|
6
7
|
# { verb: 'POST', path: '/posts', controller: 'posts', action: 'create' },
|
|
7
8
|
# { verb: 'GET', path: '/posts/{id}', controller: 'posts', action: 'show' },
|
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.1.
|
|
4
|
+
version: 0.1.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stowzilla
|
|
@@ -52,10 +52,13 @@ files:
|
|
|
52
52
|
- exe/belt
|
|
53
53
|
- lib/belt.rb
|
|
54
54
|
- lib/belt/action_router.rb
|
|
55
|
+
- lib/belt/assets/belt-default.jpg
|
|
56
|
+
- lib/belt/assets/welcome.css
|
|
55
57
|
- lib/belt/cli.rb
|
|
56
58
|
- lib/belt/cli/app_detection.rb
|
|
57
59
|
- lib/belt/cli/bucket_security.rb
|
|
58
60
|
- lib/belt/cli/console_command.rb
|
|
61
|
+
- lib/belt/cli/deploy_command.rb
|
|
59
62
|
- lib/belt/cli/env_resolver.rb
|
|
60
63
|
- lib/belt/cli/environment_command.rb
|
|
61
64
|
- lib/belt/cli/frontend_command.rb
|
|
@@ -66,24 +69,29 @@ files:
|
|
|
66
69
|
- lib/belt/cli/routes_command.rb
|
|
67
70
|
- lib/belt/cli/routes_command/route_inference.rb
|
|
68
71
|
- lib/belt/cli/routes_command/schema_loader.rb
|
|
72
|
+
- lib/belt/cli/server_command.rb
|
|
69
73
|
- lib/belt/cli/setup_command.rb
|
|
70
74
|
- lib/belt/cli/tables_command.rb
|
|
71
75
|
- lib/belt/cli/tasks_command.rb
|
|
72
76
|
- lib/belt/cli/terraform_command.rb
|
|
73
77
|
- lib/belt/cli/views_command.rb
|
|
78
|
+
- lib/belt/controllers/welcome_controller.rb
|
|
74
79
|
- lib/belt/helpers/cors_origin.rb
|
|
75
80
|
- lib/belt/helpers/error_logging.rb
|
|
76
81
|
- lib/belt/helpers/response.rb
|
|
77
82
|
- lib/belt/lambda_handler.rb
|
|
78
83
|
- lib/belt/observability.rb
|
|
79
84
|
- lib/belt/parameters.rb
|
|
85
|
+
- lib/belt/rendering.rb
|
|
80
86
|
- lib/belt/root.rb
|
|
81
87
|
- lib/belt/route_dsl.rb
|
|
82
88
|
- lib/belt/table_inference.rb
|
|
83
89
|
- lib/belt/version.rb
|
|
90
|
+
- lib/belt/views/welcome/show.html.erb
|
|
84
91
|
- lib/belt_controller/base.rb
|
|
85
92
|
- lib/templates/environment/backend.tf.erb
|
|
86
93
|
- lib/templates/environment/main.tf.erb
|
|
94
|
+
- lib/templates/environment/outputs.tf.erb
|
|
87
95
|
- lib/templates/environment/terraform.tfvars.erb
|
|
88
96
|
- lib/templates/environment/variables.tf.erb
|
|
89
97
|
- lib/templates/frontend/react/index.html.erb
|