rails_template_18f 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9272beadb19c4c9a6aa8f3da43cfbb06d7fbf23f75d0f4ec393dde3610f06157
4
- data.tar.gz: a3906d6bddb262a5bc46f5ed40e0bf64110bd396ac8e765185dcc808abe6c91a
3
+ metadata.gz: d71812f11d19dc0ed9960407de8d0b3c0755c0d6bb2ba64981af55f0add88657
4
+ data.tar.gz: 63d920adcc4e1e8acd83805d0edcaf5235f75150226dcd1ee8dcbef303407ba6
5
5
  SHA512:
6
- metadata.gz: 22926545b3fe7273d36c8fde0445d9865bab390cf2cc856c25bc33e50f1c1420944a30052a2e0ae8b730da4f17dee2c16165cc83a1e21eb1f0475afa0fd30b74
7
- data.tar.gz: fe7f4f8df14d4f2eac2a5882daf368cdf68a8c9f53a54550fe8d13f1b7a18767c50334e142a2784b92964478fe0e3a3e88c5986271b30e78d8e0743690c8a09a
6
+ metadata.gz: bca37870efffd0200b5fbf1b9491a1497cd1cdae7423d93f9c0eda1ff2cde4779932ea8f23be29f632e0310483c31724273d64d36a78d94e67a94c1cd903eb1a
7
+ data.tar.gz: 6d09c8fc4870c7ca1851fdd4c439ec1b6dd73d8e9551ca2b3d0be2d5da1a2f28e0cd9655ba219f25c2674face10ea0b8d5eeaadba6fd47705b04d516ac777d67
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.6.0] - 2022-06-07
4
+
5
+ - include USWDS 3.0 for new apps
6
+ - use postcss-minify instead of the sass gem for CSS minimization
7
+
8
+ ## [0.5.3] - 2022-06-06
9
+
10
+ - check that server started properly before running anything in `bin/with-server`
11
+ - add helper script for setting cloud.gov egress rules
12
+
13
+ ## [0.5.2] - 2022-03-24
14
+
15
+ - add extra branch test coverage to CloudGovConfig
16
+ - replace forked version of @csstools/postcss-sass with released version
17
+ - upgrade i18n-tasks gem to 1.0
18
+
3
19
  ## [0.5.1] - 2022-03-17
4
20
 
5
21
  - fix interaction between foreman and dotenv by disabling foreman's env loading
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_template_18f (0.5.1)
4
+ rails_template_18f (0.6.0)
5
5
  activesupport (~> 7.0.0)
6
6
  colorize (~> 0.8)
7
7
  railties (~> 7.0.0)
@@ -10,20 +10,20 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- actionpack (7.0.2.3)
14
- actionview (= 7.0.2.3)
15
- activesupport (= 7.0.2.3)
13
+ actionpack (7.0.3)
14
+ actionview (= 7.0.3)
15
+ activesupport (= 7.0.3)
16
16
  rack (~> 2.0, >= 2.2.0)
17
17
  rack-test (>= 0.6.3)
18
18
  rails-dom-testing (~> 2.0)
19
19
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
20
- actionview (7.0.2.3)
21
- activesupport (= 7.0.2.3)
20
+ actionview (7.0.3)
21
+ activesupport (= 7.0.3)
22
22
  builder (~> 3.1)
23
23
  erubi (~> 1.4)
24
24
  rails-dom-testing (~> 2.0)
25
25
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
26
- activesupport (7.0.2.3)
26
+ activesupport (7.0.3)
27
27
  concurrent-ruby (~> 1.0, >= 1.0.2)
28
28
  i18n (>= 1.6, < 2)
29
29
  minitest (>= 5.1)
@@ -36,26 +36,26 @@ GEM
36
36
  builder (3.2.4)
37
37
  byebug (11.1.3)
38
38
  colorize (0.8.1)
39
- concurrent-ruby (1.1.9)
39
+ concurrent-ruby (1.1.10)
40
40
  crass (1.0.6)
41
41
  diff-lcs (1.5.0)
42
42
  erubi (1.10.0)
43
43
  i18n (1.10.0)
44
44
  concurrent-ruby (~> 1.0)
45
- loofah (2.15.0)
45
+ loofah (2.18.0)
46
46
  crass (~> 1.0.2)
47
47
  nokogiri (>= 1.5.9)
48
48
  method_source (1.0.0)
49
49
  minitest (5.15.0)
50
- nokogiri (1.13.3-x86_64-darwin)
50
+ nokogiri (1.13.6-x86_64-darwin)
51
51
  racc (~> 1.4)
