rails_template_18f 0.7.2 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/Gemfile.lock +92 -70
  4. data/README.md +60 -63
  5. data/lib/generators/rails_template18f/active_storage/active_storage_generator.rb +0 -43
  6. data/lib/generators/rails_template18f/circleci/templates/circleci/config.yml.tt +17 -0
  7. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/dependency-scans.yml +17 -0
  8. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-production.yml.tt +3 -1
  9. data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-staging.yml.tt +3 -1
  10. data/lib/generators/rails_template18f/rails_erd/rails_erd_generator.rb +49 -0
  11. data/lib/generators/rails_template18f/rails_erd/templates/erdconfig +9 -0
  12. data/lib/generators/rails_template18f/terraform/templates/terraform/README.md.tt +3 -3
  13. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/main.tf.tt +1 -1
  14. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/run.sh.tt +1 -1
  15. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/teardown_creds.sh.tt +1 -1
  16. data/lib/generators/rails_template18f/terraform/templates/terraform/production/main.tf.tt +11 -6
  17. data/lib/generators/rails_template18f/terraform/templates/terraform/staging/main.tf.tt +9 -5
  18. data/lib/generators/rails_template18f/terraform/terraform_generator.rb +0 -10
  19. data/lib/rails_template18f/generators/pipeline_options.rb +13 -4
  20. data/lib/rails_template18f/version.rb +1 -1
  21. data/template.rb +21 -2
  22. data/templates/Brewfile +3 -0
  23. data/templates/README.md.tt +1 -0
  24. data/templates/bin/ops/create_service_account.sh.tt +72 -0
  25. data/templates/bin/ops/destroy_service_account.sh.tt +53 -0
  26. data/{lib/generators/rails_template18f/terraform/templates/terraform → templates/bin/ops}/set_space_egress.sh.tt +1 -1
  27. data/templates/config/environments/ci.rb +1 -1
  28. data/templates/config/environments/staging.rb +1 -1
  29. data/templates/doc/compliance/README.md +7 -2
  30. data/templates/doc/compliance/TODO.md +37 -0
  31. metadata +9 -22
  32. data/lib/generators/rails_template18f/terraform/templates/terraform/create_space_deployer.sh +0 -33
  33. data/lib/generators/rails_template18f/terraform/templates/terraform/destroy_space_deployer.sh +0 -19
  34. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/clamav/main.tf.tt +0 -50
  35. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/clamav/providers.tf +0 -16
  36. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/clamav/variables.tf +0 -47
  37. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/database/main.tf.tt +0 -23
  38. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/database/providers.tf +0 -16
  39. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/database/variables.tf +0 -42
  40. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/domain/main.tf.tt +0 -46
  41. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/domain/providers.tf +0 -16
  42. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/domain/variables.tf +0 -47
  43. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/redis/main.tf.tt +0 -23
  44. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/redis/providers.tf +0 -16
  45. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/redis/variables.tf +0 -42
  46. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/s3/main.tf +0 -27
  47. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/s3/providers.tf +0 -16
  48. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/s3/variables.tf +0 -43
  49. data/templates/doc/compliance/apps/data.logical.md +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9125789bccf3587593670a5046e6a019c8e65265cca40e8a9434f77b1a69cc7a
4
- data.tar.gz: 72b8d7345799e1d26eef6506b035e80f1de94ea2679d6272f9ad525dbac5870a
3
+ metadata.gz: 8d21603b715f565d239901a62f7350b2b607f8ad264b2e23910d5c1203419038
4
+ data.tar.gz: 20b9516691e7819b443d06fb05e141992cf4f8e179363b43ad11d87918319929
5
5
  SHA512:
