rails_template_18f 0.4.1 → 0.5.2

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: ccf6b140f15f85229d716db5c0b51db5b88b41172000f89a613bdc09975c61f7
4
- data.tar.gz: 6a3a14efb4cb1373236a53260cf06b161375346d37097563ef65197862e538a8
3
+ metadata.gz: 2081ea2fe971ba6cdd3af16c00a9e91146fea1e489b48118543b1c95b075f3d9
4
+ data.tar.gz: 6f7c93f8a5429e2a63fb560e79afc34c940a652168c3cba0e2d548ad61e0c9ca
5
5
  SHA512:
6
- metadata.gz: 8fb2a0c4a4adf9fa72ea8078a6b1001671f2e562ece7b3d74b64ffa39c113b96c280f64a3eacc0233b67c8bc2b6ec160b2867c78e49363100d1cdc7055352516
7
- data.tar.gz: 48e96e771a2fb4dd8ca03719f923ae2749b6b212577c88c8e72a3e2788d71b1a6a6bda768611509aa2001e129a7a29c833ad99a93433bf954c46552671d40c2b
6
+ metadata.gz: dd118690c1537a3de6db28e7478a492617540ba5d8b2322d80506d5800adbe7997ee78b08098cfb36ace459612f72ae2310bd8ad77a068e5fb3e11fbf6c39f61
7
+ data.tar.gz: 406ef4a7f114415d3059be3d1713015af635a2dd57e76355d5fb685b74d734d90c835bcec860a4fdd980df512d29b4d413b3ec3733efd46e4adf1a3d2414bdfc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.5.2] - 2022-03-24
4
+
5
+ - add extra branch test coverage to CloudGovConfig
6
+ - replace forked version of @csstools/postcss-sass with released version
7
+ - upgrade i18n-tasks gem to 1.0
8
+
9
+ ## [0.5.1] - 2022-03-17
10
+
11
+ - fix interaction between foreman and dotenv by disabling foreman's env loading
12
+
13
+ ## [0.5.0] - 2022-03-04
14
+
15
+ - use Brewfile for installing homebrew-based dependencies
16
+ - move test site banner to the _usa_banner.html.erb partial
17
+ - use dockerize within bin/with-server to wait for rails to start
18
+
3
19
  ## [0.4.1] - 2022-02-25
4
20
 
5
21
  - update gem dependencies
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_template_18f (0.4.1)
4
+ rails_template_18f (0.5.2)
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.2)
14
- actionview (= 7.0.2.2)
15
- activesupport (= 7.0.2.2)
13
+ actionpack (7.0.2.3)
14
+ actionview (= 7.0.2.3)
15
+ activesupport (= 7.0.2.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.2)
21
- activesupport (= 7.0.2.2)
20
+ actionview (7.0.2.3)
21
+ activesupport (= 7.0.2.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.2)
26
+ activesupport (7.0.2.3)
27
27
  concurrent-ruby (~> 1.0, >= 1.0.2)
28
28
  i18n (>= 1.6, < 2)
29
29
  minitest (>= 5.1)
@@ -40,19 +40,19 @@ GEM
40
40
  crass (1.0.6)
41
41
  diff-lcs (1.5.0)
42
42
  erubi (1.10.0)
43
- i18n (1.9.1)
43
+ i18n (1.10.0)
44
44
  concurrent-ruby (~> 1.0)
45
- loofah (2.14.0)
45
+ loofah (2.15.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.1-x86_64-darwin)
50
+ nokogiri (1.13.3-x86_64-darwin)
51
51
  racc (~> 1.4)
52
- nokogiri (1.13.1-x86_64-linux)
52
+ nokogiri (1.13.3-x86_64-linux)
53
53
  racc (~> 1.4)
54
54
  parallel (1.21.0)
55
- parser (3.1.0.0)
55
+ parser (3.1.1.0)
56
56
  ast (~> 2.4.1)
57
57
  racc (1.6.0)
58
58
  rack (2.2.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.2)
67
- actionpack (= 7.0.2.2)
68
- activesupport (= 7.0.2.2)
66
+ railties (7.0.2.3)
67
+ actionpack (= 7.0.2.3)
68
+ activesupport (= 7.0.2.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.0)
75
+ regexp_parser (2.2.1)
76
76
  rexml (3.2.5)
77
77
  rspec (3.11.0)
