belt 0.0.6 → 0.1.0
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/exe/belt +6 -0
- data/lib/belt/action_router.rb +7 -1
- data/lib/belt/cli/app_detection.rb +16 -0
- data/lib/belt/cli/bucket_security.rb +122 -0
- data/lib/belt/cli/env_resolver.rb +15 -0
- data/lib/belt/cli/environment_command.rb +77 -0
- data/lib/belt/cli/frontend_command.rb +85 -0
- data/lib/belt/cli/frontend_deploy_command.rb +125 -0
- data/lib/belt/cli/frontend_setup_command.rb +64 -0
- data/lib/belt/cli/generate_command.rb +206 -0
- data/lib/belt/cli/new_command.rb +125 -0
- data/lib/belt/cli/setup_command.rb +261 -0
- data/lib/belt/cli/tables_command.rb +138 -0
- data/lib/belt/cli/terraform_command.rb +77 -0
- data/lib/belt/cli/views_command.rb +134 -0
- data/lib/belt/cli.rb +98 -0
- data/lib/belt/lambda_handler.rb +16 -0
- data/lib/belt/version.rb +1 -1
- data/lib/belt.rb +1 -1
- data/lib/templates/environment/backend.tf.erb +8 -0
- data/lib/templates/environment/main.tf.erb +42 -0
- data/lib/templates/environment/terraform.tfvars.erb +1 -0
- data/lib/templates/environment/variables.tf.erb +16 -0
- data/lib/templates/frontend/react/index.html.erb +12 -0
- data/lib/templates/frontend/react/package.json.erb +20 -0
- data/lib/templates/frontend/react/src/App.jsx +14 -0
- data/lib/templates/frontend/react/src/index.css +10 -0
- data/lib/templates/frontend/react/src/lib/apiClient.js.erb +19 -0
- data/lib/templates/frontend/react/src/main.jsx +10 -0
- data/lib/templates/frontend/react/src/pages/Home.jsx.erb +10 -0
- data/lib/templates/frontend/react/vite.config.js +8 -0
- data/lib/templates/frontend_infra/frontend.tf.erb +159 -0
- data/lib/templates/generate/controller.rb.erb +59 -0
- data/lib/templates/generate/model.rb.erb +20 -0
- data/lib/templates/new_app/AGENTS.md.erb +130 -0
- data/lib/templates/new_app/Gemfile.erb +6 -0
- data/lib/templates/new_app/README.md.erb +25 -0
- data/lib/templates/new_app/gitignore.erb +14 -0
- data/lib/templates/new_app/infrastructure/routes.tf.rb.erb +5 -0
- data/lib/templates/new_app/infrastructure/schema.tf.rb.erb +9 -0
- data/lib/templates/new_app/lambda/Gemfile.erb +7 -0
- data/lib/templates/new_app/lambda/api.rb.erb +22 -0
- data/lib/templates/new_app/lambda/controllers/application_controller.rb.erb +6 -0
- data/lib/templates/new_app/lambda/lib/routes/routes.rb.erb +11 -0
- data/lib/templates/new_app/lambda/models/application_record.rb.erb +6 -0
- data/lib/templates/new_app/lambda/models/concerns/timestampable.rb.erb +23 -0
- data/lib/templates/views/Edit.jsx.erb +38 -0
- data/lib/templates/views/Form.jsx.erb +34 -0
- data/lib/templates/views/Index.jsx.erb +39 -0
- data/lib/templates/views/New.jsx.erb +26 -0
- data/lib/templates/views/Show.jsx.erb +46 -0
- data.tar.gz.sig +0 -0
- metadata +51 -3
- metadata.gz.sig +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
import { useParams, Link, useNavigate } from 'react-router-dom'
|
|
3
|
+
import { apiClient } from '../../lib/apiClient'
|
|
4
|
+
|
|
5
|
+
export default function <%= @class_name %>Show() {
|
|
6
|
+
const { id } = useParams()
|
|
7
|
+
const navigate = useNavigate()
|
|
8
|
+
const [<%= @singular_name %>, set<%= @class_name %>] = useState(null)
|
|
9
|
+
const [loading, setLoading] = useState(true)
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
apiClient(`/<%= @resource_name %>/${id}`)
|
|
13
|
+
.then(data => set<%= @class_name %>(data.<%= @singular_name %>))
|
|
14
|
+
.finally(() => setLoading(false))
|
|
15
|
+
}, [id])
|
|
16
|
+
|
|
17
|
+
async function handleDelete() {
|
|
18
|
+
if (!confirm('Are you sure?')) return
|
|
19
|
+
await apiClient(`/<%= @resource_name %>/${id}`, { method: 'DELETE' })
|
|
20
|
+
navigate('/<%= @resource_name %>')
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (loading) return <p>Loading...</p>
|
|
24
|
+
if (!<%= @singular_name %>) return <p><%= @class_name %> not found.</p>
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<main style={{ padding: '2rem', maxWidth: '800px', margin: '0 auto' }}>
|
|
28
|
+
<Link to="/<%= @resource_name %>">← Back to <%= @resource_name %></Link>
|
|
29
|
+
<% @fields.each do |field| -%>
|
|
30
|
+
<% if field[:type] == 'text' -%>
|
|
31
|
+
<div style={{ margin: '1rem 0', whiteSpace: 'pre-wrap' }}>{<%= @singular_name %>.<%= field[:name] %>}</div>
|
|
32
|
+
<% else -%>
|
|
33
|
+
<p><strong><%= field[:name].split('_').map(&:capitalize).join(' ') %>:</strong> {<%= @singular_name %>.<%= field[:name] %>}</p>
|
|
34
|
+
<% end -%>
|
|
35
|
+
<% end -%>
|
|
36
|
+
|
|
37
|
+
<div style={{ marginTop: '1rem' }}>
|
|
38
|
+
<Link to={`/<%= @resource_name %>/${id}/edit`}>Edit</Link>
|
|
39
|
+
{' | '}
|
|
40
|
+
<button onClick={handleDelete} style={{ background: 'none', border: 'none', color: 'red', cursor: 'pointer' }}>
|
|
41
|
+
Delete
|
|
42
|
+
</button>
|
|
43
|
+
</div>
|
|
44
|
+
</main>
|
|
45
|
+
)
|
|
46
|
+
}
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: belt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stowzilla
|
|
8
|
-
bindir:
|
|
8
|
+
bindir: exe
|
|
9
9
|
cert_chain:
|
|
10
10
|
- |
|
|
11
11
|
-----BEGIN CERTIFICATE-----
|
|
@@ -54,7 +54,8 @@ description: Belt provides a collection of lightweight utilities for Ruby applic
|
|
|
54
54
|
email:
|
|
55
55
|
- andy@stowzilla.com
|
|
56
56
|
- adam@stowzilla.com
|
|
57
|
-
executables:
|
|
57
|
+
executables:
|
|
58
|
+
- belt
|
|
58
59
|
extensions: []
|
|
59
60
|
extra_rdoc_files: []
|
|
60
61
|
files:
|
|
@@ -62,8 +63,23 @@ files:
|
|
|
62
63
|
- LICENSE.txt
|
|
63
64
|
- README.md
|
|
64
65
|
- certs/stowzilla.pem
|
|
66
|
+
- exe/belt
|
|
65
67
|
- lib/belt.rb
|
|
66
68
|
- lib/belt/action_router.rb
|
|
69
|
+
- lib/belt/cli.rb
|
|
70
|
+
- lib/belt/cli/app_detection.rb
|
|
71
|
+
- lib/belt/cli/bucket_security.rb
|
|
72
|
+
- lib/belt/cli/env_resolver.rb
|
|
73
|
+
- lib/belt/cli/environment_command.rb
|
|
74
|
+
- lib/belt/cli/frontend_command.rb
|
|
75
|
+
- lib/belt/cli/frontend_deploy_command.rb
|
|
76
|
+
- lib/belt/cli/frontend_setup_command.rb
|
|
77
|
+
- lib/belt/cli/generate_command.rb
|
|
78
|
+
- lib/belt/cli/new_command.rb
|
|
79
|
+
- lib/belt/cli/setup_command.rb
|
|
80
|
+
- lib/belt/cli/tables_command.rb
|
|
81
|
+
- lib/belt/cli/terraform_command.rb
|
|
82
|
+
- lib/belt/cli/views_command.rb
|
|
67
83
|
- lib/belt/helpers/cors_origin.rb
|
|
68
84
|
- lib/belt/helpers/error_logging.rb
|
|
69
85
|
- lib/belt/helpers/response.rb
|
|
@@ -72,6 +88,38 @@ files:
|
|
|
72
88
|
- lib/belt/parameters.rb
|
|
73
89
|
- lib/belt/version.rb
|
|
74
90
|
- lib/belt_controller/base.rb
|
|
91
|
+
- lib/templates/environment/backend.tf.erb
|
|
92
|
+
- lib/templates/environment/main.tf.erb
|
|
93
|
+
- lib/templates/environment/terraform.tfvars.erb
|
|
94
|
+
- lib/templates/environment/variables.tf.erb
|
|
95
|
+
- lib/templates/frontend/react/index.html.erb
|
|
96
|
+
- lib/templates/frontend/react/package.json.erb
|
|
97
|
+
- lib/templates/frontend/react/src/App.jsx
|
|
98
|
+
- lib/templates/frontend/react/src/index.css
|
|
99
|
+
- lib/templates/frontend/react/src/lib/apiClient.js.erb
|
|
100
|
+
- lib/templates/frontend/react/src/main.jsx
|
|
101
|
+
- lib/templates/frontend/react/src/pages/Home.jsx.erb
|
|
102
|
+
- lib/templates/frontend/react/vite.config.js
|
|
103
|
+
- lib/templates/frontend_infra/frontend.tf.erb
|
|
104
|
+
- lib/templates/generate/controller.rb.erb
|
|
105
|
+
- lib/templates/generate/model.rb.erb
|
|
106
|
+
- lib/templates/new_app/AGENTS.md.erb
|
|
107
|
+
- lib/templates/new_app/Gemfile.erb
|
|
108
|
+
- lib/templates/new_app/README.md.erb
|
|
109
|
+
- lib/templates/new_app/gitignore.erb
|
|
110
|
+
- lib/templates/new_app/infrastructure/routes.tf.rb.erb
|
|
111
|
+
- lib/templates/new_app/infrastructure/schema.tf.rb.erb
|
|
112
|
+
- lib/templates/new_app/lambda/Gemfile.erb
|
|
113
|
+
- lib/templates/new_app/lambda/api.rb.erb
|
|
114
|
+
- lib/templates/new_app/lambda/controllers/application_controller.rb.erb
|
|
115
|
+
- lib/templates/new_app/lambda/lib/routes/routes.rb.erb
|
|
116
|
+
- lib/templates/new_app/lambda/models/application_record.rb.erb
|
|
117
|
+
- lib/templates/new_app/lambda/models/concerns/timestampable.rb.erb
|
|
118
|
+
- lib/templates/views/Edit.jsx.erb
|
|
119
|
+
- lib/templates/views/Form.jsx.erb
|
|
120
|
+
- lib/templates/views/Index.jsx.erb
|
|
121
|
+
- lib/templates/views/New.jsx.erb
|
|
122
|
+
- lib/templates/views/Show.jsx.erb
|
|
75
123
|
homepage: https://github.com/stowzilla/belt
|
|
76
124
|
licenses:
|
|
77
125
|
- MIT
|
metadata.gz.sig
CHANGED
|
Binary file
|