52
- nokogiri (1.13.3-x86_64-linux)
52
+ nokogiri (1.13.6-x86_64-linux)
53
53
  racc (~> 1.4)
54
- parallel (1.21.0)
55
- parser (3.1.1.0)
54
+ parallel (1.22.1)
55
+ parser (3.1.2.0)
56
56
  ast (~> 2.4.1)
57
57
  racc (1.6.0)
58
- rack (2.2.3)
58
+ rack (2.2.3.1)
59
59
  rack-test (1.1.0)
60
60
  rack (>= 1.0, < 3)
61
61
  rails-dom-testing (2.0.3)
@@ -63,16 +63,16 @@ GEM
63
63
  nokogiri (>= 1.6)
64
64
  rails-html-sanitizer (1.4.2)
65
65
  loofah (~> 2.3)
66
- railties (7.0.2.3)
67
- actionpack (= 7.0.2.3)
68
- activesupport (= 7.0.2.3)
66
+ railties (7.0.3)
67
+ actionpack (= 7.0.3)
68
+ activesupport (= 7.0.3)
69
69
  method_source
70
70
  rake (>= 12.2)
71
71
  thor (~> 1.0)
72
72
  zeitwerk (~> 2.5)
73
73
  rainbow (3.1.1)
74
74
  rake (13.0.6)
75
- regexp_parser (2.2.1)
75
+ regexp_parser (2.4.0)
76
76
  rexml (3.2.5)
77
77
  rspec (3.11.0)
78
78
  rspec-core (~> 3.11.0)
@@ -83,10 +83,10 @@ GEM
83
83
  rspec-expectations (3.11.0)
84
84
  diff-lcs (>= 1.2.0, < 2.0)
85
85
  rspec-support (~> 3.11.0)
86
- rspec-mocks (3.11.0)
86
+ rspec-mocks (3.11.1)
87
87
  diff-lcs (>= 1.2.0, < 2.0)
88
88
  rspec-support (~> 3.11.0)
89
- rspec-rails (5.1.1)
89
+ rspec-rails (5.1.2)
90
90
  actionpack (>= 5.2)
91
91
  activesupport (>= 5.2)
92
92
  railties (>= 5.2)
@@ -95,23 +95,23 @@ GEM
95
95
  rspec-mocks (~> 3.10)
96
96
  rspec-support (~> 3.10)
97
97
  rspec-support (3.11.0)
98
- rubocop (1.26.0)
98
+ rubocop (1.29.0)
99
99
  parallel (~> 1.10)
100
100
  parser (>= 3.1.0.0)
101
101
  rainbow (>= 2.2.2, < 4.0)
102
102
  regexp_parser (>= 1.8, < 3.0)
103
- rexml
104
- rubocop-ast (>= 1.16.0, < 2.0)
103
+ rexml (>= 3.2.5, < 4.0)
104
+ rubocop-ast (>= 1.17.0, < 2.0)
105
105
  ruby-progressbar (~> 1.7)
106
106
  unicode-display_width (>= 1.4.0, < 3.0)
107
- rubocop-ast (1.16.0)
107
+ rubocop-ast (1.17.0)
108
108
  parser (>= 3.1.1.0)
109
109
  rubocop-performance (1.13.3)
110
110
  rubocop (>= 1.7.0, < 2.0)
111
111
  rubocop-ast (>= 0.4.0)
112
112
  ruby-progressbar (1.11.0)
113
- standard (1.8.0)
114
- rubocop (= 1.26.0)
113
+ standard (1.12.0)
114
+ rubocop (= 1.29.0)
115
115
  rubocop-performance (= 1.13.3)
116
116
  thor (1.2.1)
117
117
  tzinfo (2.0.4)
@@ -121,6 +121,7 @@ GEM
121
121
 
122
122
  PLATFORMS
123
123
  x86_64-darwin-20
124
+ x86_64-darwin-21
124
125
  x86_64-linux
125
126
 
126
127
  DEPENDENCIES
@@ -132,4 +133,4 @@ DEPENDENCIES
132
133
  standard (~> 1.3)
133
134
 
134
135
  BUNDLED WITH
135
- 2.2.32
136
+ 2.3.15
@@ -37,7 +37,11 @@ RSpec.describe CloudGovConfig, type: :model do
37
37
  end
38
38
 
39
39
  it "returns nil for a missing path" do
40
- expect(subject.dig(:s3, :credentials, :other)).to be_nil
40
+ expect(subject.dig(:s3, :missing)).to be_nil
41
+ end
42
+
43
+ it "returns nil for a missing service" do
44
+ expect(subject.dig(:rds, :credentials)).to be_nil
41
45
  end