78
78
  rspec-core (~> 3.11.0)
@@ -86,7 +86,7 @@ GEM
86
86
  rspec-mocks (3.11.0)
87
87
  diff-lcs (>= 1.2.0, < 2.0)
88
88
  rspec-support (~> 3.11.0)
89
- rspec-rails (5.1.0)
89
+ rspec-rails (5.1.1)
90
90
  actionpack (>= 5.2)
91
91
  activesupport (>= 5.2)
92
92
  railties (>= 5.2)
@@ -95,24 +95,24 @@ GEM
95
95
  rspec-mocks (~> 3.10)
96
96
  rspec-support (~> 3.10)
97
97
  rspec-support (3.11.0)
98
- rubocop (1.25.1)
98
+ rubocop (1.26.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
103
  rexml
104
- rubocop-ast (>= 1.15.1, < 2.0)
104
+ rubocop-ast (>= 1.16.0, < 2.0)
105
105
  ruby-progressbar (~> 1.7)
106
106
  unicode-display_width (>= 1.4.0, < 3.0)
107
- rubocop-ast (1.15.1)
108
- parser (>= 3.0.1.1)
109
- rubocop-performance (1.13.2)
107
+ rubocop-ast (1.16.0)
108
+ parser (>= 3.1.1.0)
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.7.1)
114
- rubocop (= 1.25.1)
115
- rubocop-performance (= 1.13.2)
113
+ standard (1.8.0)
114
+ rubocop (= 1.26.0)
115
+ rubocop-performance (= 1.13.3)
116
116
  thor (1.2.1)
117
117
  tzinfo (2.0.4)
118
118
  concurrent-ruby (~> 1.0)
@@ -61,7 +61,6 @@ module RailsTemplate18f
61
61
  def configure_clamav_env_var
62
62
  append_to_file ".env", <<~EOM
63
63
 
64
-
65
64
  # CLAMAV_API_URL tells FileScanJob where to send files for virus scans
66
65
  CLAMAV_API_URL=https://localhost:9443
67
66
  EOM
@@ -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
 
@@ -18,6 +18,15 @@ module RailsTemplate18f
18
18
  bundle_install
19
19
  end
20
20
 
21
+ def install_redis
22
+ append_to_file "Brewfile", <<~EOB
23
+
24
+ # queue for sidekiq jobs
25
+ brew "redis"
26
+ EOB
27
+ insert_into_file "README.md", indent("* [redis]()\n"), after: /\* Install homebrew dependencies: `brew bundle`\n/
28
+ end
29
+
21
30
  def configure_server_runner
22
31
  append_to_file "Procfile.dev", "worker: bundle exec sidekiq\n"
23
32
  insert_into_file "manifest.yml", indent(<<~EOYAML), after: /processes:$\n/
@@ -2,7 +2,7 @@
2
2
 
3
3
  This directory holds the terraform modules for maintaining your complete persistent infrastructure.
4
4
 
5
- Prerequisite: install the `jq` JSON processor: `brew install jq`
5
+ Prerequisite: install the `jq` JSON processor: `brew bundle` or `brew install jq`
6
6
 
7
7
  ## Initial setup
8
8
 
@@ -19,6 +19,15 @@ module RailsTemplate18f
19
19
  chmod "terraform/bootstrap/teardown_creds.sh", 0o755
20
20
  end
21
21
 
22
+ def install_jq
23
+ append_to_file "Brewfile", <<~EOB
24
+
25
+ # used in terraform/create_space_deployer.sh
26
+ brew "jq"
27
+ EOB
28
+ insert_into_file "README.md", indent("* [jq](https://stedolan.github.io/jq/)\n"), after: /\* Install homebrew dependencies: `brew bundle`\n/
29
+ end
30
+
22
31
  def ignore_files
23
32
  unless skip_git?
24
33
  append_to_file ".gitignore", <<~EOM
@@ -34,7 +43,7 @@ module RailsTemplate18f
34
43
  end
35
44
 
36
45
  def update_readme