6
- metadata.gz: 60c7961c07e40710113c4608162e3888335b0d86d8270d82b56bf7d16d607454dad73b7f4626fba87804d251358e744d5a307967562537b9d326f90d77a4630e
7
- data.tar.gz: 3bd8def94a8f3f576b0f03622e1cf1461e6e79f00d4e3f3e17bd52bad4f91a59e365d3edcbc548be0ceeb6181271446b61a41ea0956832e64ad740c031ade812
6
+ metadata.gz: 6f1350e3598ae74b8dcb039ec6c85b7dd124e2b42e3563c5edb5e72a3c061c33cce3bfe43274d7c3fa07bb8f9cd0462df7fa40926ffc90fe913c043edeb86c28
7
+ data.tar.gz: d9bf899901b7cf2451d77dbd0eb50ddd016acc874d5144cee525d2b14df9bcb93887094e4ca1fa5a4b95a38ecb75ea622ffbfd9541e05edf292197016f909f3b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.8.1] - 2024-06-04
4
+
5
+ - fix error when compliance-template fork question is left blank
6
+ - fix deprecated and then removed use of `npm set-scripts`
7
+ - add a doc/compliance/TODO.md file with tasks that can sometimes be useful on the ATO journey.
8
+ - generalize create_space_deployer.sh to create_service_account.sh to make it easier to create SpaceAuditor users
9
+ - move support scripts set_space_egress.sh, create_service_account.sh, and destroy_service_account.sh out of terraform generator
10
+
11
+ ## [0.8.0] - 2022-07-14
12
+
13
+ - use rails-erd gem for auto-updating logical data models
14
+ - use cleaner multi-line strings for GitHub Actions deploy steps
15
+ - generate an SBOM for ruby dependencies in either Github Actions or CircleCI using cyclonedx-ruby
16
+
3
17
  ## [0.7.2] - 2022-07-07
4
18
 
5
19
  - update default node version in github actions to 16.15
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_template_18f (0.7.2)
4
+ rails_template_18f (0.8.1)
5
5
  activesupport (~> 7.0.0)
6
6
  colorize (~> 0.8)
7
7
  railties (~> 7.0.0)
@@ -10,25 +10,25 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- actionpack (7.0.3)
14
- actionview (= 7.0.3)
15
- activesupport (= 7.0.3)
16
- rack (~> 2.0, >= 2.2.0)
13
+ actionpack (7.0.8.4)
14
+ actionview (= 7.0.8.4)
15
+ activesupport (= 7.0.8.4)
16
+ rack (~> 2.0, >= 2.2.4)
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.3)
21
- activesupport (= 7.0.3)
20
+ actionview (7.0.8.4)
21
+ activesupport (= 7.0.8.4)
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.3)
26
+ activesupport (7.0.8.4)
27
27
  concurrent-ruby (~> 1.0, >= 1.0.2)
28
28
  i18n (>= 1.6, < 2)
29
29
  minitest (>= 5.1)
30
30
  tzinfo (~> 2.0)
31
- ammeter (1.1.5)
31
+ ammeter (1.1.7)
32
32
  activesupport (>= 3.0)
33
33
  railties (>= 3.0)
34
34
  rspec-rails (>= 2.2)
@@ -36,90 +36,112 @@ GEM
36
36
  builder (3.2.4)
37
37
  byebug (11.1.3)
38
38
  colorize (0.8.1)
39
- concurrent-ruby (1.1.10)
39
+ concurrent-ruby (1.3.1)
40
40
  crass (1.0.6)
41
- diff-lcs (1.5.0)
42
- erubi (1.10.0)
43
- i18n (1.10.0)
41
+ diff-lcs (1.5.1)
42
+ erubi (1.12.0)
43
+ i18n (1.14.5)
44
44
  concurrent-ruby (~> 1.0)
45
- loofah (2.18.0)
45
+ json (2.7.2)
46
+ language_server-protocol (3.17.0.3)
47
+ lint_roller (1.1.0)
48
+ loofah (2.22.0)
46
49
  crass (~> 1.0.2)
47
- nokogiri (>= 1.5.9)
48
- method_source (1.0.0)
49
- minitest (5.16.2)
50
- nokogiri (1.13.6-x86_64-darwin)
50
+ nokogiri (>= 1.12.0)
51
+ method_source (1.1.0)
52
+ minitest (5.23.1)
53
+ nokogiri (1.16.5-arm64-darwin)
51
54
  racc (~> 1.4)
52
- nokogiri (1.13.6-x86_64-linux)
55
+ nokogiri (1.16.5-x86_64-darwin)
53
56
  racc (~> 1.4)
54
- parallel (1.22.1)
55
- parser (3.1.2.0)
57
+ nokogiri (1.16.5-x86_64-linux)
58
+ racc (~> 1.4)
59
+ parallel (1.24.0)
60
+ parser (3.3.2.0)
56
61
  ast (~> 2.4.1)