42
46
  end
43
47
  end
@@ -18,7 +18,7 @@ module RailsTemplate18f
18
18
  def install_gem
19
19
  return if gem_installed?("i18n-tasks")
20
20
  gem_group :development, :test do
21
- gem "i18n-tasks", "~> 0.9"
21
+ gem "i18n-tasks", "~> 1.0"
22
22
  end
23
23
  end
24
24
 
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env bash
2
+
3
+ org="<%= cloud_gov_organization %>"
4
+
5
+ usage="
6
+ $0: Set egress rules for given space
7
+
8
+ Usage:
9
+ $0 -h
10
+ $0 -s <SPACE NAME> [-o <ORG NAME>] [-p] [-t]
11
+
12
+ Options:
13
+ -h: show help and exit
14
+ -s <SPACE NAME>: configure the space to act on. Required
15
+ -o <ORG NAME>: configure the organization to act on. Default: $org
16
+ -p: Add the public egress rules
17
+ -t: Add the trusted egress rules
18
+
19
+ Notes:
20
+ * If -p or -t are not passed, the related security groups will be removed, if they were present
21
+ "
22
+
23
+ set -e
24
+
25
+ space=""
26
+ public=false
27
+ trusted=false
28
+
29
+ while getopts ":hs:o:pt" opt; do
30
+ case "$opt" in
31
+ s)
32
+ space=${OPTARG}
33
+ ;;
34
+ o)
35
+ org=${OPTARG}
36
+ ;;
37
+ p)
38
+ public=true
39
+ ;;
40
+ t)
41
+ trusted=true
42
+ ;;
43
+ h)
44
+ echo "$usage"
45
+ exit 0
46
+ ;;
47
+ esac
48
+ done
49
+
50
+ if [[ $space = "" ]]; then
51
+ echo "$usage"
52
+ exit 1
53
+ fi
54
+
55
+ if [[ $public = true ]]; then
56
+ cf bind-security-group public_networks_egress $org --space $space
57
+ else
58
+ cf unbind-security-group public_networks_egress $org $space
59
+ fi
60
+
61
+ if [[ $trusted = true ]]; then
62
+ cf bind-security-group trusted_local_networks_egress $org --space $space
63
+ else
64
+ cf unbind-security-group trusted_local_networks_egress $org $space
65
+ fi
66
+
67
+ echo "Done"
@@ -15,6 +15,7 @@ module RailsTemplate18f
15
15
 
16
16
  def install
17
17
  directory "terraform", mode: :preserve
18
+ chmod "terraform/set_space_egress.sh", 0o755
18
19
  chmod "terraform/bootstrap/run.sh", 0o755
19
20
  chmod "terraform/bootstrap/teardown_creds.sh", 0o755
20
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsTemplate18f
4
- VERSION = "0.5.1"
4
+ VERSION = "0.6.0"
5
5
  end
data/template.rb CHANGED
@@ -226,34 +226,33 @@ end
226
226
 
227
227
  # setup USWDS and asset pipeline
228
228
  copy_file "browserslistrc", ".browserslistrc" if webpack?
229
- uncomment_lines "Gemfile", "sassc-rails" # use sassc-rails for asset minification in prod
230
229
  after_bundle do
231
- js_startup = if webpack?
232
- "webpack --config webpack.config.js"
233
- else
234
- "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds"
235
- end
236
- insert_into_file "package.json", <<-EOJSON, before: /^\s+"dependencies"/
237
- "scripts": {
238
- "build": "#{js_startup}",
239
- "build:css": "postcss ./app/assets/stylesheets/application.postcss.css -o ./app/assets/builds/application.css"
240
- },
241
- EOJSON
230
+ run 'npm set-script build:css "postcss ./app/assets/stylesheets/application.postcss.scss -o ./app/assets/builds/application.css"'
231
+ # include verbose flag for dev postcss output
232
+ gsub_file "Procfile.dev", "yarn build:css --watch", "yarn build:css --verbose --watch"
242
233
  # Replace postcss-nesting with sass since USWDS uses sass
243
234
  run "yarn remove postcss-nesting"
244
- # include fork of @csstools/postcss-sass until that library is updated for postcss 8
245
- run "yarn add https://github.com/sinankeskin/postcss-sass"
246
- run "yarn add postcss-scss"
235
+ run "yarn add @csstools/postcss-sass postcss-scss postcss-minify"
247
236
  insert_into_file "postcss.config.js", " syntax: 'postcss-scss',\n", before: /^\s+plugins/
