mkbrut 0.4.2 → 0.6.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
- data/lib/mkbrut/segments/demo.rb +5 -1
- data/lib/mkbrut/version.rb +1 -1
- data/package.json +2 -2
- data/templates/Base/Procfile.development +5 -4
- data/templates/Base/app/config/i18n/en/1_defaults.rb +2 -2
- data/templates/Base/app/config/i18n/en/2_app.rb +4 -4
- data/templates/Base/app/src/front_end/css/index.css +0 -1
- data/templates/Base/app/src/front_end/images/apple-touch-icon-120x120.png +0 -0
- data/templates/Base/app/src/front_end/images/apple-touch-icon-152x152.png +0 -0
- data/templates/Base/app/src/front_end/images/apple-touch-icon-167x167.png +0 -0
- data/templates/Base/app/src/front_end/images/apple-touch-icon-180x180.png +0 -0
- data/templates/Base/app/src/front_end/images/favicon.ico +0 -0
- data/templates/Base/app/src/front_end/images/icon.png +0 -0
- data/templates/Base/app/src/front_end/layouts/default_layout.rb.erb +6 -9
- data/templates/Base/bin/startup-message +65 -0
- data/templates/segments/Demo/app/src/front_end/handlers/guestbook_message_handler.rb +1 -1
- data/templates/segments/Demo/specs/e2e/guest_message.spec.rb +3 -3
- metadata +5 -4
- /data/templates/Base/app/src/back_end/data_models/migrations/{00000000000000_citext.rb → 20240101130000_citext.rb} +0 -0
- /data/templates/{Base → segments/Demo}/app/src/front_end/css/fonts.css +0 -0
- /data/templates/{Base → segments/Demo}/app/src/front_end/fonts/monaspace-xenon.ttf +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 635f737ab220cbf181b23c3852d8d1683a6b1d0cc2d2cefe496105d3495966e5
|
4
|
+
data.tar.gz: 21ee357eb30e0b5626c43af73d0b438b4dfd9378dcaa908289931b17ac4dcbdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df92f5935742d37a62ff9688ba37c6ea28f4c85aa23933ab64aeb6502bdd57e8f1fb481e28c8841702b05e4d2f13d3d0cae754615b8776279709b5ea0c706307
|
7
|
+
data.tar.gz: 1691f7280eab746527652a60d032119c138e1e241637c1bb74d2062ae09a4af59437dbb4cc237ce1f48aca69772f7de63444e0d9aeb625d37fefe9fe71eb0cb2
|
data/lib/mkbrut/segments/demo.rb
CHANGED
@@ -28,7 +28,7 @@ private
|
|
28
28
|
hash: {
|
29
29
|
en: {
|
30
30
|
cv: {
|
31
|
-
|
31
|
+
ss: {
|
32
32
|
not_enough_words: "%{field} does not have enough words",
|
33
33
|
already_posted: "You've already posted a message. Thanks for that!",
|
34
34
|
},
|
@@ -72,6 +72,10 @@ end
|
|
72
72
|
project_root: project_root,
|
73
73
|
import: "constraint-violations.css"
|
74
74
|
),
|
75
|
+
MKBrut::Ops::AddCSSImport.new(
|
76
|
+
project_root: project_root,
|
77
|
+
import: "fonts.css"
|
78
|
+
),
|
75
79
|
MKBrut::Ops::InsertCodeInMethod.new(
|
76
80
|
file: project_root / "app" / "src" / "front_end" / "pages"/ "home_page.rb",
|
77
81
|
class_name: "HomePage",
|
data/lib/mkbrut/version.rb
CHANGED
data/package.json
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
web:
|
2
|
-
css:
|
3
|
-
js:
|
4
|
-
images:
|
1
|
+
web: PORT=6502 bin/run
|
2
|
+
css: bin/watch-and-build-assets css
|
3
|
+
js: bin/watch-and-build-assets js
|
4
|
+
images: bin/watch-and-build-assets images
|
5
|
+
startup_message: PORT=6502 bin/startup-message
|
@@ -88,7 +88,7 @@
|
|
88
88
|
},
|
89
89
|
cv: { # short for "constraint violations" to avoid having to type that out
|
90
90
|
this_field: "This field",
|
91
|
-
|
91
|
+
cs: { # short for "client-side", again to not have to type it out
|
92
92
|
# These keys use camel-case because that is how the browser defines
|
93
93
|
# these values, based on ValidityState
|
94
94
|
badInput: "%{field} is the wrong type of data",
|
@@ -102,7 +102,7 @@
|
|
102
102
|
valueMissing: "%{field} is required",
|
103
103
|
general: "Form is invalid",
|
104
104
|
},
|
105
|
-
|
105
|
+
ss: { # short for "server-side", again not to have to type it out
|
106
106
|
# These are snake case, which is idiomatic for Ruby. The values
|
107
107
|
# here are all based on DataObjectValidator's behavior
|
108
108
|
required: "%{field} is required",
|
@@ -2,11 +2,11 @@
|
|
2
2
|
{
|
3
3
|
# en: must be the first entry, thus indicating this is the EN translations
|
4
4
|
en: {
|
5
|
-
cv: {
|
6
|
-
|
7
|
-
email_taken: "This email has been taken",
|
5
|
+
cv: {
|
6
|
+
cs: {
|
8
7
|
},
|
9
|
-
|
8
|
+
ss: {
|
9
|
+
email_taken: "This email has been taken",
|
10
10
|
},
|
11
11
|
},
|
12
12
|
pages: { # Page-specific messages - this key is relied-upon by Brut to exist
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -38,9 +38,9 @@ class DefaultLayout < Brut::FrontEnd::Layout
|
|
38
38
|
PageIdentifier(@page_name)
|
39
39
|
|
40
40
|
# Brut::FrontEnd::Components::I18nTranslations, which includes
|
41
|
-
# translations starting with cv.
|
41
|
+
# translations starting with cv.cs for use with client-side
|
42
42
|
# constraint violation messaging.
|
43
|
-
I18nTranslations("cv.
|
43
|
+
I18nTranslations("cv.cs")
|
44
44
|
# Brut::FrontEnd::Components::I18nTranslations, which includes
|
45
45
|
# translations for cv.this_field, which is used with client-side
|
46
46
|
# constraint violation messaging.
|
@@ -58,17 +58,14 @@ class DefaultLayout < Brut::FrontEnd::Layout
|
|
58
58
|
)
|
59
59
|
)
|
60
60
|
end
|
61
|
-
|
61
|
+
# Adds the page's name as a class name. You can use this for
|
62
|
+
# CSS if needed.
|
63
|
+
body(class: @page_name) do
|
62
64
|
# Render the <brut-tracing> element, which will send
|
63
65
|
# OpenTelemetry traces back to the server to be joined up with
|
64
66
|
# the server's traces.
|
65
67
|
brut_tracing url: "/__brut/instrumentation", show_warnings: true
|
66
|
-
#
|
67
|
-
# allow you to use CSS nested selectors to style this page
|
68
|
-
# only, if that is your CSS strategy.
|
69
|
-
main class: @page_name do
|
70
|
-
yield # Contents of the page are inserted here
|
71
|
-
end
|
68
|
+
yield # Contents of the page are inserted here
|
72
69
|
end
|
73
70
|
end
|
74
71
|
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "pathname"
|
4
|
+
require "yaml"
|
5
|
+
require "optparse"
|
6
|
+
|
7
|
+
option_parser = OptionParser.new do |opts|
|
8
|
+
opts.banner = "Usage: bin/startup-message\n\n Outputs a message about where the dev server is running\n\nENVIRONMENT VARIABLES\n\n PORT - the port configured for bin/run"
|
9
|
+
end
|
10
|
+
option_parser.parse!
|
11
|
+
|
12
|
+
docker_compose_file = Pathname.new(__FILE__).dirname / ".." / "docker-compose.dx.yml"
|
13
|
+
|
14
|
+
port_config = nil
|
15
|
+
error = nil
|
16
|
+
|
17
|
+
if docker_compose_file.exist?
|
18
|
+
docker_compose = YAML.load_file(docker_compose_file)
|
19
|
+
|
20
|
+
docker_port = begin
|
21
|
+
ENV.fetch("PORT")
|
22
|
+
rescue KeyError
|
23
|
+
$stderr.puts "ERROR: The PORT environment variable is not set."
|
24
|
+
$stderr.puts " Please set it to the port your app is running on."
|
25
|
+
exit 1
|
26
|
+
end
|
27
|
+
|
28
|
+
ports_config = docker_compose.dig("services", "app", "ports")
|
29
|
+
error = nil
|
30
|
+
if ports_config
|
31
|
+
port_config = ports_config.detect { |port_mapping|
|
32
|
+
host_port, container_port = port_mapping.split(":")
|
33
|
+
container_port.to_s == docker_port
|
34
|
+
}
|
35
|
+
if !port_config
|
36
|
+
error = "#{docker_compose_file} does not expose the port #{docker_port} for the 'app' service."
|
37
|
+
end
|
38
|
+
else
|
39
|
+
error = "#{docker_compose_file} does not contain a 'ports' section for the 'app' service."
|
40
|
+
end
|
41
|
+
else
|
42
|
+
error = "#{docker_compose_file} does not exist. This is assumed to be in placefor your dev environment"
|
43
|
+
end
|
44
|
+
if !error
|
45
|
+
sleep 2 # allow all other initial output from bin/dev to happen first
|
46
|
+
|
47
|
+
host_port = port_config.split(":")[0]
|
48
|
+
|
49
|
+
url = "http://localhost:#{host_port}"
|
50
|
+
|
51
|
+
$stdout.puts "Your app is now running at"
|
52
|
+
$stdout.puts
|
53
|
+
$stdout.puts " #{url}"
|
54
|
+
$stdout.puts
|
55
|
+
$stdout.flush # ensure this output happens immediately
|
56
|
+
else
|
57
|
+
$stderr.puts "WARN: #{$0} could not figure out what port the app is exposed on"
|
58
|
+
$stderr.puts
|
59
|
+
$stderr.puts " #{error}"
|
60
|
+
$stderr.puts
|
61
|
+
$stderr.puts " This won't stop your app from running, but it does mean"
|
62
|
+
$stderr.puts " there is some issue with your dev environment"
|
63
|
+
$stderr.flush # ensure this error output happens immediately
|
64
|
+
end
|
65
|
+
sleep
|
@@ -9,7 +9,7 @@ class GuestbookMessageHandler < AppHandler
|
|
9
9
|
# If client-side constraint violation checking was skipped,
|
10
10
|
# but there ARE such violations, the form will be able to check
|
11
11
|
# that server-side and return true for #constraint_violations?
|
12
|
-
if
|
12
|
+
if @form.valid?
|
13
13
|
save_message
|
14
14
|
end
|
15
15
|
|
@@ -21,10 +21,10 @@ RSpec.describe "You can leave a guestbook message" do
|
|
21
21
|
this_field = t("cv.this_field")
|
22
22
|
|
23
23
|
expect(name_error_message).to have_text(
|
24
|
-
t("cv.
|
24
|
+
t("cv.cs.valueMissing", field: this_field)
|
25
25
|
)
|
26
26
|
expect(message_error_message).to have_text(
|
27
|
-
t("cv.
|
27
|
+
t("cv.cs.valueMissing", field: this_field)
|
28
28
|
)
|
29
29
|
|
30
30
|
name_field = page.locator("form input[name='name']")
|
@@ -39,7 +39,7 @@ RSpec.describe "You can leave a guestbook message" do
|
|
39
39
|
flash = page.locator("[role='alert']")
|
40
40
|
expect(flash).to have_text(t(:guestbook_not_saved))
|
41
41
|
expect(message_error_message).to have_text(
|
42
|
-
t("cv.
|
42
|
+
t("cv.ss.not_enough_words", field: this_field)
|
43
43
|
)
|
44
44
|
|
45
45
|
message_field.fill("OK, fine, this site is awesome!")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mkbrut
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Copeland
|
@@ -100,14 +100,12 @@ files:
|
|
100
100
|
- templates/Base/app/src/app.rb.erb
|
101
101
|
- templates/Base/app/src/back_end/data_models/app_data_model.rb
|
102
102
|
- templates/Base/app/src/back_end/data_models/db.rb
|
103
|
-
- templates/Base/app/src/back_end/data_models/migrations/
|
103
|
+
- templates/Base/app/src/back_end/data_models/migrations/20240101130000_citext.rb
|
104
104
|
- templates/Base/app/src/back_end/data_models/seed/seed_data.rb
|
105
105
|
- templates/Base/app/src/front_end/components/app_component.rb
|
106
106
|
- templates/Base/app/src/front_end/components/custom_element_registration.rb.erb
|
107
|
-
- templates/Base/app/src/front_end/css/fonts.css
|
108
107
|
- templates/Base/app/src/front_end/css/index.css
|
109
108
|
- templates/Base/app/src/front_end/css/svgs.css
|
110
|
-
- templates/Base/app/src/front_end/fonts/monaspace-xenon.ttf
|
111
109
|
- templates/Base/app/src/front_end/forms/app_form.rb
|
112
110
|
- templates/Base/app/src/front_end/handlers/app_handler.rb
|
113
111
|
- templates/Base/app/src/front_end/images/LogoPylon.png
|
@@ -137,6 +135,7 @@ files:
|
|
137
135
|
- templates/Base/bin/run
|
138
136
|
- templates/Base/bin/scaffold
|
139
137
|
- templates/Base/bin/setup
|
138
|
+
- templates/Base/bin/startup-message
|
140
139
|
- templates/Base/bin/test
|
141
140
|
- templates/Base/bin/test-server
|
142
141
|
- templates/Base/bin/watch-and-build-assets
|
@@ -169,6 +168,8 @@ files:
|
|
169
168
|
- templates/segments/Demo/app/src/back_end/data_models/migrations/20250628194124_guestbook.rb
|
170
169
|
- templates/segments/Demo/app/src/front_end/components/flash_component.rb
|
171
170
|
- templates/segments/Demo/app/src/front_end/css/constraint-violations.css
|
171
|
+
- templates/segments/Demo/app/src/front_end/css/fonts.css
|
172
|
+
- templates/segments/Demo/app/src/front_end/fonts/monaspace-xenon.ttf
|
172
173
|
- templates/segments/Demo/app/src/front_end/forms/guestbook_message_form.rb
|
173
174
|
- templates/segments/Demo/app/src/front_end/handlers/guestbook_message_handler.rb
|
174
175
|
- templates/segments/Demo/app/src/front_end/pages/guestbook_page.rb
|
File without changes
|
File without changes
|
File without changes
|