57
- racc (1.6.0)
58
- rack (2.2.4)
59
- rack-test (2.0.2)
62
+ racc
63
+ racc (1.8.0)
64
+ rack (2.2.9)
65
+ rack-test (2.1.0)
60
66
  rack (>= 1.3)
61
- rails-dom-testing (2.0.3)
62
- activesupport (>= 4.2.0)
67
+ rails-dom-testing (2.2.0)
68
+ activesupport (>= 5.0.0)
69
+ minitest
63
70
  nokogiri (>= 1.6)
64
- rails-html-sanitizer (1.4.3)
65
- loofah (~> 2.3)
66
- railties (7.0.3)
67
- actionpack (= 7.0.3)
68
- activesupport (= 7.0.3)
71
+ rails-html-sanitizer (1.6.0)
72
+ loofah (~> 2.21)
73
+ nokogiri (~> 1.14)
74
+ railties (7.0.8.4)
75
+ actionpack (= 7.0.8.4)
76
+ activesupport (= 7.0.8.4)
69
77
  method_source
70
78
  rake (>= 12.2)
71
79
  thor (~> 1.0)
72
80
  zeitwerk (~> 2.5)
73
81
  rainbow (3.1.1)
74
- rake (13.0.6)
75
- regexp_parser (2.5.0)
76
- rexml (3.2.5)
77
- rspec (3.11.0)
78
- rspec-core (~> 3.11.0)
79
- rspec-expectations (~> 3.11.0)
80
- rspec-mocks (~> 3.11.0)
81
- rspec-core (3.11.0)
82
- rspec-support (~> 3.11.0)
83
- rspec-expectations (3.11.0)
82
+ rake (13.2.1)
83
+ regexp_parser (2.9.2)
84
+ rexml (3.2.8)
85
+ strscan (>= 3.0.9)
86
+ rspec (3.13.0)
87
+ rspec-core (~> 3.13.0)
88
+ rspec-expectations (~> 3.13.0)
89
+ rspec-mocks (~> 3.13.0)
90
+ rspec-core (3.13.0)
91
+ rspec-support (~> 3.13.0)
92
+ rspec-expectations (3.13.0)
84
93
  diff-lcs (>= 1.2.0, < 2.0)
85
- rspec-support (~> 3.11.0)
86
- rspec-mocks (3.11.1)
94
+ rspec-support (~> 3.13.0)
95
+ rspec-mocks (3.13.1)
87
96
  diff-lcs (>= 1.2.0, < 2.0)
88
- rspec-support (~> 3.11.0)
89
- rspec-rails (5.1.2)
90
- actionpack (>= 5.2)
91
- activesupport (>= 5.2)
92
- railties (>= 5.2)
93
- rspec-core (~> 3.10)
94
- rspec-expectations (~> 3.10)
95
- rspec-mocks (~> 3.10)
96
- rspec-support (~> 3.10)
97
- rspec-support (3.11.0)
98
- rubocop (1.29.1)
97
+ rspec-support (~> 3.13.0)
98
+ rspec-rails (6.1.2)
99
+ actionpack (>= 6.1)
100
+ activesupport (>= 6.1)
101
+ railties (>= 6.1)
102
+ rspec-core (~> 3.13)
103
+ rspec-expectations (~> 3.13)
104
+ rspec-mocks (~> 3.13)
105
+ rspec-support (~> 3.13)
106
+ rspec-support (3.13.1)
107
+ rubocop (1.63.5)
108
+ json (~> 2.3)
109
+ language_server-protocol (>= 3.17.0)
99
110
  parallel (~> 1.10)
100
- parser (>= 3.1.0.0)
111
+ parser (>= 3.3.0.2)
101
112
  rainbow (>= 2.2.2, < 4.0)
102
113
  regexp_parser (>= 1.8, < 3.0)
103
114
  rexml (>= 3.2.5, < 4.0)
104
- rubocop-ast (>= 1.17.0, < 2.0)
115
+ rubocop-ast (>= 1.31.1, < 2.0)
105
116
  ruby-progressbar (~> 1.7)