248
- gsub_file "postcss.config.js", "postcss-nesting", "@csstools/postcss-sass"
249
- run "yarn add uswds"
237
+ insert_into_file "package.json", <<-EOJSON, before: /^\s+\}$/
238
+ },
239
+ "resolutions": {
240
+ "@csstools/postcss-sass/@csstools/sass-import-resolve": "https://github.com/rahearn/sass-import-resolve"
241
+ EOJSON
242
+ gsub_file "postcss.config.js", "postcss-nesting'),", <<~EOJS.strip
243
+ @csstools/postcss-sass')({
244
+ includePaths: ['./node_modules/@uswds/uswds/packages'],
245
+ }),
246
+ EOJS
247
+ insert_into_file "postcss.config.js", " process.env.NODE_ENV === 'production' ? require('postcss-minify') : null,\n", before: /^\s+\],/
248
+ run "yarn add @uswds/uswds"
250
249
  appjs_file = "app/javascript/application.js"
251
- append_to_file appjs_file, "\nimport \"uswds\"\n"
250
+ append_to_file appjs_file, "\nimport \"@uswds/uswds\"\n"
252
251
  if hotwire?
253
252
  append_to_file appjs_file, <<~EOJS
254
253
 
255
254
  // make sure USWDS components are wired to their behavior after a Turbo navigation
256
- import components from "uswds/src/js/components"
255
+ import components from "@uswds/uswds/src/js/components"
257
256
  let initialLoad = true;
