suspenders 20240516.0 → 20251219.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.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -0
  3. data/CODEOWNERS +9 -0
  4. data/CONTRIBUTING.md +71 -0
  5. data/FEATURES.md +177 -0
  6. data/GOALS.md +65 -0
  7. data/LICENSE +21 -0
  8. data/NEWS.md +808 -0
  9. data/README.md +73 -60
  10. data/RELEASING.md +18 -0
  11. data/Rakefile +7 -10
  12. data/SECURITY.md +19 -0
  13. data/exe/suspenders +38 -0
  14. data/lib/suspenders/cli.rb +64 -0
  15. data/lib/suspenders/version.rb +4 -4
  16. data/lib/suspenders.rb +5 -6
  17. data/lib/templates/Procfile +3 -0
  18. data/lib/templates/Procfile.dev +2 -0
  19. data/lib/{generators/templates/views/flashes.html.erb → templates/app/views/application/_flashes.html.erb} +4 -2
  20. data/lib/templates/app/views/application/_form_errors.html.erb +11 -0
  21. data/lib/templates/config/initializers/sidekiq.rb +14 -0
  22. data/lib/templates/lib/development/seeder.rb +21 -0
  23. data/lib/templates/lib/tasks/development.rake +15 -0
  24. data/lib/templates/spec/support/action_mailer.rb +11 -0
  25. data/lib/{generators/templates/factories/factory_bot_rspec.rb → templates/spec/support/factory_bot.rb} +0 -2
  26. data/lib/templates/web.rb +544 -0
  27. data/sig/suspenders.rbs +4 -0
  28. metadata +34 -120
  29. data/lib/generators/suspenders/accessibility_generator.rb +0 -24
  30. data/lib/generators/suspenders/advisories_generator.rb +0 -32
  31. data/lib/generators/suspenders/ci_generator.rb +0 -57
  32. data/lib/generators/suspenders/email_generator.rb +0 -56
  33. data/lib/generators/suspenders/environments/development_generator.rb +0 -50
  34. data/lib/generators/suspenders/environments/production_generator.rb +0 -27
  35. data/lib/generators/suspenders/environments/test_generator.rb +0 -39
  36. data/lib/generators/suspenders/factories_generator.rb +0 -64
  37. data/lib/generators/suspenders/inline_svg_generator.rb +0 -24
  38. data/lib/generators/suspenders/install/web_generator.rb +0 -71
  39. data/lib/generators/suspenders/jobs_generator.rb +0 -34
  40. data/lib/generators/suspenders/lint_generator.rb +0 -94
  41. data/lib/generators/suspenders/prerequisites_generator.rb +0 -19
  42. data/lib/generators/suspenders/rake_generator.rb +0 -25
  43. data/lib/generators/suspenders/setup_generator.rb +0 -14
  44. data/lib/generators/suspenders/styles_generator.rb +0 -84
  45. data/lib/generators/suspenders/tasks_generator.rb +0 -20
  46. data/lib/generators/suspenders/testing_generator.rb +0 -113
  47. data/lib/generators/suspenders/views_generator.rb +0 -38
  48. data/lib/generators/templates/ci/ci.yml.tt +0 -148
  49. data/lib/generators/templates/ci/dependabot.yml +0 -7
  50. data/lib/generators/templates/email/email_interceptor.rb +0 -11
  51. data/lib/generators/templates/factories/factories.rb +0 -2
  52. data/lib/generators/templates/factories/factories_test.rb +0 -9
  53. data/lib/generators/templates/inline_svg/inline_svg.rb +0 -3
  54. data/lib/generators/templates/install/web/CONTRIBUTING.md +0 -94
  55. data/lib/generators/templates/lint/config_better_html.yml +0 -2
  56. data/lib/generators/templates/lint/config_initializers_better_html.rb +0 -9
  57. data/lib/generators/templates/lint/erb-lint.yml +0 -63
  58. data/lib/generators/templates/lint/erblint.rake +0 -47
  59. data/lib/generators/templates/lint/eslintrc.json +0 -7
  60. data/lib/generators/templates/lint/package.json +0 -4
  61. data/lib/generators/templates/lint/prettierignore +0 -1
  62. data/lib/generators/templates/lint/prettierrc +0 -11
  63. data/lib/generators/templates/lint/rubocop.yml.tt +0 -7
  64. data/lib/generators/templates/lint/stylelintrc.json +0 -3
  65. data/lib/generators/templates/prerequisites/node-version.tt +0 -1
  66. data/lib/generators/templates/setup/bin_setup.rb +0 -39
  67. data/lib/generators/templates/styles/postcss.config.js +0 -11
  68. data/lib/generators/templates/tasks/dev.rake +0 -12
  69. data/lib/generators/templates/testing/action_mailer.rb +0 -5
  70. data/lib/install/web.rb +0 -54
  71. data/lib/suspenders/cleanup/generate_readme.rb +0 -165
  72. data/lib/suspenders/cleanup/organize_gemfile.rb +0 -134
  73. data/lib/suspenders/engine.rb +0 -5
  74. data/lib/suspenders/generators.rb +0 -126
  75. data/lib/suspenders/railtie.rb +0 -4
  76. data/lib/tasks/suspenders.rake +0 -37
  77. /data/lib/{generators/templates/factories → templates/spec}/factories_spec.rb +0 -0
  78. /data/lib/{generators/templates/testing → templates/spec/support}/driver.rb +0 -0
  79. /data/lib/{generators/templates/testing → templates/spec/support}/i18n.rb +0 -0
  80. /data/lib/{generators/templates/testing → templates/spec/support}/shoulda_matchers.rb +0 -0