106
- unicode-display_width (>= 1.4.0, < 3.0)
107
- rubocop-ast (1.18.0)
108
- parser (>= 3.1.1.0)
109
- rubocop-performance (1.13.3)
110
- rubocop (>= 1.7.0, < 2.0)
111
- rubocop-ast (>= 0.4.0)
112
- ruby-progressbar (1.11.0)
113
- standard (1.12.1)
114
- rubocop (= 1.29.1)
115
- rubocop-performance (= 1.13.3)
116
- thor (1.2.1)
117
- tzinfo (2.0.4)
117
+ unicode-display_width (>= 2.4.0, < 3.0)
118
+ rubocop-ast (1.31.3)
119
+ parser (>= 3.3.1.0)
120
+ rubocop-performance (1.21.0)
121
+ rubocop (>= 1.48.1, < 2.0)
122
+ rubocop-ast (>= 1.31.1, < 2.0)
123
+ ruby-progressbar (1.13.0)
124
+ standard (1.36.0)
125
+ language_server-protocol (~> 3.17.0.2)
126
+ lint_roller (~> 1.0)
127
+ rubocop (~> 1.63.0)
128
+ standard-custom (~> 1.0.0)
129
+ standard-performance (~> 1.4)
130
+ standard-custom (1.0.2)
131
+ lint_roller (~> 1.0)
132
+ rubocop (~> 1.50)
133
+ standard-performance (1.4.0)
134
+ lint_roller (~> 1.1)
135
+ rubocop-performance (~> 1.21.0)
136
+ strscan (3.1.0)
137
+ thor (1.3.1)
138
+ tzinfo (2.0.6)
118
139
  concurrent-ruby (~> 1.0)
119
- unicode-display_width (2.2.0)
120
- zeitwerk (2.6.0)
140
+ unicode-display_width (2.5.0)
141
+ zeitwerk (2.6.15)
121
142
 
122
143
  PLATFORMS
144
+ arm64-darwin-23
123
145
  x86_64-darwin-20
124
146
  x86_64-darwin-21
125
147
  x86_64-linux
data/README.md CHANGED
@@ -1,71 +1,90 @@
1
- 18F-Flavored Rails 7 Project
1
+ 18F Rails Template
2
2
  ============================
3
+ The 18F Rails template starts or upgrades Rails projects so that they're more secure, follow compliance rules, and are nearly ready to deploy onto cloud.gov. This gem sets up security checks and compliance diagrams, adds the U.S. Web Design System (USWDS), and much much more — [see the full list of features](#features).
3
4
 
4
5
  This template will create a new Rails 7.0.x project.
5
6
 