37
- gsub_file "README.md", /^(### Automatic linting)/, '\1 and terraform formatting'
46
+ gsub_file "README.md", /^(### Automatic linting)\s*$/, '\1 and terraform formatting'
38
47
  gsub_file "README.md", /(ruby linting) (on every)/, '\1 and terraform formatting \2'
39
48
  gsub_file "README.md", /^Before the first deploy only.*$/, "Follow the instructions in `terraform/README.md` to create the supporting services."
40
49
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsTemplate18f
4
- VERSION = "0.4.1"
4
+ VERSION = "0.5.2"
5
5
  end
data/template.rb CHANGED
@@ -87,6 +87,13 @@ register_announcement("Documentation", <<~EOM)
87
87
  * Review any TBD sections of the README and update where appropriate.
88
88
  EOM
89
89
 
90
+ # ensure dependencies are installed
91
+ copy_file "Brewfile"
92
+ insert_into_file "bin/setup", <<EOSETUP, after: /Add necessary setup steps to this file.\n/
93
+ puts "== Installing homebrew dependencies =="
94
+ system("brew bundle --no-lock")
95
+ EOSETUP
96
+
90
97
  # setup nvmrc
91
98
  file ".nvmrc", @node_version
92
99
 
@@ -185,6 +192,12 @@ if ENV["RT_DEV"] == "true"
185
192
  else
186
193
  gem "rails_template_18f", group: :development
187
194
  end
195
+ after_bundle do
196
+ gsub_file "bin/dev", /foreman start -f (.*)$/, <<~'EOM'
197
+ # pass /dev/null for the environment file to prevent weird interactions between foreman and dotenv
198
+ foreman start -e /dev/null -f \1
199
+ EOM
200
+ end
188
201
 
189
202
  copy_file "lib/tasks/scanning.rake"
190
203
  copy_file "env", ".env"
@@ -196,6 +209,9 @@ unless skip_git?
196
209
  end
197
210
  append_to_file ".gitignore", <<~EOM
198
211
 
212
+ # Ignore Brewfile debug info
213
+ Brewfile.lock.json
214
+
199
215
  # Ignore local dotenv overrides
200
216
  .env*.local
201
217
 
@@ -223,10 +239,11 @@ after_bundle do
223
239
  "build:css": "postcss ./app/assets/stylesheets/application.postcss.css -o ./app/assets/builds/application.css"
224
240
  },
225
241
  EOJSON
242
+ # include verbose flag for dev postcss output
243
+ gsub_file "Procfile.dev", "yarn build:css --watch", "yarn build:css --verbose --watch"
226
244
  # Replace postcss-nesting with sass since USWDS uses sass
227
245
  run "yarn remove postcss-nesting"
228
- # include fork of @csstools/postcss-sass until that library is updated for postcss 8
229
- run "yarn add https://github.com/sinankeskin/postcss-sass"
246
+ run "yarn add @csstools/postcss-sass"
230
247
  run "yarn add postcss-scss"
231
248
  insert_into_file "postcss.config.js", " syntax: 'postcss-scss',\n", before: /^\s+plugins/
232
249
  gsub_file "postcss.config.js", "postcss-nesting", "@csstools/postcss-sass"
@@ -255,8 +272,6 @@ after_bundle do
255
272
  end
256
273
  directory "app/assets"
257
274
  append_to_file "app/assets/stylesheets/application.postcss.css", <<~EOCSS
258
- /* KNOWN ISSUE: only changes to application.postcss.css will trigger an automatic rebuild */
259
- /* restart your server or run `yarn build:css` when changing other files */
260
275
  @import "uswds-settings.scss";
261
276
  @import "../../../node_modules/uswds/dist/scss/uswds.scss";
262
277
  EOCSS
@@ -0,0 +1,14 @@
1
+ # Brewfile
2
+ # add any dependencies that must be installed from homebrew here
3
+
4
+ # cloud.gov RDS is on postgres 12
5
+ brew "postgresql@12", link: true
6
+
7
+ # used in bin/with-server script
8
+ brew "dockerize"
9
+
10
+ # helper scripts for creating new ADRs
11
+ brew "adr-tools"
12
+
13
+ # chromedriver for integration tests
14
+ cask "chromedriver"
@@ -12,16 +12,15 @@ guide for an introduction to the framework.
12
12
 
13
13
  * Install Ruby <%= @ruby_version %>
14
14
  * Install NodeJS <%= @node_version %>
15
- * Install PostgreSQL: `brew install postgresql`
16
- * Add postgres to your PATH if it wasn't done automatically
17
- `echo 'export PATH="/usr/local/opt/postgresql/bin:$PATH"' >> ~/.zshrc`
18
- * Start the server
19
- `brew services start postgresql`
15
+ * Install homebrew dependencies: `brew bundle`
16
+ * [PostgreSQL](https://www.postgresql.org/)
17
+ * [Dockerize](https://github.com/jwilder/dockerize)
18
+ * [ADR Tools](https://github.com/npryce/adr-tools)
19
+ * [Chromedriver](https://sites.google.com/chromium.org/driver/)
20
+ * Chromedriver must be allowed to run. You can either do that by:
21
+ * The command line: `xattr -d com.apple.quarantine $(which chromedriver)` (this is the only option if you are on Big Sur)
22
+ * Manually: clicking "allow" when you run the integration tests for the first time and a dialogue opens up
20
23
  * Install Ruby dependencies: `bundle install`
21
- * Install chromedriver for integration tests: `brew install --cask chromedriver`
22
- * Chromedriver must be allowed to run. You can either do that by:
23
- * The command line: `xattr -d com.apple.quarantine $(which chromedriver)` (this is the only option if you are on Big Sur)
24
- * Manually: clicking "allow" when you run the integration tests for the first time and a dialogue opens up
25
24
  * Install JS dependencies: `yarn install`
26
25
  * Create database: `bundle exec rake db:create`
27
26
  * Run migrations: `bundle exec rake db:migrate`
@@ -32,9 +31,9 @@ guide for an introduction to the framework.
32
31
 
33
32
  Environment variables can be set in development using the [dotenv](https://github.com/bkeepers/dotenv) gem.
34
33
 
35
- Consistent but sensitive credentials should be added to `config/credentials.yml.env` by using `$ rails credentials:edit`
34
+ Consistent but sensitive credentials should be added to `config/credentials.yml.enc` by using `$ rails credentials:edit`
36
35
 
37
- Production credentials should be added to `config/credentials/production.yml.env` by using `$ rails credentials:edit --environment production`
36
+ Production credentials should be added to `config/credentials/production.yml.enc` by using `$ rails credentials:edit --environment production`
38
37
 
39
38
  Any changes to variables in `.env` that should not be checked into git should be set
40
39
  in `.env.local`.
@@ -145,7 +144,7 @@ Configuration that changes from staging to production, but is public, should be
145
144
  Architectural Decision Records (ADR) are stored in `doc/adr`
146
145
  To create a new ADR, first install [ADR-tools](https://github.com/npryce/adr-tools) if you don't
147
146
  already have it installed.
148
- * `brew install adr-tools`
147
+ * `brew bundle` or `brew install adr-tools`
149
148
 
150
149
  Then create the ADR:
151
150
  * `adr new Title Of Architectural Decision`
@@ -1,6 +1,5 @@
1
1
  <div class="usa-overlay"></div>
2
2
  <header class="usa-header usa-header--basic">
3
- <%= render "application/demo_site_banner" if Rails.configuration.x.show_demo_banner %>
4
3
  <div class="usa-nav-container">
5
4
  <div class="usa-navbar">
6
5
  <div class="usa-logo">
@@ -49,3 +49,5 @@
49
49
  </div>
50
50
  </div>
51
51
  </section>
52
+
53
+ <%= render "application/demo_site_banner" if Rails.configuration.x.show_demo_banner %>
@@ -20,9 +20,8 @@ bundle exec rake assets:precompile
20
20
  # run the server
21
21
  bundle exec rails server &
22
22
  server_pid=$!
23
- # pause to ensure the server has started
24
- sleep 5
25
23
 
24
+ dockerize -wait http://localhost:3000 -timeout 1m
26
25
 
27
26
  $@
28
27
  exit_status=$?
data/templates/env CHANGED
@@ -7,4 +7,4 @@
7
7
  ###################################################################################################
8
8
 
9
9
  # SHOW_DEMO_BANNER controls whether to show the TEST SITE banner in Rails.env.development
10
- SHOW_DEMO_BANNER=false
10
+ SHOW_DEMO_BANNER=false
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.4.1
4
+ version: 0.5.2
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-02-25 00:00:00.000000000 Z
11
+ date: 2022-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -210,6 +210,7 @@ files:
210
210
  - railsrc
211
211
  - railsrc-hotwire
212
212
  - template.rb
213
+ - templates/Brewfile
213
214
  - templates/README.md.tt
214
215
  - templates/app/assets/images/uswds.js
215
216
  - templates/app/assets/stylesheets/uswds-settings.scss