258
257
  document.addEventListener("turbo:load", () => {
259
258
  if (initialLoad) {
@@ -271,11 +270,12 @@ after_bundle do
271
270
  end
272
271
  directory "app/assets"
273
272
  append_to_file "app/assets/stylesheets/application.postcss.css", <<~EOCSS
274
- /* KNOWN ISSUE: only changes to application.postcss.css will trigger an automatic rebuild */
275
- /* restart your server or run `yarn build:css` when changing other files */
276
- @import "uswds-settings.scss";
277
- @import "../../../node_modules/uswds/dist/scss/uswds.scss";
273
+ @forward "uswds-settings.scss";
274
+ @forward "uswds-components.scss";
278
275
  EOCSS
276
+ inside "app/assets/stylesheets" do
277
+ File.rename("application.postcss.css", "application.postcss.scss")
278
+ end
279
279
  gsub_file "app/views/layouts/application.html.erb", "<html>", '<html lang="<%= I18n.locale %>">'
280
280
  gsub_file "app/views/layouts/application.html.erb", /^\s+<%= yield %>/, <<-EOHTML
281
281
  <%= render "application/usa_banner" %>
@@ -1,5 +1,6 @@
1
1
  // Glue to find USWDS images with the `image_tag` helper
2
2
 
3
- //= link uswds/dist/img/us_flag_small.png
4
- //= link uswds/dist/img/icon-dot-gov.svg
5
- //= link uswds/dist/img/icon-https.svg
3
+ //= link @uswds/uswds/dist/img/us_flag_small.png
4
+ //= link @uswds/uswds/dist/img/icon-dot-gov.svg
5
+ //= link @uswds/uswds/dist/img/icon-https.svg
6
+ //= link @uswds/uswds/dist/img/usa-icons/close.svg
@@ -0,0 +1,7 @@
1
+ @forward "uswds-global";
2
+ @forward "uswds-utilities";
3
+ @forward "uswds-typography";
4
+ @forward "usa-header";
5
+ @forward "usa-banner";
6
+ @forward "usa-section";
7
+ // add additional packages here as you use them
@@ -1,7 +1,10 @@
1
- // Point the asset pipline to the correct locations
2
- $theme-font-path: "uswds/dist/fonts";
3
- $theme-image-path: "uswds/dist/img";
1
+ @use "uswds-core" with (
2
+ // Point the asset pipline to the correct locations
3
+ $theme-font-path: "@uswds/uswds/dist/fonts",
4
+ $theme-image-path: "@uswds/uswds/dist/img",
4
5
 
5
- $theme-show-notifications: false;
6
+ $theme-show-notifications: false,
6
7
 
7
- // Put your USWDS Theme settings here
8
+ // Put your USWDS Theme settings here
9
+
10
+ );
@@ -1,3 +1,3 @@
1
- <div class="font-sans-lg padding-y-4 bg-secondary-darker text-white line-height-1 text-center">
1
+ <div class="font-sans-lg padding-y-4 bg-secondary-darker text-white line-height-heading-1 text-center">
2
2
  <%= t('shared.header.demo_banner') %>
3
- </div>
3
+ </div>
@@ -11,7 +11,7 @@
11
11
  </div>
12
12
  <nav aria-label="<%= t('shared.header.primary') %>" class="usa-nav">
13
13
  <button class="usa-nav__close">
14
- <%= image_tag "uswds/dist/img/usa-icons/close.svg", role: "img", alt: t('shared.header.close') %>
14
+ <%= image_tag "@uswds/uswds/dist/img/usa-icons/close.svg", role: "img", alt: t('shared.header.close') %>
15
15
  </button>
16
16
  <ul class="usa-nav__primary usa-accordion">
17
17
  <% I18n.available_locales.each do |l| %>
@@ -5,7 +5,7 @@
5
5
  <header class="usa-banner__header">
6
6
  <div class="usa-banner__inner">
7
7
  <div class="grid-col-auto">
8
- <%= image_tag "uswds/dist/img/us_flag_small.png", alt: t('shared.banner.us_flag'), class: "usa-banner__header-flag" %>
8
+ <%= image_tag "@uswds/uswds/dist/img/us_flag_small.png", alt: t('shared.banner.us_flag'), class: "usa-banner__header-flag" %>
9
9
  </div>
10
10
  <div class="grid-col-fill tablet:grid-col-auto">
11
11
  <p class="usa-banner__header-text">
@@ -30,14 +30,14 @@
30
30
  <% end %>
31
31
  <div class="grid-row grid-gap-lg">
32
32
  <div class="usa-banner__guidance tablet:grid-col-6">
33
- <%= image_tag "uswds/dist/img/icon-dot-gov.svg", role: "img", "aria-hidden": true, class: "usa-banner__icon usa-media-block__img" %>
33
+ <%= image_tag "@uswds/uswds/dist/img/icon-dot-gov.svg", role: "img", "aria-hidden": true, class: "usa-banner__icon usa-media-block__img" %>
34
34
  <div class="usa-media-block__body">
35
35
  <strong><%= t('shared.banner.gov_heading') %></strong>
36
36
  <br> <%= t('shared.banner.gov_description_html') %>
37
37
  </div>
38
38
  </div>
39
39
  <div class="usa-banner__guidance tablet:grid-col-6">
40
- <%= image_tag "uswds/dist/img/icon-https.svg", role: "img", "aria-hidden": true, class: "usa-banner__icon usa-media-block__img" %>
40
+ <%= image_tag "@uswds/uswds/dist/img/icon-https.svg", role: "img", "aria-hidden": true, class: "usa-banner__icon usa-media-block__img" %>
41
41
  <div class="usa-media-block__body">
42
42
  <p>
43
43
  <strong><%= t('shared.banner.secure_heading') %></strong>
@@ -22,13 +22,15 @@ bundle exec rails server &
22
22
  server_pid=$!
23
23
 
24
24
  dockerize -wait http://localhost:3000 -timeout 1m
25
-
26
- $@
27
25
  exit_status=$?
28
26
 
27
+ if [[ $exit_status -eq 0 ]]; then
28
+ $@
29
+ exit_status=$?
30
+ fi
29
31
 
30
32
  # shut down the server and cleanup after ourselves
31
- bundle exec rake assets:clobber
32
33
  kill $server_pid
34
+ bundle exec rake assets:clobber
33
35
 
34
36
  exit $exit_status
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_template_18f
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Ahearn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-17 00:00:00.000000000 Z
11
+ date: 2022-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -180,6 +180,7 @@ files:
180
180
  - lib/generators/rails_template18f/terraform/templates/terraform/production/main.tf.tt
181
181
  - lib/generators/rails_template18f/terraform/templates/terraform/production/providers.tf.tt
182
182
  - lib/generators/rails_template18f/terraform/templates/terraform/production/variables.tf
183
+ - lib/generators/rails_template18f/terraform/templates/terraform/set_space_egress.sh.tt
183
184
  - lib/generators/rails_template18f/terraform/templates/terraform/shared/clamav/main.tf.tt
184
185
  - lib/generators/rails_template18f/terraform/templates/terraform/shared/clamav/providers.tf
185
186
  - lib/generators/rails_template18f/terraform/templates/terraform/shared/clamav/variables.tf
@@ -213,6 +214,7 @@ files:
213
214
  - templates/Brewfile
214
215
  - templates/README.md.tt
215
216
  - templates/app/assets/images/uswds.js
217
+ - templates/app/assets/stylesheets/uswds-components.scss
216
218
  - templates/app/assets/stylesheets/uswds-settings.scss
217
219
  - templates/app/views/application/_banner_lock_icon.html.erb
218
220
  - templates/app/views/application/_demo_site_banner.html.erb