6
- See the `rails-6` branch for Rails 6.1.x
7
+ [See the `rails-6` branch for Rails 6.1.x](https://github.com/18F/rails-template/tree/rails-6)
7
8
 
8
- ## Use for new Rails Project
9
+ ## Installation
9
10
 
10
- 1. `gem install rails_template_18f`
11
- 1. `rails_template_18f help new` for usage instructions
11
+ ### For a new Rails project
12
12
 
13
- ### Choosing whether to use `--hotwire`
13
+ 1. Install the gem:
14
+ ```
15
+ $ gem install rails_template_18f
16
+ ```
14
17
 
15
- #### Server Rendered _or_ Single Page Applications
18
+ 2. Decide whether to install Rails with Hotwire, a framework for client-side interactivity using JavaScript
19
+ - **For entirely server-side rendered applications**, without any Javascript:
20
+ - Use the default configuration (`rails_template_18f new <project name> --no-hotwire`)
21
+ - **For applications that need [a bit of client-side interactivity][aBitOfJS]**, but not a full single page application like React or Vue:
22
+ - Use Hotwire (`rails_template_18f new <project name> --hotwire`)
23
+ - **For single-page applications** where most of the interaction will take place via JavaScript, and which will use a framework like React or Vue:
24
+ - Use the default configuration (`rails_template_18f new <project name> --no-hotwire`)
16
25
 
17
- `rails_template_18f new <<PATH_TO_PROJECT>>` _or_ `rails_template_18f new <<PATH_TO_PROJECT>> --no-hotwire`
26
+ The `--hotwire` flag means that [Hotwire](https://hotwired.dev/) and [ActionCable](https://guides.rubyonrails.org/action_cable_overview.html) are installed. ActionCable is included to enable the [Turbo Streams](https://turbo.hotwired.dev/handbook/streams) functionality of Hotwire.
18
27
 
19
- This creates a Rails application that is appropriate for both server-rendered applications,
20
- as well as a basis for installing a separate Single Page Application (SPA) library such as React.
28
+ Before installing, you may want to consider the other application configuration options in the next section.
21
29
 
22
- #### A bit more JavaScript needed
30
+ [aBitOfJS]: https://engineering.18f.gov/web-architecture/#:~:text=are%20more%20complex-,If%20your%20use%20case%20requires%20a%20bit%20of%20client%2Dside%20interactivity%2C%20use%20the%20above%20options%20with%20a%20bit%20of%20JavaScript.,-You%20might%20use
23
31
 
24
- `rails_template_18f new <<PATH_TO_PROJECT>> --hotwire`
32
+ #### Advanced configuration
25
33
 
26
- This creates a Rails application that includes the [Hotwire](https://hotwired.dev/) JavaScript framework.
34
+ There are a variety of options that customize your Rails application.
27
35
 
28
- Hotwire can be used to add [a bit of JavaScript](https://engineering.18f.gov/web-architecture/#:~:text=are%20more%20complex-,If%20your%20use%20case%20requires%20a%20bit%20of%20client%2Dside%20interactivity%2C%20use%20the%20above%20options%20with%20a%20bit%20of%20JavaScript.,-You%20might%20use)
29
- for more interactivity than server-rendered apps, but less than a full SPA.
36
+ **Important:** Do not use flags `--skip-bundle` or `--skip-javascript`, or various parts of this template will break.
30
37
 
31
- ### Available Options
38
+ #### Default configuration
32
39
 
33
- The following options can be added to change how the template behaves.
40
+ ```sh
41
+ --skip-active-storage # Don't include ActiveStorage for document upload
42
+ --skip-action-text # Don't include ActionText libraries for WYSIWYG editing
43
+ --skip-action-cable # Don't include ActionCable websocket implementation
44
+ --skip-action-mailbox # Don't include inbound email
45
+ --skip-hotwire # Don't include Hotwire JS library
46
+ --skip-test # Skip built-in test framework. (We include RSpec)
47
+ --javascript=webpack # Use webpack for JS bundling
48
+ --css=postcss # Use the PostCSS framework for bundling CSS
49
+ --template=template.rb # Add additional configuration from template.rb
50
+ --database=postgresql # Use a PostgreSQL database
51
+ ```
34
52
 
35
- **Important:** You must not pass `--skip-bundle` or `--skip-javascript` to `rails_template_18f` or various aspects of the template will be broken
53
+ #### Customizing the installation
36
54
 
37
- #### `--javascript=esbuild`
55
+ | Option | Description |
56
+ |--------|-------------|
57
+ | `--no-skip-<framework>` | Each of the skipped frameworks listed above (also in `railsrc`) can be overridden on the command line. For example: `--no-skip-active-storage` will include support for `ActiveStorage` document uploads |
58
+ | `--javascript=esbuild` | Use [esbuild](https://esbuild.github.io/) instead of [webpack](https://webpack.js.org/) for JavaScript bundling. Note that maintaining IE11 support with esbuild may be tricky. |
59
+ | `--no-skip-<FRAMEWORK>` | Each of the skipped frameworks in `railsrc` can be overridden on the command line. For example: `--no-skip-active-storage` will include support for `ActiveStorage` document uploads |
38
60
 
39
- Use [esbuild](https://esbuild.github.io/) instead of [webpack](https://webpack.js.org/) for JavaScript bundling. Note that
40
- maintaining IE11 support with esbuild may be tricky.
61
+ You probably won't want to customize the template that defeats the purpose of using this gem!
41
62
 
42
- #### `--no-skip-FRAMEWORK`
63
+ _TODO: Documentation on whether you can override the `css` and `database` options._
43
64
 
44
- Each of the skipped frameworks in `railsrc` can be overridden on the command line. For example: `--no-skip-active-storage` will include support for `ActiveStorage` document uploads
65
+ ### For an existing Rails project
45
66
 
46
- ### What default use or `--no-hotwire` does
67
+ Installing this gem in a new Rails project will _TODO: say how it will help_
47
68
 
48
- ```
49
- --skip-active-storage # don't include ActiveStorage for document upload
50
- --skip-action-text # don't include ActionText libraries for WYSIWYG editing
51
- --skip-action-cable # don't include ActionCable websocket implementation
52
- --skip-action-mailbox # don't include inbound email
53
- --skip-hotwire # don't include Hotwire JS library
54
- --skip-test # Skip built in test framework. (RSpec included via template.rb)
55
- --javascript=webpack # Use webpack for JS bundling
56
- --css=postcss # Use the postcss CSS bundling framework
57
- --template=template.rb # add additional configuration from template.rb
58
- --database=postgresql # default to PostgreSQL
69
+ Add this line to your application's Gemfile:
70
+
71
+ ```ruby
72
+ gem "rails_template_18f", group: :development
59
73
  ```
60
74
 
61
- ### What `--hotwire` does
75
+ And then run:
62
76
 
63
- Identical to `--no-hotwire` except that [Hotwire](https://hotwired.dev/) and [ActionCable](https://guides.rubyonrails.org/action_cable_overview.html) are not skipped.
77
+ $ bundle install
64
78
 
65
- ActionCable is included to enable the [Turbo Streams](https://turbo.hotwired.dev/handbook/streams) functionality of Hotwire.
79
+ For a list of commands this gem can perform, run:
66
80
 
81
+ $ rails generate | grep 18f
67
82
 
68
- ### What `template.rb` does
83
+ _TODO: Add documentation on each option._
84
+
85
+ ### Features
86
+
87
+ This template does a lot! The template completes the following to-do list to make your application more secure, closer to standards-compliant, and nearly production-ready.
69
88
 
70
89
  1. Create a better default `README`
71
90
  1. Copy `CONTRIBUTING.md` and `LICENSE.md` from the [18F Open Source Policy repo](https://github.com/18F/open-source-policy/)
@@ -101,29 +120,7 @@ ActionCable is included to enable the [Turbo Streams](https://turbo.hotwired.dev
101
120
  1. Create [Architecture Decision Records](https://adr.github.io/) for above setup
102
121
  1. Commit the resulting project with git (unless `--skip-git` is passed)
103
122
 
104
- ## Use for an existing Rails project
105
-
106
- ### Installation
107
-
108
- Add this line to your application's Gemfile:
109
-
110
- ```ruby
111
- gem "rails_template_18f", group: :development
112
- ```
113
-
114
- And then run:
115
-
116
- $ bundle install
117
-
118
- Or install it yourself as:
119
-
120
- $ gem install rails_template_18f
121
-
122
- ### Usage
123
-
124
- Run `rails generate` for a list of commands this gem can run
125
-
126
- ## Development
123
+ ## Developing this gem
127
124
 
128
125
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
129
126
 
@@ -133,6 +130,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
133
130
 
134
131
  Bug reports and pull requests are welcome on GitHub at https://github.com/18f/rails-template. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/18f/rails-template/blob/main/CODE_OF_CONDUCT.md).
135
132
 
136
- ## Code of Conduct
133
+ ## Code of conduct
137
134
 
138
135
  Everyone interacting in the 18F Rails Template project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/rahearn/rails-template-18f/blob/main/CODE_OF_CONDUCT.md).
@@ -86,10 +86,6 @@ module RailsTemplate18f
86
86
  end
87
87
  end
88
88
 
89
- def update_data_model_uml
90
- insert_into_file "doc/compliance/apps/data.logical.md", data_model_uml, before: "@enduml"
91
- end
92
-
93
89
  def generate_adr
94
90
  adr_dir = File.expand_path(File.join("doc", "adr"), destination_root)
95
91
  if Dir.exist? adr_dir
@@ -108,45 +104,6 @@ module RailsTemplate18f
108
104
  EOS
109
105
  end
110
106
  end
111
-
112
- no_tasks do
113
- def data_model_uml
114
- <<~UML
115
- class file_uploads {
116
- * id : bigint <<generated>>
117
- * scan_status : string
118
- * record_id : bigint
119
- * record_type : string
120
- }
121
- class active_storage_attachments {
122
- * id : bigint <<generated>>
123
- * name : string
124
- * record_type : string
125
- * record_id : bigint
126
- * blob_id : bigint
127
- * created_at : timestamp without time zone
128
- }
129
- class active_storage_blobs {
130
- * id : bigint <<generated>>
131
- * key : string
132
- * filename : string
133
- content_type : string
134
- metadata : text
135
- * service_name : string
136
- * byte_size : bigint
137
- checksum : string
138
- * created_at : timestamp without time zone
139
- }
140
- class active_storage_variant_records {
141
- * id : bigint <<generated>>
142
- * variation_digest : string
143
- }
144
- file_uploads ||--|| active_storage_attachments
145
- active_storage_attachments ||--|{ active_storage_blobs
146
- active_storage_variant_records ||--|{ active_storage_blobs
147
- UML
148
- end
149
- end
150
107
  end
151
108
  end
152
109
  end
@@ -133,6 +133,20 @@ jobs:
133
133
  name: Yarn audit
134
134
  command: bundle exec rake yarn:audit
135
135
 
136
+ sbom_generation:
137
+ docker:
138
+ - image: cimg/ruby:<%= ruby_version %>
139
+ steps:
140
+ - setup-project
141
+ - run:
142
+ name: Install cyclonedx
143
+ command: gem install cyclonedx-ruby
144
+ - run:
145
+ name: Generate BOM
146
+ command: cyclonedx-ruby -p . -o ruby_bom.xml
147
+ - store_artifacts:
148
+ path: ./ruby_bom.xml
149
+
136
150
  owasp_scan:
137
151
  machine:
138
152
  image: ubuntu-2004:202111-02
@@ -343,6 +357,9 @@ workflows:
343
357
  - static_security_scans:
344
358
  requires:
345
359
  - build
360
+ - sbom_generation:
361
+ requires:
362
+ - build
346
363
  - owasp_scan:
347
364
  requires:
348
365
  - build
@@ -37,3 +37,20 @@ jobs:
37
37
 
38
38
  - name: Run yarn audit
39
39
  run: bundle exec rake yarn:audit
40
+
41
+ ruby-bom:
42
+ name: Ruby SBOM Generation
43
+ runs-on: ubuntu-latest
44
+
45
+ steps:
46
+ - uses: actions/checkout@v2
47
+ - uses: ./.github/actions/setup-languages
48
+ - name: Install cyclonedx
49
+ run: gem install cyclonedx-ruby
50
+ - name: Generate BOM
51
+ run: cyclonedx-ruby -p . -o ruby_bom.xml
52
+ - name: Save BOM
53
+ uses: actions/upload-artifact@v3
54
+ with:
55
+ name: ruby-bom
56
+ path: ./ruby_bom.xml
@@ -50,4 +50,6 @@ jobs:
50
50
  cf_password: ${{ secrets.CF_PASSWORD }}
51
51
  cf_org: <%= cloud_gov_organization %>
52
52
  cf_space: <%= cloud_gov_production_space %>
53
- push_arguments: "--vars-file config/deployment/production.yml --var rails_master_key=$RAILS_MASTER_KEY"
53
+ push_arguments: >-
54
+ --vars-file config/deployment/production.yml
55
+ --var rails_master_key=$RAILS_MASTER_KEY
@@ -50,4 +50,6 @@ jobs:
50
50
  cf_password: ${{ secrets.CF_PASSWORD }}
51
51
  cf_org: <%= cloud_gov_organization %>
52
52
  cf_space: <%= cloud_gov_staging_space %>
53
- push_arguments: "--vars-file config/deployment/staging.yml --var rails_master_key=$RAILS_MASTER_KEY"
53
+ push_arguments: >-
54
+ --vars-file config/deployment/staging.yml
55
+ --var rails_master_key=$RAILS_MASTER_KEY
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators"
4
+
5
+ module RailsTemplate18f
6
+ module Generators
7
+ class RailsErdGenerator < ::Rails::Generators::Base
8
+ include Base
9
+
10
+ desc <<~DESC
11
+ Description:
12
+ Install rails-erd and configure to automatically run on db migration
13
+ DESC
14
+
15
+ def install_graphviz
16
+ append_to_file "Brewfile", <<~EOB
17
+
18
+ # used by rails-erd documentation tool
19
+ brew "graphviz"
20
+ EOB
21
+ end
22
+
23
+ def install_gem
24
+ return if gem_installed?("rails-erd")
25
+ gem "rails-erd", "~> 1.7", group: :development
26
+ end
27
+
28
+ def install_helper_tasks
29
+ bundle_install do
30
+ generate "erd:install"
31
+ end
32
+ end
33
+
34
+ def copy_config
35
+ copy_file "erdconfig", ".erdconfig"
36
+ end
37
+
38
+ def update_readme
39
+ insert_into_file "doc/compliance/README.md", <<~EOM, before: "## Development"
40
+ ### Logical Data Model
41
+
42
+ The logical data model will be auto-generated on each database migration.
43
+ The rendered output is saved to doc/compliance/rendered/apps/data.logical.pdf
44
+
45
+ EOM
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,9 @@
1
+ attributes:
2
+ - content
3
+ - timestamps
4
+ filename: "doc/compliance/rendered/apps/data.logical"
5
+ filetype: pdf
6
+ inheritance: false
7
+ orientation: horizontal
8
+ polymorphism: false
9
+ exclude: "ActiveRecord::InternalMetadata,ActiveRecord::SchemaMigration"
@@ -59,7 +59,7 @@ The bootstrap module is used to create an s3 bucket for later terraform runs to
59
59
  A [SpaceDeployer](https://cloud.gov/docs/services/cloud-gov-service-account/) account is required to run terraform or
60
60
  deploy the application from the CI/CD pipeline. Create a new account by running:
61
61
 
62
- `./create_space_deployer.sh <SPACE_NAME> <ACCOUNT_NAME>`
62
+ `../bin/ops/create_service_account.sh -s <SPACE_NAME> -u <ACCOUNT_NAME>`
63
63
 
64
64
  ## Set up a new environment manually
65
65
 
@@ -75,7 +75,7 @@ The below steps rely on you first configuring access to the Terraform state in s
75
75
  # something that communicates the purpose of the deployer
76
76
  # for example: circleci-deployer for the credentials CircleCI uses to
77
77
  # deploy the application or <your_name>-terraform for credentials to run terraform manually
78
- ../create_space_deployer.sh <SPACE_NAME> <ACCOUNT_NAME> > secrets.auto.tfvars
78
+ ../../bin/ops/create_service_account.sh -s <SPACE_NAME> -u <ACCOUNT_NAME> > secrets.auto.tfvars
79
79
  ```
80
80
 
81
81
  The script will output the `username` (as `cf_user`) and `password` (as `cf_password`) for your `<ACCOUNT_NAME>`. Read more in the [cloud.gov service account documentation](https://cloud.gov/docs/services/cloud-gov-service-account/).
@@ -93,7 +93,7 @@ The below steps rely on you first configuring access to the Terraform state in s
93
93
  1. Remove the space deployer service instance if it doesn't need to be used again, such as when manually running terraform once.
94
94
  ```bash
95
95
  # <SPACE_NAME> and <ACCOUNT_NAME> have the same values as used above.
96
- ../destroy_space_deployer.sh <SPACE_NAME> <ACCOUNT_NAME>
96
+ ../../bin/ops/destroy_service_account.sh -s <SPACE_NAME> -u <ACCOUNT_NAME>
97
97
  ```
98
98
 
99
99
  ## Structure
@@ -4,7 +4,7 @@ locals {
4
4
  }
5
5
 
6
6
  module "s3" {
7
- source = "../shared/s3"
7
+ source = "github.com/18f/terraform-cloudgov//s3"
8
8
 
9
9
  cf_api_url = local.cf_api_url
10
10
  cf_user = var.cf_user
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
3
  if [[ ! -f "secrets.auto.tfvars" ]]; then
4
- ../create_space_deployer.sh <%= cloud_gov_production_space %> config-bootstrap-deployer > secrets.auto.tfvars
4
+ ../../bin/ops/create_service_account.sh -s <%= cloud_gov_production_space %> -u config-bootstrap-deployer > secrets.auto.tfvars
5
5
  fi
6
6
 
7
7
  if [[ $# -gt 0 ]]; then