@@ -1,34 +0,0 @@
1
- module Suspenders
2
- module Generators
3
- class JobsGenerator < Rails::Generators::Base
4
- desc <<~MARKDOWN
5
- Uses [Sidekiq][] for [background job][] processing.
6
-
7
- Configures the `test` environment to use the [inline][] adapter.
8
-
9
- [Sidekiq]: https://github.com/sidekiq/sidekiq
10
- [background job]: https://guides.rubyonrails.org/active_job_basics.html
11
- [inline]: https://api.rubyonrails.org/classes/ActiveJob/QueueAdapters/InlineAdapter.html
12
- MARKDOWN
13
-
14
- def add_sidekiq_gem
15
- gem "sidekiq"
16
- Bundler.with_unbundled_env { run "bundle install" }
17
- end
18
-
19
- def configure_active_job
20
- environment "config.active_job.queue_adapter = :sidekiq"
21
- environment "config.active_job.queue_adapter = :inline", env: "test"
22
- end
23
-
24
- def configure_procfile
25
- if Rails.root.join("Procfile.dev").exist?
26
- append_to_file "Procfile.dev", "worker: bundle exec sidekiq"
27
- else
28
- say "Add default Procfile.dev"
29
- create_file "Procfile.dev", "worker: bundle exec sidekiq"
30
- end
31
- end
32
- end
33
- end
34
- end
@@ -1,94 +0,0 @@
1
- module Suspenders
2
- module Generators
3
- class LintGenerator < Rails::Generators::Base
4
- include Suspenders::Generators::Helpers
5
-
6
- source_root File.expand_path("../../templates/lint", __FILE__)
7
- desc <<~MARKDOWN
8
- - Uses [@thoughtbot/eslint-config][] for JavaScript linting.
9
- - Uses [@thoughtbot/stylelint-config][] for CSS linting.
10
- - Uses [prettier][] for additional linting.
11
- - Uses [better_html][], [erb_lint][], and [erblint-github][] for ERB linting.
12
- - Uses [standard][] for Ruby linting.
13
-
14
- **Available Commands**
15
-
16
- - Run `yarn lint` to lint front-end code.
17
- - Run `yarn fix:prettier` to automatically fix prettier violations.
18
- - Run `bin/rails standard` to lint ERB and Ruby code.
19
- - Run `bundle exec standardrb --fix` to fix standard violations.
20
-
21
- [@thoughtbot/eslint-config]: https://github.com/thoughtbot/eslint-config
22
- [@thoughtbot/stylelint-config]: https://github.com/thoughtbot/stylelint-config
23
- [prettier]: https://prettier.io
24
- [better_html]: https://github.com/Shopify/better-html
25
- [erb_lint]: https://github.com/Shopify/erb-lint
26
- [erblint-github]: https://github.com/github/erblint-github
27
- [standard]: https://github.com/standardrb/standard
28
- MARKDOWN
29
-
30
- def check_package_json
31
- unless File.exist? Rails.root.join("package.json")
32
- copy_file "package.json", "package.json"
33
- end
34
- end
35
-
36
- # TODO: Remove eslint version pin once the follownig is solved
37
- # https://github.com/thoughtbot/eslint-config/issues/10
38
- def install_dependencies
39
- run "yarn add stylelint eslint@^8.9.0 @thoughtbot/stylelint-config @thoughtbot/eslint-config npm-run-all prettier --dev"
40
- end
41
-
42
- def install_gems
43
- gem_group :development, :test do
44
- gem "better_html", require: false
45
- gem "erb_lint", require: false
46
- gem "erblint-github", require: false
47
- gem "standard"
48
- end
49
- Bundler.with_unbundled_env { run "bundle install" }
50
- end
51
-
52
- def configure_stylelint
53
- copy_file "stylelintrc.json", ".stylelintrc.json"
54
- end
55
-
56
- def configure_eslint
57
- copy_file "eslintrc.json", ".eslintrc.json"
58
- end
59
-
60
- def configure_prettier
61
- copy_file "prettierrc", ".prettierrc"
62
- copy_file "prettierignore", ".prettierignore"
63
- end
64
-
65
- def configure_erb_lint
66
- copy_file "erb-lint.yml", ".erb-lint.yml"
67
- copy_file "config_better_html.yml", "config/better_html.yml"
68
- copy_file "config_initializers_better_html.rb", "config/initializers/better_html.rb"
69
- copy_file "erblint.rake", "lib/tasks/erblint.rake"
70
- template "rubocop.yml.tt", ".rubocop.yml"
71
- end
72
-
73
- def update_package_json
74
- content = File.read package_json
75
- json = JSON.parse content
76
- json["scripts"] ||= {}
77
-
78
- json["scripts"]["lint"] = "run-p lint:eslint lint:stylelint lint:prettier"
79
- json["scripts"]["lint:eslint"] = "eslint --max-warnings=0 --no-error-on-unmatched-pattern 'app/javascript/**/*.js'"
80
- json["scripts"]["lint:stylelint"] = "stylelint 'app/assets/stylesheets/**/*.css'"
81
- json["scripts"]["lint:prettier"] = "prettier --check '**/*' --ignore-unknown"
82
- json["scripts"]["fix:prettier"] = "prettier --write '**/*' --ignore-unknown"
83
-
84
- File.write package_json, JSON.pretty_generate(json)
85
- end
86
-
87
- private
88
-
89
- def package_json
90
- Rails.root.join("package.json")
91
- end
92
- end
93
- end
94
- end
@@ -1,19 +0,0 @@
1
- module Suspenders
2
- module Generators
3
- class PrerequisitesGenerator < Rails::Generators::Base
4
- include Suspenders::Generators::Helpers
5
- include Suspenders::Generators::NodeNotInstalled
6
- include Suspenders::Generators::NodeVersionUnsupported
7
-
8
- source_root File.expand_path("../../templates/prerequisites", __FILE__)
9
-
10
- desc <<~MARKDOWN
11
- Creates `.node-version` file set to the current LTS version.
12
- MARKDOWN
13
-
14
- def set_node_version
15
- template "node-version", ".node-version"
16
- end
17
- end
18
- end
19
- end
@@ -1,25 +0,0 @@
1
- module Suspenders
2
- module Generators
3
- class RakeGenerator < Rails::Generators::Base
4
- source_root File.expand_path("../../templates/rake", __FILE__)
5
- desc <<~MARKDOWN
6
- Adds default Raketask wich is a wrapper for `suspenders:rake`.
7
-
8
- This will do the following:
9
-
10
- - Run the test suite.
11
- - Run a Ruby and ERB linter.
12
- - Scan the Ruby codebase for any dependency vulnerabilities.
13
- MARKDOWN
14
-
15
- def configure_default_rake_task
16
- append_to_file "Rakefile", <<~RUBY
17
-
18
- if Rails.env.local?
19
- task default: "suspenders:rake"
20
- end
21
- RUBY
22
- end
23
- end
24
- end
25
- end
@@ -1,14 +0,0 @@
1
- module Suspenders
2
- module Generators
3
- class SetupGenerator < Rails::Generators::Base
4
- source_root File.expand_path("../../templates/setup", __FILE__)
5
- desc <<~MARKDOWN
6
- Run `bin/setup` to install dependencies and seed development data.
7
- MARKDOWN
8
-
9
- def replace_bin_setup
10
- copy_file "bin_setup.rb", "bin/setup", force: true
11
- end
12
- end
13
- end
14
- end
@@ -1,84 +0,0 @@
1
- module Suspenders
2
- module Generators
3
- class StylesGenerator < Rails::Generators::Base
4
- include Suspenders::Generators::APIAppUnsupported
5
-
6
- source_root File.expand_path("../../templates/styles", __FILE__)
7
- desc <<~MARKDOWN
8
- - Uses [PostCSS][] via [cssbundling-rails][].
9
- - Uses [modern-normalize][] to normalize browsers' default style.
10
-
11
- Configuration can be found at `postcss.config.js`.
12
-
13
- Adds the following stylesheet structure.
14
-
15
- ```
16
- app/assets/stylesheets/base.css
17
- app/assets/stylesheets/components.css
18
- app/assets/stylesheets/utilities.css
19
- ```
20
-
21
- Adds `app/assets/static` so that [postcss-url][] has a directory to copy
22
- assets to.
23
-
24
- [PostCSS]: https://postcss.org
25
- [cssbundling-rails]: https://github.com/rails/cssbundling-rails
26
- [modern-normalize]: https://github.com/sindresorhus/modern-normalize
27
- [postcss-url]: https://github.com/postcss/postcss-url
28
- MARKDOWN
29
-
30
- def add_cssbundling_rails_gem
31
- gem "cssbundling-rails"
32
-
33
- Bundler.with_unbundled_env { run "bundle install" }
34
- run "bin/rails css:install:postcss"
35
- end
36
-
37
- def build_directory_structure
38
- create_file "app/assets/stylesheets/base.css"
39
- append_to_file "app/assets/stylesheets/base.css", "/* Base Styles */"
40
-
41
- create_file "app/assets/stylesheets/components.css"
42
- append_to_file "app/assets/stylesheets/components.css", "/* Component Styles */"
43
-
44
- create_file "app/assets/stylesheets/utilities.css"
45
- append_to_file "app/assets/stylesheets/utilities.css", "/* Utility Styles */"
46
- end
47
-
48
- def configure_application_stylesheet
49
- run "yarn add modern-normalize"
50
-
51
- append_to_file "app/assets/stylesheets/application.postcss.css" do
52
- <<~TEXT
53
- @import "modern-normalize";
54
- @import "base.css";
55
- @import "components.css";
56
- @import "utilities.css";
57
- TEXT
58
- end
59
- end
60
-
61
- def install_postcss_url
62
- run "yarn add postcss-url"
63
- end
64
-
65
- def configures_postcss
66
- begin
67
- File.delete(postcss_config)
68
- rescue Errno::ENOENT
69
- end
70
-
71
- empty_directory "app/assets/static"
72
- create_file "app/assets/static/.gitkeep"
73
-
74
- copy_file "postcss.config.js", "postcss.config.js"
75
- end
76
-
77
- private
78
-
79
- def postcss_config
80
- Rails.root.join("postcss.config.js")
81
- end
82
- end
83
- end
84
- end
@@ -1,20 +0,0 @@
1
- module Suspenders
2
- module Generators
3
- class TasksGenerator < Rails::Generators::Base
4
- source_root File.expand_path("../../templates/tasks", __FILE__)
5
- desc <<~MARKDOWN
6
- Creates `lib/tasks/dev.rake` which contains the following tasks:
7
-
8
- `bin/rails dev:prime` which loads sample data for local development.
9
- MARKDOWN
10
-
11
- def create_dev_rake
12
- if Bundler.rubygems.find_name("factory_bot").any?
13
- copy_file "dev.rake", "lib/tasks/dev.rake"
14
- else
15
- say "This generator requires Factory Bot"
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,113 +0,0 @@
1
- module Suspenders
2
- module Generators
3
- class TestingGenerator < Rails::Generators::Base
4
- source_root File.expand_path("../../templates/testing", __FILE__)
5
- desc <<~MARKDOWN
6
- Uses [RSpec][] and [RSpec Rails][] in favor of the [default test suite][].
7
-
8
- The test suite can be run with `bin/rails spec`.
9
-
10
- Configuration can be found in the following files:
11
-
12
- ```
13
- spec/rails_helper.rb
14
- spec/spec_helper.rb
15
- spec/support/action_mailer.rb
16
- spec/support/driver.rb
17
- spec/support/i18n.rb
18
- spec/support/should_matchers.rb
19
- ```
20
-
21
- - Uses [action_dispatch-testing-integration-capybara][] to introduce Capybara assertions into Request specs.
22
- - Uses [should-matchers][] for simple one-liner tests for common Rails functionality.
23
- - Uses [webmock][] for stubbing and setting expectations on HTTP requests in Ruby.
24
-
25
- [RSpec]: http://rspec.info
26
- [RSpec Rails]: https://github.com/rspec/rspec-rails
27
- [default test suite]: https://guides.rubyonrails.org/testing.html
28
- [action_dispatch-testing-integration-capybara]: https://github.com/thoughtbot/action_dispatch-testing-integration-capybara
29
- [should-matchers]: https://github.com/thoughtbot/shoulda-matchers
30
- [webmock]: https://github.com/bblimke/webmock
31
- MARKDOWN
32
-
33
- def add_gems
34
- gem_group :development, :test do
35
- gem "rspec-rails", "~> 6.1.0"
36
- end
37
-
38
- gem_group :test do
39
- gem "capybara"
40
- gem "action_dispatch-testing-integration-capybara",
41
- github: "thoughtbot/action_dispatch-testing-integration-capybara", tag: "v0.1.1",
42
- require: "action_dispatch/testing/integration/capybara/rspec"
43
- gem "selenium-webdriver"
44
- gem "shoulda-matchers", "~> 6.0"
45
- gem "webmock"
46
- end
47
-
48
- Bundler.with_unbundled_env { run "bundle install" }
49
- end
50
-
51
- def run_rspec_installation_script
52
- rails_command "generate rspec:install"
53
- end
54
-
55
- def modify_rails_helper
56
- insert_into_file "spec/rails_helper.rb",
57
- "\s\sconfig.infer_base_class_for_anonymous_controllers = false\n",
58
- after: "RSpec.configure do |config|\n"
59
-
60
- uncomment_lines "spec/rails_helper.rb", /Rails\.root\.glob/
61
- end
62
-
63
- def modify_spec_helper
64
- persistence_file_path = "\s\sconfig.example_status_persistence_file_path = \"tmp/rspec_examples.txt\"\n"
65
- order = "\s\sconfig.order = :random\n\n"
66
- webmock_config = <<~RUBY
67
-
68
- WebMock.disable_net_connect!(
69
- allow_localhost: true,
70
- allow: [
71
- /(chromedriver|storage).googleapis.com/,
72
- "googlechromelabs.github.io"
73
- ]
74
- )
75
- RUBY
76
-
77
- insert_into_file "spec/spec_helper.rb",
78
- persistence_file_path + order,
79
- after: "RSpec.configure do |config|\n"
80
-
81
- insert_into_file "spec/spec_helper.rb", "require \"webmock/rspec\"\n\n", before: "RSpec.configure do |config|"
82
- insert_into_file "spec/spec_helper.rb", webmock_config
83
- end
84
-
85
- def create_system_spec_dir
86
- empty_directory "spec/system"
87
- create_file "spec/system/.gitkeep"
88
- end
89
-
90
- def configure_chromedriver
91
- copy_file "driver.rb", "spec/support/driver.rb"
92
- end
93
-
94
- def configure_i18n_helper
95
- copy_file "i18n.rb", "spec/support/i18n.rb"
96
- end
97
-
98
- def configure_shoulda_matchers
99
- copy_file "shoulda_matchers.rb", "spec/support/shoulda_matchers.rb"
100
- end
101
-
102
- def configure_action_mailer_helpers
103
- # https://guides.rubyonrails.org/testing.html#the-basic-test-case
104
- #
105
- # The ActionMailer::Base.deliveries array is only reset automatically in
106
- # ActionMailer::TestCase and ActionDispatch::IntegrationTest tests. If
107
- # you want to have a clean slate outside these test cases, you can reset
108
- # it manually with: ActionMailer::Base.deliveries.clear
109
- copy_file "action_mailer.rb", "spec/support/action_mailer.rb"
110
- end
111
- end
112
- end
113
- end
@@ -1,38 +0,0 @@
1
- module Suspenders
2
- module Generators
3
- class ViewsGenerator < Rails::Generators::Base
4
- include Suspenders::Generators::APIAppUnsupported
5
-
6
- source_root File.expand_path("../../templates/views", __FILE__)
7
- desc <<~MARKDOWN
8
- - A [partial][] for [flash messages][] is located in `app/views/application/_flashes.html.erb`.
9
- - Sets [lang][] attribute on `<html>` element to `en` via `I18n.local`.
10
- - Dynamically sets `<title>` via the [title][] gem.
11
- - Disables Turbo's [Prefetch][] in an effort to reduce unnecessary network requests.
12
-
13
- [partial]: https://guides.rubyonrails.org/layouts_and_rendering.html#using-partials
14
- [flash messages]: https://guides.rubyonrails.org/action_controller_overview.html#the-flash
15
- [lang]: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang
16
- [title]: https://github.com/calebhearth/title
17
- [Prefetch]: https://turbo.hotwired.dev/handbook/drive#prefetching-links-on-hover
18
- MARKDOWN
19
-
20
- def install_gems
21
- gem "title"
22
-
23
- Bundler.with_unbundled_env { run "bundle install" }
24
- end
25
-
26
- def create_views
27
- copy_file "flashes.html.erb", "app/views/application/_flashes.html.erb"
28
- end
29
-
30
- def update_application_layout
31
- insert_into_file "app/views/layouts/application.html.erb", " <%= render \"flashes\" -%>\n", after: "<body>\n"
32
- gsub_file "app/views/layouts/application.html.erb", /<html>/, "<html lang=\"<%= I18n.locale %>\">"
33
- gsub_file "app/views/layouts/application.html.erb", /<title>.*<\/title>/, "<title><%= title %></title>"
34
- insert_into_file "app/views/layouts/application.html.erb", " <meta name=\"turbo-prefetch\" content=\"false\">\n", after: "</title>"
35
- end
36
- end
37
- end
38
- end
@@ -1,148 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- pull_request:
5
- push:
6
- branches: [main]
7
-
8
- jobs:
9
- <%- if scan_ruby? -%>
10
- scan_ruby:
11
- runs-on: ubuntu-latest
12
-
13
- steps:
14
- - name: Checkout code
15
- uses: actions/checkout@v4
16
-
17
- - name: Set up Ruby
18
- uses: ruby/setup-ruby@v1
19
- with:
20
- ruby-version: .ruby-version
21
- bundler-cache: true
22
-
23
- - name: Scan for security vulnerabilities in Ruby dependencies
24
- run: |
25
- bin/rails bundle:audit:update
26
- bin/rails bundle:audit
27
- <% end -%>
28
-
29
- <%- if scan_js? -%>
30
- scan_js:
31
- runs-on: ubuntu-latest
32
-
33
- steps:
34
- - name: Checkout code
35
- uses: actions/checkout@v4
36
-
37
- - name: Set up Ruby
38
- uses: ruby/setup-ruby@v1
39
- with:
40
- ruby-version: .ruby-version
41
- bundler-cache: true
42
-
43
- - name: Setup Node
44
- uses: actions/setup-node@v4
45
- with:
46
- node-version-file: .node-version
47
-
48
- - name: Install modules
49
- run: yarn install
50
-
51
- - name: Scan for security vulnerabilities in JavaScript dependencies
52
- run: |
53
- bin/importmap audit
54
- yarn audit
55
- <% end -%>
56
-
57
- <%- if lint? -%>
58
- lint:
59
- runs-on: ubuntu-latest
60
- steps:
61
- - name: Checkout code
62
- uses: actions/checkout@v4
63
-
64
- - name: Set up Ruby
65
- uses: ruby/setup-ruby@v1
66
- with:
67
- ruby-version: .ruby-version
68
- bundler-cache: true
69
-
70
- - name: Setup Node
71
- uses: actions/setup-node@v4
72
- with:
73
- node-version-file: .node-version
74
-
75
- - name: Install modules
76
- run: yarn install
77
-
78
- - name: Lint Ruby code for consistent style
79
- run: bin/rails standard
80
-
81
- - name: Lint front-end code for consistent style
82
- run: yarn lint
83
- <% end -%>
84
-
85
- test:
86
- runs-on: ubuntu-latest
87
-
88
- services:
89
- postgres:
90
- image: postgres
91
- env:
92
- POSTGRES_USER: postgres
93
- POSTGRES_PASSWORD: postgres
94
- ports:
95
- - 5432:5432
96
- options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
97
-
98
- # redis:
99
- # image: redis
100
- # ports:
101
- # - 6379:6379
102
- # options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
103
-
104
- steps:
105
- - name: Install packages
106
- run: sudo apt-get update && sudo apt-get install --no-install-recommends -y google-chrome-stable curl libjemalloc2 libvips postgresql-client libpq-dev
107
-
108
- - name: Checkout code
109
- uses: actions/checkout@v4
110
-
111
- - name: Set up Ruby
112
- uses: ruby/setup-ruby@v1
113
- with:
114
- ruby-version: .ruby-version
115
- bundler-cache: true
116
-
117
- <%- if using_node? -%>
118
- - name: Setup Node
119
- uses: actions/setup-node@v4
120
- with:
121
- node-version-file: .node-version
122
-
123
- - name: Install modules
124
- run: yarn install
125
- <%- end -%>
126
-
127
- - name: Run tests
128
- env:
129
- RAILS_ENV: test
130
- DATABASE_URL: postgres://postgres:postgres@localhost:5432
131
- # REDIS_URL: redis://localhost:6379/0
132
- <%- if using_rspec? -%>
133
- run: bin/rails db:setup spec
134
- <%- else -%>
135
- run: bin/rails db:setup test test:system
136
- <%- end -%>
137
-
138
- - name: Keep screenshots from failed system tests
139
- uses: actions/upload-artifact@v4
140
- if: failure()
141
- with:
142
- name: screenshots
143
- <%- if using_rspec? -%>
144
- path: ${{ github.workspace }}/tmp/capybara
145
- <%- else -%>
146
- path: ${{ github.workspace }}/tmp/screenshots
147
- <%- end -%>
148
- if-no-files-found: ignore
@@ -1,7 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: bundler
4
- directory: '/'
5
- schedule:
6
- interval: daily
7
- open-pull-requests-limit: 10
@@ -1,11 +0,0 @@
1
- class EmailInterceptor
2
- include ActiveSupport::Configurable
3
-
4
- config_accessor :interceptor_addresses, default: []
5
-
6
- def self.delivering_email(message)
7
- to = interceptor_addresses
8
-
9
- message.to = to if to.any?
10
- end
11
- end
@@ -1,2 +0,0 @@
1
- FactoryBot.define do
2
- end
@@ -1,9 +0,0 @@
1
- require "test_helper"
2
-
3
- class FactoryBotsTest < ActiveSupport::TestCase
4
- class FactoryLintingTest < FactoryBotsTest
5
- test "linting of factories" do
6
- FactoryBot.lint traits: true
7
- end
8
- end
9
- end
@@ -1,3 +0,0 @@
1
- InlineSvg.configure do |config|
2
- config.raise_on_file_not_found = true
3
- end