suspenders 20230113.0 → 20240516.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +83 -176
  3. data/Rakefile +13 -0
  4. data/lib/generators/suspenders/accessibility_generator.rb +24 -0
  5. data/lib/generators/suspenders/advisories_generator.rb +32 -0
  6. data/lib/generators/suspenders/ci_generator.rb +57 -0
  7. data/lib/generators/suspenders/email_generator.rb +56 -0
  8. data/lib/generators/suspenders/environments/development_generator.rb +50 -0
  9. data/lib/generators/suspenders/environments/production_generator.rb +27 -0
  10. data/lib/generators/suspenders/environments/test_generator.rb +39 -0
  11. data/lib/generators/suspenders/factories_generator.rb +64 -0
  12. data/lib/generators/suspenders/inline_svg_generator.rb +24 -0
  13. data/lib/generators/suspenders/install/web_generator.rb +71 -0
  14. data/lib/generators/suspenders/jobs_generator.rb +34 -0
  15. data/lib/generators/suspenders/lint_generator.rb +94 -0
  16. data/lib/generators/suspenders/prerequisites_generator.rb +19 -0
  17. data/lib/generators/suspenders/rake_generator.rb +25 -0
  18. data/lib/generators/suspenders/setup_generator.rb +14 -0
  19. data/lib/generators/suspenders/styles_generator.rb +84 -0
  20. data/lib/generators/suspenders/tasks_generator.rb +20 -0
  21. data/lib/generators/suspenders/testing_generator.rb +113 -0
  22. data/lib/generators/suspenders/views_generator.rb +38 -0
  23. data/lib/generators/templates/ci/ci.yml.tt +148 -0
  24. data/lib/generators/templates/ci/dependabot.yml +7 -0
  25. data/lib/generators/templates/email/email_interceptor.rb +11 -0
  26. data/lib/generators/templates/factories/factories_spec.rb +7 -0
  27. data/lib/generators/templates/factories/factories_test.rb +9 -0
  28. data/lib/generators/templates/install/web/CONTRIBUTING.md +94 -0
  29. data/lib/generators/templates/lint/config_better_html.yml +2 -0
  30. data/lib/generators/templates/lint/config_initializers_better_html.rb +9 -0
  31. data/lib/generators/templates/lint/erb-lint.yml +63 -0
  32. data/lib/generators/templates/lint/erblint.rake +47 -0
  33. data/lib/generators/templates/lint/eslintrc.json +7 -0
  34. data/lib/generators/templates/lint/package.json +4 -0
  35. data/lib/generators/templates/lint/prettierignore +1 -0
  36. data/lib/generators/templates/lint/prettierrc +11 -0
  37. data/lib/generators/templates/lint/rubocop.yml.tt +7 -0
  38. data/lib/generators/templates/prerequisites/node-version.tt +1 -0
  39. data/lib/generators/templates/setup/bin_setup.rb +39 -0
  40. data/lib/generators/templates/styles/postcss.config.js +11 -0
  41. data/lib/generators/templates/testing/driver.rb +5 -0
  42. data/lib/generators/templates/views/flashes.html.erb +7 -0
  43. data/lib/install/web.rb +54 -0
  44. data/lib/suspenders/cleanup/generate_readme.rb +165 -0
  45. data/lib/suspenders/cleanup/organize_gemfile.rb +134 -0
  46. data/lib/suspenders/engine.rb +5 -0
  47. data/lib/suspenders/generators.rb +126 -0
  48. data/lib/suspenders/railtie.rb +4 -0
  49. data/lib/suspenders/version.rb +4 -6
  50. data/lib/suspenders.rb +9 -33
  51. data/lib/tasks/suspenders.rake +37 -0
  52. metadata +82 -173
  53. data/.ruby-version +0 -1
  54. data/CONTRIBUTING.md +0 -59
  55. data/GOALS.md +0 -65
  56. data/LICENSE +0 -21
  57. data/NEWS.md +0 -738
  58. data/RELEASING.md +0 -18
  59. data/bin/suspenders +0 -50
  60. data/docs/heroku_deploy.md +0 -19
  61. data/docs/rails_7.md +0 -5
  62. data/lib/suspenders/actions/strip_comments_action.rb +0 -254
  63. data/lib/suspenders/actions.rb +0 -106
  64. data/lib/suspenders/adapters/heroku.rb +0 -136
  65. data/lib/suspenders/app_builder.rb +0 -267
  66. data/lib/suspenders/exit_on_failure.rb +0 -19
  67. data/lib/suspenders/generators/accessibility_generator.rb +0 -12
  68. data/lib/suspenders/generators/advisories_generator.rb +0 -15
  69. data/lib/suspenders/generators/analytics_generator.rb +0 -24
  70. data/lib/suspenders/generators/app_generator.rb +0 -215
  71. data/lib/suspenders/generators/base.rb +0 -60
  72. data/lib/suspenders/generators/ci_generator.rb +0 -32
  73. data/lib/suspenders/generators/db_optimizations_generator.rb +0 -18
  74. data/lib/suspenders/generators/factories_generator.rb +0 -22
  75. data/lib/suspenders/generators/forms_generator.rb +0 -18
  76. data/lib/suspenders/generators/inline_svg_generator.rb +0 -14
  77. data/lib/suspenders/generators/jobs_generator.rb +0 -37
  78. data/lib/suspenders/generators/js_driver_generator.rb +0 -18
  79. data/lib/suspenders/generators/json_generator.rb +0 -14
  80. data/lib/suspenders/generators/lint_generator.rb +0 -14
  81. data/lib/suspenders/generators/production/compression_generator.rb +0 -14
  82. data/lib/suspenders/generators/production/deployment_generator.rb +0 -16
  83. data/lib/suspenders/generators/production/email_generator.rb +0 -34
  84. data/lib/suspenders/generators/production/force_tls_generator.rb +0 -11
  85. data/lib/suspenders/generators/production/manifest_generator.rb +0 -25
  86. data/lib/suspenders/generators/production/single_redirect.rb +0 -15
  87. data/lib/suspenders/generators/production/timeout_generator.rb +0 -22
  88. data/lib/suspenders/generators/profiler_generator.rb +0 -35
  89. data/lib/suspenders/generators/runner_generator.rb +0 -48
  90. data/lib/suspenders/generators/staging/pull_requests_generator.rb +0 -25
  91. data/lib/suspenders/generators/static_generator.rb +0 -14
  92. data/lib/suspenders/generators/stylelint_generator.rb +0 -71
  93. data/lib/suspenders/generators/stylesheet_base_generator.rb +0 -15
  94. data/lib/suspenders/generators/testing_generator.rb +0 -43
  95. data/lib/suspenders/generators/views_generator.rb +0 -25
  96. data/templates/Gemfile.erb +0 -49
  97. data/templates/Procfile +0 -2
  98. data/templates/README.md.erb +0 -28
  99. data/templates/_analytics.html.erb +0 -8
  100. data/templates/_css_overrides.html.erb +0 -7
  101. data/templates/_flashes.html.erb +0 -7
  102. data/templates/active_job.rb +0 -14
  103. data/templates/application.postcss.css +0 -1
  104. data/templates/bin_auto_migrate +0 -5
  105. data/templates/bin_deploy +0 -10
  106. data/templates/bin_setup +0 -28
  107. data/templates/bin_setup_review_app.erb +0 -21
  108. data/templates/bin_yarn +0 -18
  109. data/templates/bundler_audit.rake +0 -4
  110. data/templates/capybara_silence_puma.rb +0 -1
  111. data/templates/chromedriver.rb +0 -27
  112. data/templates/circle.yml.erb +0 -6
  113. data/templates/config_locales_en.yml.erb +0 -19
  114. data/templates/descriptions/advisories.md +0 -5
  115. data/templates/descriptions/analytics.md +0 -4
  116. data/templates/descriptions/ci.md +0 -4
  117. data/templates/descriptions/compression.md +0 -4
  118. data/templates/descriptions/db_optimizations.md +0 -2
  119. data/templates/descriptions/deployment.md +0 -5
  120. data/templates/descriptions/email.md +0 -9
  121. data/templates/descriptions/factories.md +0 -12
  122. data/templates/descriptions/force_tls.md +0 -1
  123. data/templates/descriptions/forms.md +0 -1
  124. data/templates/descriptions/inline_svg.md +0 -2
  125. data/templates/descriptions/jobs.md +0 -3
  126. data/templates/descriptions/js_driver.md +0 -4
  127. data/templates/descriptions/json.md +0 -1
  128. data/templates/descriptions/lint.md +0 -3
  129. data/templates/descriptions/manifest.md +0 -2
  130. data/templates/descriptions/profiler.md +0 -7
  131. data/templates/descriptions/pull_requests.md +0 -4
  132. data/templates/descriptions/runner.md +0 -10
  133. data/templates/descriptions/single_redirect.md +0 -1
  134. data/templates/descriptions/static.md +0 -5
  135. data/templates/descriptions/stylelint.md +0 -3
  136. data/templates/descriptions/stylesheet_base.md +0 -1
  137. data/templates/descriptions/testing.md +0 -9
  138. data/templates/descriptions/timeout.md +0 -4
  139. data/templates/descriptions/views.md +0 -8
  140. data/templates/email.rb +0 -3
  141. data/templates/errors.rb +0 -35
  142. data/templates/flashes_helper.rb +0 -5
  143. data/templates/hound.yml +0 -15
  144. data/templates/json_encoding.rb +0 -1
  145. data/templates/oj.rb +0 -3
  146. data/templates/partials/ci_simplecov.rb +0 -14
  147. data/templates/partials/db_optimizations_configuration.rb +0 -7
  148. data/templates/partials/deployment_readme.md +0 -8
  149. data/templates/partials/email_smtp.rb +0 -2
  150. data/templates/partials/profiler_readme.md +0 -8
  151. data/templates/partials/pull_requests_config.rb +0 -5
  152. data/templates/partials/runner_readme.md +0 -31
  153. data/templates/partials/runner_setup.rb +0 -2
  154. data/templates/postcss.config.js +0 -8
  155. data/templates/postgresql_database.yml.erb +0 -20
  156. data/templates/rack_mini_profiler.rb +0 -7
  157. data/templates/rails_helper.rb +0 -25
  158. data/templates/sample_env +0 -12
  159. data/templates/secrets.yml +0 -8
  160. data/templates/smtp.rb +0 -9
  161. data/templates/spec_helper.rb +0 -25
  162. data/templates/suspenders_gitignore +0 -18
  163. data/templates/suspenders_layout.html.erb.erb +0 -23
  164. /data/{templates → lib/generators/templates/factories}/factories.rb +0 -0
  165. /data/{templates → lib/generators/templates/factories}/factory_bot_rspec.rb +0 -0
  166. /data/{templates → lib/generators/templates/inline_svg}/inline_svg.rb +0 -0
  167. /data/{templates → lib/generators/templates/lint}/stylelintrc.json +0 -0
  168. /data/{templates → lib/generators/templates/tasks}/dev.rake +0 -0
  169. /data/{templates → lib/generators/templates/testing}/action_mailer.rb +0 -0
  170. /data/{templates → lib/generators/templates/testing}/i18n.rb +0 -0
  171. /data/{templates/shoulda_matchers_config_rspec.rb → lib/generators/templates/testing/shoulda_matchers.rb} +0 -0
@@ -0,0 +1,165 @@
1
+ require "rails/generators"
2
+ require_relative "../../generators/suspenders/environments/development_generator"
3
+ require_relative "../../generators/suspenders/environments/test_generator"
4
+ require_relative "../../generators/suspenders/environments/production_generator"
5
+ require_relative "../../generators/suspenders/accessibility_generator"
6
+ require_relative "../../generators/suspenders/advisories_generator"
7
+ require_relative "../../generators/suspenders/email_generator"
8
+ require_relative "../../generators/suspenders/factories_generator"
9
+ require_relative "../../generators/suspenders/inline_svg_generator"
10
+ require_relative "../../generators/suspenders/jobs_generator"
11
+ require_relative "../../generators/suspenders/lint_generator"
12
+ require_relative "../../generators/suspenders/styles_generator"
13
+ require_relative "../../generators/suspenders/testing_generator"
14
+ require_relative "../../generators/suspenders/views_generator"
15
+
16
+ module Suspenders
17
+ module Cleanup
18
+ class GenerateReadme
19
+ include Suspenders::Generators::Helpers
20
+
21
+ def self.perform(readme, app_name)
22
+ new(readme, app_name).perform
23
+ end
24
+
25
+ attr_reader :readme, :app_name
26
+
27
+ def initialize(readme, app_name)
28
+ @readme = readme
29
+ @app_name = app_name
30
+ end
31
+
32
+ def perform
33
+ File.open(readme, "w+") do |file|
34
+ @file = file
35
+
36
+ heading app_name.titleize, level: 1
37
+
38
+ prerequisites
39
+
40
+ local_development
41
+
42
+ heading "Configuration", level: 2
43
+
44
+ heading "Test", level: 3
45
+ description_for Suspenders::Generators::Environments::TestGenerator
46
+
47
+ heading "Development", level: 3
48
+ description_for Suspenders::Generators::Environments::DevelopmentGenerator
49
+
50
+ heading "Production", level: 3
51
+ description_for Suspenders::Generators::Environments::ProductionGenerator
52
+
53
+ heading "Linting", level: 3
54
+ description_for Suspenders::Generators::LintGenerator
55
+
56
+ heading "Testing", level: 2
57
+ description_for Suspenders::Generators::TestingGenerator
58
+
59
+ heading "Factories", level: 3
60
+ description_for Suspenders::Generators::FactoriesGenerator
61
+
62
+ heading "Accessibility", level: 2
63
+ description_for Suspenders::Generators::AccessibilityGenerator
64
+ content <<~MARKDOWN
65
+ For more information, review the [Accessibility Tooling][] section in
66
+ the [CONTRIBUTING][] guide.
67
+
68
+ [Accessibility Tooling]: ./CONTRIBUTING.md#accessibility-tooling
69
+ [CONTRIBUTING]: ./CONTRIBUTING.md
70
+ MARKDOWN
71
+ new_line
72
+
73
+ heading "Advisories", level: 2
74
+ description_for Suspenders::Generators::AdvisoriesGenerator
75
+
76
+ heading "Mailers", level: 2
77
+ description_for Suspenders::Generators::EmailGenerator
78
+
79
+ heading "Jobs", level: 2
80
+ description_for Suspenders::Generators::JobsGenerator
81
+
82
+ heading "Layout and Assets", level: 2
83
+
84
+ heading "Stylesheets", level: 3
85
+ description_for Suspenders::Generators::StylesGenerator
86
+
87
+ heading "Inline SVG", level: 3
88
+ description_for Suspenders::Generators::InlineSvgGenerator
89
+
90
+ heading "Layout", level: 3
91
+ description_for Suspenders::Generators::ViewsGenerator
92
+ end
93
+ end
94
+
95
+ private
96
+
97
+ def content(text)
98
+ @file.write text
99
+ end
100
+
101
+ def new_line
102
+ @file.write "\n"
103
+ end
104
+
105
+ def heading(text, level:)
106
+ @file.write "#{"#" * level} #{text}\n"
107
+ new_line
108
+ end
109
+
110
+ def description_for(generator)
111
+ @file.write generator.desc
112
+ new_line
113
+ end
114
+
115
+ def local_development
116
+ @file.write <<~MARKDOWN
117
+ ## Local Development
118
+
119
+ ### Initial Setup
120
+
121
+ ```
122
+ bin/setup
123
+ ```
124
+
125
+ ### Running the Development Server
126
+
127
+ ```
128
+ bin/rails dev
129
+ ```
130
+
131
+ ### Seed Data
132
+
133
+ - Use `db/seeds.rb` to create records that need to exist in all environments.
134
+ - Use `lib/tasks/dev.rake` to create records that only need to exist in development.
135
+
136
+ Running `bin/setup` will run `dev:prime`.
137
+
138
+ ### Tasks
139
+
140
+ - Use `bin/rails suspenders:db:migrate` to run [database migrations][]. This script ensures they are [reversible][].
141
+ - Use `bin/rails suspenders:cleanup:organize_gemfile` to automatically organize the project's Gemfile.
142
+ - Use `bin/rails default` to run the default Rake task. This will do the following:
143
+ - Run the test suite.
144
+ - Run a Ruby and ERB linter.
145
+ - Scan the Ruby codebase for any dependency vulnerabilities.
146
+
147
+ [database migrations]: https://edgeguides.rubyonrails.org/active_record_migrations.html#running-migrations
148
+ [reversible]: https://edgeguides.rubyonrails.org/active_record_migrations.html#making-the-irreversible-possible
149
+
150
+ MARKDOWN
151
+ end
152
+
153
+ def prerequisites
154
+ heading "Prerequisites", level: 2
155
+
156
+ @file.write <<~MARKDOWN
157
+ Ruby: `#{Suspenders::MINIMUM_RUBY_VERSION}`
158
+ Node: `#{node_version}`
159
+ MARKDOWN
160
+
161
+ new_line
162
+ end
163
+ end
164
+ end
165
+ end
@@ -0,0 +1,134 @@
1
+ module Suspenders
2
+ module Cleanup
3
+ class OrganizeGemfile
4
+ def self.perform(gemfile)
5
+ new(gemfile).perform
6
+ end
7
+
8
+ attr_reader :gemfile, :current_lines, :new_lines, :new_line_markers,
9
+ :current_group, :gem_groups
10
+
11
+ def initialize(gemfile)
12
+ @gemfile = gemfile
13
+
14
+ @current_lines = File.read(gemfile).lines
15
+ @new_lines = []
16
+ @new_line_markers = []
17
+
18
+ @current_group = nil
19
+ @gem_groups = {}
20
+ end
21
+
22
+ def perform
23
+ remove_line_breaks
24
+ sort_gems_and_groups
25
+ add_gem_groups_to_gemfile
26
+ add_line_breaks
27
+ cleanup
28
+
29
+ File.open(gemfile, "w+") { _1.write new_lines.join }
30
+ end
31
+
32
+ private
33
+
34
+ def remove_line_breaks
35
+ current_lines.delete("\n")
36
+ end
37
+
38
+ def sort_gems_and_groups
39
+ current_lines.each do |line|
40
+ if line.starts_with?(/group/)
41
+ @current_group = line
42
+ end
43
+
44
+ # Consolidate gem groups
45
+ if current_group
46
+ if line.starts_with?(/end/)
47
+ @current_group = nil
48
+ elsif !line.starts_with?(/group/)
49
+ gem_groups[current_group] ||= []
50
+ gem_groups[current_group] << line
51
+ end
52
+ # Add non-grouped gems
53
+ elsif !line.starts_with?(/\n/)
54
+ new_lines << line
55
+ @current_group = nil
56
+ end
57
+ end
58
+ end
59
+
60
+ def add_gem_groups_to_gemfile
61
+ gem_groups.keys.each do |group|
62
+ gems = gem_groups[group]
63
+
64
+ gems.each_with_index do |gem, index|
65
+ if index == 0
66
+ new_lines << group
67
+ end
68
+
69
+ new_lines << gem
70
+
71
+ if gems.size == (index + 1)
72
+ new_lines << "end\n"
73
+ end
74
+ end
75
+ end
76
+ end
77
+
78
+ def add_line_breaks
79
+ new_lines.each_with_index do |line, index|
80
+ previous_line = new_lines[index - 1] if index > 0
81
+ next_line = new_lines[index + 1]
82
+ marker = index + 1
83
+
84
+ # Add line break if it's a gem and the next line is commented out
85
+ if (line.starts_with?(/\s*gem/) || line.starts_with?(/\s*\#\s*gem/)) && next_line&.starts_with?(/\s*\#/)
86
+ new_line_markers << marker
87
+ end
88
+
89
+ # Add line break if it's a commented out gem and the next line is a gem
90
+ if line.starts_with?(/\s*\#\s*gem/) && next_line&.starts_with?(/\s*gem/)
91
+ new_line_markers << marker
92
+ end
93
+
94
+ # Add line break if it's a gem with a comment and the next line is a gem
95
+ if previous_line&.starts_with?(/\s*\#/) \
96
+ && line.starts_with?(/\s*gem/) \
97
+ && next_line&.starts_with?(/\s*gem/) \
98
+ && !previous_line.starts_with?(/\s*\#\s*gem/)
99
+ new_line_markers << marker
100
+ end
101
+
102
+ # Add a line break if it's /end/
103
+ if line.starts_with?(/end/)
104
+ new_line_markers << marker
105
+ end
106
+
107
+ # Add a line break if it's a gem and the next line is a group
108
+ if line.starts_with?(/gem/) && next_line&.starts_with?(/group/)
109
+ new_line_markers << marker
110
+ end
111
+
112
+ # Add line break if it's /source/ or /ruby/
113
+ if line.starts_with?(/\w/) && !line.starts_with?(/\s*(gem|group|end)/)
114
+ new_line_markers << marker
115
+ end
116
+ end
117
+
118
+ new_line_markers.each_with_index do |marker, index|
119
+ # Each time we insert, the original marker if off by 1
120
+ marker_offset = marker + index
121
+
122
+ new_lines.insert(marker_offset, "\n")
123
+ end
124
+ end
125
+
126
+ def cleanup
127
+ # Remove last line
128
+ if /\n/.match?(new_lines.last)
129
+ new_lines.pop
130
+ end
131
+ end
132
+ end
133
+ end
134
+ end
@@ -0,0 +1,5 @@
1
+ module Suspenders
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Suspenders
4
+ end
5
+ end
@@ -0,0 +1,126 @@
1
+ require "active_support/concern"
2
+
3
+ module Suspenders
4
+ module Generators
5
+ module Helpers
6
+ def default_test_suite?
7
+ File.exist? Rails.root.join("test")
8
+ end
9
+
10
+ def rspec_test_suite?
11
+ File.exist? Rails.root.join("spec/spec_helper.rb")
12
+ end
13
+
14
+ def default_test_helper_present?
15
+ File.exist? Rails.root.join("test/test_helper.rb")
16
+ end
17
+
18
+ def rspec_test_helper_present?
19
+ File.exist? Rails.root.join("spec/rails_helper.rb")
20
+ end
21
+
22
+ def node_version
23
+ ENV["NODE_VERSION"] || `node --version`[/\d+\.\d+\.\d+/]
24
+ end
25
+
26
+ def node_not_installed?
27
+ !node_version.present?
28
+ end
29
+
30
+ def node_version_unsupported?
31
+ node_version < Suspenders::MINIMUM_NODE_VERSION
32
+ end
33
+ end
34
+
35
+ module APIAppUnsupported
36
+ class Error < StandardError
37
+ def message
38
+ "This generator cannot be used on API only applications."
39
+ end
40
+ end
41
+
42
+ extend ActiveSupport::Concern
43
+
44
+ included do
45
+ def raise_if_api_only_app
46
+ if api_only_app?
47
+ raise Suspenders::Generators::APIAppUnsupported::Error
48
+ end
49
+ end
50
+ end
51
+
52
+ private
53
+
54
+ def api_only_app?
55
+ File.read(Rails.root.join("config/application.rb"))
56
+ .match?(/^\s*config\.api_only\s*=\s*true/i)
57
+ end
58
+ end
59
+
60
+ module DatabaseUnsupported
61
+ include Helpers
62
+
63
+ class Error < StandardError
64
+ def message
65
+ "This generator requires PostgreSQL"
66
+ end
67
+ end
68
+
69
+ extend ActiveSupport::Concern
70
+
71
+ included do
72
+ def raise_if_database_unsupported
73
+ if database_unsupported?
74
+ raise Suspenders::Generators::DatabaseUnsupported::Error
75
+ end
76
+ end
77
+
78
+ private
79
+
80
+ def database_unsupported?
81
+ configuration = File.read(Rails.root.join("config/database.yml"))
82
+ configuration = YAML.safe_load(configuration, aliases: true)
83
+ adapter = configuration["default"]["adapter"]
84
+
85
+ adapter != "postgresql"
86
+ end
87
+ end
88
+ end
89
+
90
+ module NodeNotInstalled
91
+ class Error < StandardError
92
+ def message
93
+ "This generator requires Node"
94
+ end
95
+ end
96
+
97
+ extend ActiveSupport::Concern
98
+
99
+ included do
100
+ def raise_if_node_not_installed
101
+ if node_not_installed?
102
+ raise Suspenders::Generators::NodeNotInstalled::Error
103
+ end
104
+ end
105
+ end
106
+ end
107
+
108
+ module NodeVersionUnsupported
109
+ class Error < StandardError
110
+ def message
111
+ "This generator requires Node >= #{Suspenders::MINIMUM_NODE_VERSION}"
112
+ end
113
+ end
114
+
115
+ extend ActiveSupport::Concern
116
+
117
+ included do
118
+ def raise_if_node_version_unsupported
119
+ if node_version_unsupported?
120
+ raise Suspenders::Generators::NodeVersionUnsupported::Error
121
+ end
122
+ end
123
+ end
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,4 @@
1
+ module Suspenders
2
+ class Railtie < ::Rails::Railtie
3
+ end
4
+ end
@@ -1,8 +1,6 @@
1
1
  module Suspenders
2
- RAILS_VERSION = "~> 7.0.0".freeze
3
- RUBY_VERSION = IO
4
- .read("#{File.dirname(__FILE__)}/../../.ruby-version")
5
- .strip
6
- .freeze
7
- VERSION = "20230113.0".freeze
2
+ VERSION = "20240516.0".freeze
3
+ RAILS_VERSION = "~> 7.0".freeze
4
+ MINIMUM_RUBY_VERSION = ">= 3.1".freeze
5
+ MINIMUM_NODE_VERSION = "20.0.0".freeze
8
6
  end
data/lib/suspenders.rb CHANGED
@@ -1,34 +1,10 @@
1
1
  require "suspenders/version"
2
- require "suspenders/exit_on_failure"
3
- require "suspenders/generators/accessibility_generator"
4
- require "suspenders/generators/advisories_generator"
5
- require "suspenders/generators/app_generator"
6
- require "suspenders/generators/static_generator"
7
- require "suspenders/generators/stylesheet_base_generator"
8
- require "suspenders/generators/stylelint_generator"
9
- require "suspenders/generators/forms_generator"
10
- require "suspenders/generators/ci_generator"
11
- require "suspenders/generators/db_optimizations_generator"
12
- require "suspenders/generators/factories_generator"
13
- require "suspenders/generators/lint_generator"
14
- require "suspenders/generators/jobs_generator"
15
- require "suspenders/generators/analytics_generator"
16
- require "suspenders/generators/views_generator"
17
- require "suspenders/generators/js_driver_generator"
18
- require "suspenders/generators/json_generator"
19
- require "suspenders/generators/testing_generator"
20
- require "suspenders/generators/inline_svg_generator"
21
- require "suspenders/generators/profiler_generator"
22
- require "suspenders/generators/runner_generator"
23
- require "suspenders/generators/production/force_tls_generator"
24
- require "suspenders/generators/production/compression_generator"
25
- require "suspenders/generators/production/email_generator"
26
- require "suspenders/generators/production/timeout_generator"
27
- require "suspenders/generators/production/deployment_generator"
28
- require "suspenders/generators/production/manifest_generator"
29
- require "suspenders/generators/production/single_redirect"
30
- require "suspenders/generators/staging/pull_requests_generator"
31
- require "suspenders/actions"
32
- require "suspenders/actions/strip_comments_action"
33
- require "suspenders/adapters/heroku"
34
- require "suspenders/app_builder"
2
+ require "suspenders/engine"
3
+ require "suspenders/railtie"
4
+ require "suspenders/generators"
5
+ require "suspenders/cleanup/organize_gemfile"
6
+ require "suspenders/cleanup/generate_readme"
7
+
8
+ module Suspenders
9
+ # Your code goes here...
10
+ end
@@ -0,0 +1,37 @@
1
+ namespace :suspenders do
2
+ desc "Extend the default Rails Rake task"
3
+ task :rake do
4
+ if Bundler.rubygems.find_name("bundler-audit").any?
5
+ Rake::Task[:"bundle:audit"].invoke
6
+ end
7
+
8
+ if Bundler.rubygems.find_name("standard").any?
9
+ Rake::Task[:standard].invoke
10
+ end
11
+ end
12
+
13
+ desc "Ensure a migration is reversible"
14
+ namespace :db do
15
+ task :migrate do
16
+ Rake::Task["db:migrate"].invoke
17
+ Rake::Task["db:rollback"].invoke
18
+
19
+ Rake::Task["db:migrate"].reenable
20
+ Rake::Task["db:migrate"].invoke
21
+
22
+ Rake::Task["db:test:prepare"].invoke
23
+ end
24
+ end
25
+
26
+ namespace :cleanup do
27
+ desc "Organizes Gemfile"
28
+ task organize_gemfile: :environment do
29
+ Suspenders::Cleanup::OrganizeGemfile.perform(Rails.root.join("Gemfile"))
30
+ end
31
+
32
+ desc "Generate README"
33
+ task :generate_readme do
34
+ Suspenders::Cleanup::GenerateReadme.perform(Rails.root.join("README.md"), Rails.application.class.module_parent_name)
35
+ end
36
+ end
37
+ end