nextgen 0.13.0 → 0.15.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 (88) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/exe/nextgen +1 -0
  4. data/lib/nextgen/actions/bundler.rb +5 -3
  5. data/lib/nextgen/actions/git.rb +2 -0
  6. data/lib/nextgen/actions/yarn.rb +3 -1
  7. data/lib/nextgen/actions.rb +6 -4
  8. data/lib/nextgen/cli.rb +2 -0
  9. data/lib/nextgen/commands/create.rb +3 -1
  10. data/lib/nextgen/ext/prompt/list.rb +2 -0
  11. data/lib/nextgen/ext/prompt/multilist.rb +2 -0
  12. data/lib/nextgen/generators/action_mailer.rb +2 -0
  13. data/lib/nextgen/generators/annotate.rb +2 -0
  14. data/lib/nextgen/generators/base.rb +4 -0
  15. data/lib/nextgen/generators/basic_auth.rb +2 -0
  16. data/lib/nextgen/generators/brakeman.rb +2 -0
  17. data/lib/nextgen/generators/bundler_audit.rb +2 -0
  18. data/lib/nextgen/generators/capybara_lockstep.rb +9 -1
  19. data/lib/nextgen/generators/clean_gemfile.rb +2 -0
  20. data/lib/nextgen/generators/dotenv.rb +2 -0
  21. data/lib/nextgen/generators/erb_lint.rb +2 -0
  22. data/lib/nextgen/generators/eslint.rb +2 -0
  23. data/lib/nextgen/generators/factory_bot_rails.rb +2 -0
  24. data/lib/nextgen/generators/git_safe.rb +2 -0
  25. data/lib/nextgen/generators/github_actions.rb +2 -0
  26. data/lib/nextgen/generators/github_pr_template.rb +2 -0
  27. data/lib/nextgen/generators/good_migrations.rb +2 -0
  28. data/lib/nextgen/generators/home_controller.rb +2 -0
  29. data/lib/nextgen/generators/initial_git_commit.rb +2 -0
  30. data/lib/nextgen/generators/letter_opener.rb +2 -0
  31. data/lib/nextgen/generators/node.rb +2 -0
  32. data/lib/nextgen/generators/open_browser_on_start.rb +2 -0
  33. data/lib/nextgen/generators/overcommit.rb +2 -0
  34. data/lib/nextgen/generators/pgcli_rails.rb +2 -0
  35. data/lib/nextgen/generators/rack_canonical_host.rb +2 -0
  36. data/lib/nextgen/generators/rack_mini_profiler.rb +2 -0
  37. data/lib/nextgen/generators/rspec_rails.rb +2 -0
  38. data/lib/nextgen/generators/rspec_system_testing.rb +3 -1
  39. data/lib/nextgen/generators/rubocop.rb +2 -0
  40. data/lib/nextgen/generators/shoulda.rb +2 -0
  41. data/lib/nextgen/generators/sidekiq.rb +2 -0
  42. data/lib/nextgen/generators/staging.rb +2 -0
  43. data/lib/nextgen/generators/stylelint.rb +2 -0
  44. data/lib/nextgen/generators/thor.rb +2 -0
  45. data/lib/nextgen/generators/tomo.rb +2 -0
  46. data/lib/nextgen/generators/vcr.rb +2 -0
  47. data/lib/nextgen/generators/vite.rb +3 -1
  48. data/lib/nextgen/generators.rb +3 -1
  49. data/lib/nextgen/rails.rb +4 -2
  50. data/lib/nextgen/rails_options.rb +2 -0
  51. data/lib/nextgen/thor_extensions.rb +3 -1
  52. data/lib/nextgen/tidy_gemfile.rb +5 -3
  53. data/lib/nextgen/version.rb +3 -1
  54. data/lib/nextgen.rb +2 -0
  55. data/template/.erb-lint.yml.tt +2 -0
  56. data/template/.rubocop.yml.tt +0 -3
  57. data/template/Thorfile +2 -0
  58. data/template/app/controllers/concerns/basic_auth.rb +2 -0
  59. data/template/app/controllers/home_controller.rb +2 -0
  60. data/template/app/helpers/inline_svg_helper.rb +2 -0
  61. data/template/bin/setup +4 -3
  62. data/template/config/environments/staging.rb +2 -0
  63. data/template/config/initializers/generators.rb +2 -0
  64. data/template/config/initializers/rack_mini_profiler.rb +2 -0
  65. data/template/config/initializers/sidekiq.rb +2 -0
  66. data/template/lib/puma/plugin/open.rb +2 -0
  67. data/template/lib/tasks/auto_annotate_models.rake +2 -0
  68. data/template/lib/tasks/erblint.rake +2 -0
  69. data/template/lib/tasks/eslint.rake +2 -0
  70. data/template/lib/tasks/rubocop.rake +2 -0
  71. data/template/lib/tasks/stylelint.rake +2 -0
  72. data/template/lib/templates/rspec/system/system_spec.rb +2 -0
  73. data/template/lib/vite_inline_svg_file_loader.rb +2 -0
  74. data/template/spec/support/factory_bot.rb +2 -0
  75. data/template/spec/support/mailer.rb +2 -0
  76. data/template/spec/support/shoulda.rb +2 -0
  77. data/template/spec/support/system.rb +2 -0
  78. data/template/spec/support/webmock.rb +2 -0
  79. data/template/test/application_system_test_case.rb +2 -0
  80. data/template/test/helpers/inline_svg_helper_test.rb +2 -0
  81. data/template/test/support/capybara.rb.tt +15 -10
  82. data/template/test/support/factory_bot.rb +2 -0
  83. data/template/test/support/mailer.rb +2 -0
  84. data/template/test/support/shoulda.rb +2 -0
  85. data/template/test/support/vcr.rb.tt +2 -0
  86. data/template/test/support/webmock.rb +2 -0
  87. data/template/test/vite_helper.rb +2 -0
  88. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0887dbfdc72d4e7001ee53d66bdd685b799b6681e7664a38c99c91db3ba1d7fd'
4
- data.tar.gz: 552960fbfd1cc3cdabc97737273bffffca30c6e2412ed00c44b477d23ce9b0aa
3
+ metadata.gz: d8205ff3de045b2343981785aeba004a4730b708915c47e989ed2ddf566adfb5
4
+ data.tar.gz: ab88579fb4a7e827bd8464176368f27cfb3c595145d11279a0422bbc33a02b3f
5
5
  SHA512:
6
- metadata.gz: dd040d70b511dbbd4b94ed1d4d6ccb1f07dc77b377eb8b8cd6a8eee1fd7989ebf6c9865068400372890b19c3f7469ccccbcfff97e8da72b111073ef1457f6d7c
7
- data.tar.gz: 96a75604412e93edae9232c5c5930423171140ef74ea2d04b23ac9d90e21bd4c0e677d48b8dc9dad80b59d9de8767eb91ea57407d811b74575772d873660627c
6
+ metadata.gz: bcecb49b31305607a4b0ad25e83625d2743f69b5e5a33a91d0daa778c60037cd61d2b708bfc856457774bc5958a46acec33a578f11d9a8b55438d168696fe152
7
+ data.tar.gz: 42bb4e8a64a011d3aa7d09fc1fb4160313c7c636bc6ade2ef2bfabe8e459561bc4654660a837a03867c2b18bbc1ff148fef47fee5be58649b9c746226aa0d0a1
data/README.md CHANGED
@@ -28,7 +28,7 @@ Nextgen is an **interactive** and flexible alternative to `rails new` that inclu
28
28
 
29
29
  Nextgen generates apps using **Rails 7.1**.
30
30
 
31
- - **Ruby 3.0+** is required
31
+ - **Ruby 3.1+** is required
32
32
  - **Rubygems 3.4.8+** is required (run `gem update --system` to get it)
33
33
  - **Node 18.12+ and Yarn** are required if you choose Vite or other Node-based options
34
34
  - Additional tools may be required depending on the options you select (e.g. PostgreSQL)
data/exe/nextgen CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "nextgen"
4
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Nextgen
2
4
  module Actions::Bundler
3
5
  def binstubs(*gems)
@@ -13,7 +15,7 @@ module Nextgen
13
15
  false
14
16
  else
15
17
  say_status :gemfile, [name, version].compact.join(", ")
16
- gemfile.add(name, version: version, group: group, require: require)
18
+ gemfile.add(name, version:, group:, require:)
17
19
  true
18
20
  end
19
21
  end
@@ -21,7 +23,7 @@ module Nextgen
21
23
 
22
24
  gemfile.save
23
25
  cmd = "install"
24
- cmd << " --quiet" if noisy_bundler_version?
26
+ cmd += " --quiet" if noisy_bundler_version?
25
27
  bundle_command! cmd
26
28
  end
27
29
  alias install_gem install_gems
@@ -44,7 +46,7 @@ module Nextgen
44
46
 
45
47
  Bundler.with_original_env do
46
48
  say_status :bundle, cmd, :green if verbose
47
- run! full_command, env: {"BUNDLE_IGNORE_MESSAGES" => "1"}, verbose: false, capture: capture
49
+ run! full_command, env: {"BUNDLE_IGNORE_MESSAGES" => "1"}, verbose: false, capture:
48
50
  end
49
51
  end
50
52
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "open3"
2
4
  require "securerandom"
3
5
  require "shellwords"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Nextgen
2
4
  module Actions::Yarn
3
5
  def add_yarn_packages(*packages, dev: false)
@@ -7,7 +9,7 @@ module Nextgen
7
9
  alias add_yarn_package add_yarn_packages
8
10
 
9
11
  def remove_yarn_packages(*packages, capture: false)
10
- yarn_command "remove #{packages.map(&:shellescape).join(" ")}", capture: capture
12
+ yarn_command "remove #{packages.map(&:shellescape).join(" ")}", capture:
11
13
  end
12
14
  alias remove_yarn_package remove_yarn_packages
13
15
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Nextgen
2
4
  module Actions
3
5
  include Bundler
@@ -22,7 +24,7 @@ module Nextgen
22
24
  result, status = Open3.capture2e(env, cmd)
23
25
  success = status.success?
24
26
  else
25
- result = success = run(cmd, env: env, verbose: verbose)
27
+ result = success = run(cmd, env:, verbose:)
26
28
  end
27
29
 
28
30
  return result if success
@@ -82,9 +84,9 @@ module Nextgen
82
84
 
83
85
  def document_deploy_var(var_name, desc = nil, required: false, default: nil)
84
86
  insertion = "`#{var_name}`"
85
- insertion << " **REQUIRED**" if required
86
- insertion << " - #{desc}" if desc.present?
87
- insertion << " (default: #{default})" unless default.nil?
87
+ insertion += " **REQUIRED**" if required
88
+ insertion += " - #{desc}" if desc.present?
89
+ insertion += " (default: #{default})" unless default.nil?
88
90
 
89
91
  copy_file "DEPLOYMENT.md" unless File.exist?("DEPLOYMENT.md")
90
92
  inject_into_file "DEPLOYMENT.md", "#{insertion}\n- ", after: /^## Environment variables.*?^- /m
data/lib/nextgen/cli.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "thor"
2
4
 
3
5
  module Nextgen
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "active_support/core_ext/string/inflections"
2
4
  require "fileutils"
3
5
  require "forwardable"
@@ -242,7 +244,7 @@ module Nextgen
242
244
  end
243
245
 
244
246
  def ask_optional_enhancements
245
- @generators = Generators.compatible_with(rails_opts: rails_opts)
247
+ @generators = Generators.compatible_with(rails_opts:)
246
248
 
247
249
  answers = prompt.multi_select(
248
250
  "Which optional enhancements would you like to add?",
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "tty-prompt"
2
4
  require "tty-screen"
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "tty-prompt"
2
4
 
3
5
  module Nextgen::Ext
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  say_git "Configure Action Mailer for testing"
2
4
  copy_test_support_file "mailer.rb"
3
5
  if minitest?
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  install_gem "annotate", group: :development
2
4
  copy_file "lib/tasks/auto_annotate_models.rake"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  say_git "Add improved bin/setup script"
2
4
  copy_file "bin/setup", mode: :preserve, force: true
3
5
 
@@ -29,6 +31,8 @@ if File.exist?("test/application_system_test_case.rb")
29
31
  say_git "Configure system tests"
30
32
  copy_test_support_file "capybara.rb.tt"
31
33
  copy_file "test/application_system_test_case.rb", force: true
34
+ gsub_file "Gemfile", /gem "capybara"$/, '\0, require: false'
35
+ gsub_file "Gemfile", /gem "selenium-webdriver"$/, '\0, require: false'
32
36
  end
33
37
 
34
38
  if File.exist?(".ruby-version") && File.read(".ruby-version").match?(/\A\d+\.\d+.\d+.\s*\z/m)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  document_deploy_var "BASIC_AUTH_PASSWORD"
2
4
  document_deploy_var "BASIC_AUTH_USERNAME",
3
5
  "If this and `BASIC_AUTH_PASSWORD` are present, visitors must use these credentials to access the app"
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  install_gem "brakeman", group: :development, require: false
2
4
  binstub "brakeman"
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  install_gem "bundler-audit", group: :development, require: false
2
4
  binstub "bundler-audit"
@@ -1,4 +1,12 @@
1
- install_gem "capybara-lockstep", group: :test
1
+ # frozen_string_literal: true
2
+
3
+ install_gem "capybara-lockstep", group: :test, require: false
4
+
2
5
  inject_into_file "app/views/layouts/application.html.erb",
3
6
  "\n <%= capybara_lockstep if defined?(Capybara::Lockstep) %>",
4
7
  after: /<head\b.*$/
8
+
9
+ capybara_path = rspec? ? "spec/support/capybara.rb" : "test/support/capybara.rb"
10
+ inject_into_file capybara_path,
11
+ "\n require \"capybara-lockstep\"",
12
+ after: /require "capybara".*$/
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Nextgen::TidyGemfile.clean!
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  install_gem "dotenv", version: ">= 3.0", group: %i[development test]
2
4
  copy_file ".env.sample"
3
5
  gitignore "/.env*", "!/.env.sample"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  say_git "Install erb_lint"
2
4
  install_gem "erb_lint", group: :development, require: false
3
5
  binstub "erb_lint"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  say_git "Install eslint"
2
4
  add_yarn_packages(
3
5
  "@eslint/js",
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  say_git "Install factory_bot_rails"
2
4
  install_gem "factory_bot_rails", group: %i[development test]
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  if Dir.exist?(".git")
2
4
  say_git "Mark project as trusted so bin/ can be added to PATH"
3
5
  empty_directory ".git/safe"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  gems = File.exist?("Gemfile") ? File.read("Gemfile").scan(/^\s*gem ["'](.+?)["']/).flatten : []
2
4
  template ".github/workflows/ci.yml.tt", context: binding
3
5
  copy_file ".github/dependabot.yml"
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  template ".github/PULL_REQUEST_TEMPLATE.md.tt"
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  install_gem "good_migrations"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  copy_file "app/controllers/home_controller.rb"
2
4
  template "app/views/home/index.html.erb.tt"
3
5
  route 'root "home#index"'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  commit_msg = "tmp/initial_nextgen_commit"
2
4
  return unless git_working? && File.exist?(commit_msg)
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  say_git "Install letter_opener"
2
4
  install_gem "letter_opener", group: :development
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  say_git "Add Node and Yarn prerequisites"
2
4
  copy_file "package.json" unless File.exist?("package.json")
3
5
  inject_into_file "README.md", "\n- Node 18 (LTS) or newer\n- Yarn 1.x (classic)", after: /^- Ruby.*$/
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  say_git "Install launchy"
2
4
  install_gem "launchy", group: %i[development test]
3
5
 
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  template ".overcommit.yml"
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  install_gem "pgcli-rails", group: :development
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  say_git "Install rack-canonical-host"
2
4
  install_gem "rack-canonical-host"
3
5
 
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  install_gem "rack-mini-profiler", group: :development
2
4
  copy_file "config/initializers/rack_mini_profiler.rb" if File.read("Gemfile").match?(/^\s*gem ['"]turbo-rails['"]/)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  say_git "Install the rspec-rails gem"
2
4
  install_gem "rspec-rails", group: %i[development test]
3
5
 
@@ -1,4 +1,6 @@
1
- install_gems "capybara", "selenium-webdriver", group: :test
1
+ # frozen_string_literal: true
2
+
3
+ install_gems "capybara", "selenium-webdriver", group: :test, require: false
2
4
  copy_test_support_file "capybara.rb.tt"
3
5
  copy_test_support_file "system.rb"
4
6
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  say_git "Install rubocop gems"
2
4
  gemfile = File.read("Gemfile")
3
5
  plugins = []
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  say_git "Install shoulda gems"
2
4
  install_gem "shoulda-context", group: :test if minitest?
3
5
  install_gem "shoulda-matchers", group: :test
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  say_git "Install the sidekiq gem in the :production group, with a binstub"
2
4
  install_gem "sidekiq", version: "~> 7.0", group: :production
3
5
  binstub "sidekiq"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  copy_file "config/environments/staging.rb"
2
4
  gsub_file "DEPLOYMENT.md", '"production"', '"production" or "staging"' if File.exist?("DEPLOYMENT.md")
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  say_git "Install stylelint"
2
4
  add_yarn_packages(
3
5
  "stylelint",
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  copy_file "Thorfile"
2
4
  binstub "thor"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  say_git "Install the tomo gem in the :development group, with a binstub"
2
4
  install_gem "tomo", version: "~> 1.18", group: :development, require: false
3
5
  binstub "tomo"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  install_gems "vcr", "webmock", group: :test
2
4
  copy_test_support_file "vcr.rb.tt"
3
5
  copy_test_support_file "webmock.rb"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  say_git "Install the vite_rails gem"
2
4
  install_gem "vite_rails", version: "~> 3.0"
3
5
 
@@ -92,7 +94,7 @@ copy_file "test/helpers/inline_svg_helper_test.rb" if File.exist?("test/vite_hel
92
94
 
93
95
  say_git "Add a `yarn start` script"
94
96
  start = "concurrently -i -k --kill-others-on-fail -p none 'RUBY_DEBUG_OPEN=true bin/rails s' 'bin/vite dev'"
95
- add_package_json_script start: start
97
+ add_package_json_script(start:)
96
98
  add_yarn_package "concurrently", dev: true
97
99
  gsub_file "README.md", %r{bin/rails s(erver)?}, "yarn start"
98
100
  gsub_file "bin/setup", %r{bin/rails s(erver)?}, "yarn start"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "yaml"
2
4
 
3
5
  module Nextgen
@@ -40,7 +42,7 @@ module Nextgen
40
42
  name = name.to_sym
41
43
  raise ArgumentError, "Generator #{name.inspect} was already added" if generators.key?(name)
42
44
 
43
- generators[name] = {node: node, prompt: prompt, description: description}
45
+ generators[name] = {node:, prompt:, description:}
44
46
  activate(name) unless prompt
45
47
  end
46
48
 
data/lib/nextgen/rails.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rails/version"
2
4
 
3
5
  module Nextgen
@@ -29,10 +31,10 @@ module Nextgen
29
31
  Thor::Base.shell.new.say_status(...)
30
32
  end
31
33
 
32
- def with_original_bundler_env(&block)
34
+ def with_original_bundler_env(&)
33
35
  return yield unless defined?(Bundler)
34
36
 
35
- Bundler.with_original_env(&block)
37
+ Bundler.with_original_env(&)
36
38
  end
37
39
  end
38
40
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Nextgen
2
4
  class RailsOptions
3
5
  DATABASES = %w[
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Nextgen
2
4
  module ThorExtensions
3
5
  def self.extended(base)
@@ -23,7 +25,7 @@ module Nextgen
23
25
 
24
26
  if given_args.first == "help"
25
27
  retry_with_args = ["help"] if given_args.length > 1
26
- elsif (e.unknown & %w[-h --help]).any?
28
+ elsif e.unknown.intersect?(%w[-h --help])
27
29
  retry_with_args = ["help", (given_args - e.unknown).first]
28
30
  end
29
31
  raise unless retry_with_args.any?
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Nextgen
2
4
  class TidyGemfile
3
5
  def self.clean!(path = "Gemfile")
@@ -27,7 +29,7 @@ module Nextgen
27
29
  def add(gem, version: nil, group: nil, require: nil)
28
30
  return false if include?(gem)
29
31
 
30
- gem_line = build_gem_line(gem, version: version, require: require, indent: group ? " " : "")
32
+ gem_line = build_gem_line(gem, version:, require:, indent: group ? " " : "")
31
33
 
32
34
  if group
33
35
  group_line = create_group_if_needed(group)
@@ -62,8 +64,8 @@ module Nextgen
62
64
 
63
65
  def build_gem_line(gem, version:, require:, indent:)
64
66
  line = %(gem "#{gem}")
65
- line << ", #{version.to_s.inspect}" if version
66
- line << ", require: #{require.inspect}" unless require.nil?
67
+ line += ", #{version.to_s.inspect}" if version
68
+ line += ", require: #{require.inspect}" unless require.nil?
67
69
 
68
70
  indent + line + "\n"
69
71
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Nextgen
2
- VERSION = "0.13.0".freeze
4
+ VERSION = "0.15.0"
3
5
  end
data/lib/nextgen.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "pathname"
2
4
  require "zeitwerk"
3
5
 
@@ -22,4 +22,6 @@ linters:
22
22
  Enabled: false
23
23
  Rails/OutputSafety:
24
24
  Enabled: false
25
+ Style/FrozenStringLiteralComment:
26
+ Enabled: false
25
27
  <% end -%>
@@ -223,9 +223,6 @@ Style/FetchEnvVar:
223
223
  Style/FormatStringToken:
224
224
  Enabled: false
225
225
 
226
- Style/FrozenStringLiteralComment:
227
- Enabled: false
228
-
229
226
  Style/GuardClause:
230
227
  Enabled: false
231
228
 
data/template/Thorfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "config/environment" unless %w[-h --help help -T list -v version].include?(ARGV.first)
2
4
 
3
5
  class << Thor
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module BasicAuth
2
4
  extend ActiveSupport::Concern
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class HomeController < ApplicationController
2
4
  def index
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module InlineSvgHelper
2
4
  def inline_svg_tag(filename, title: nil)
3
5
  svg = ViteInlineSvgFileLoader.named(filename)
data/template/bin/setup CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  # This script is a way to set up or update your development environment automatically.
4
5
  # This script is idempotent, so that you can run it at any time and get an expectable outcome.
@@ -27,7 +28,7 @@ def run(command, echo: true, silent: false, exception: true)
27
28
  say_status(:run, command, :blue) if echo
28
29
  with_original_bundler_env do
29
30
  options = silent ? {out: File::NULL, err: File::NULL} : {}
30
- system(command, exception: exception, **options)
31
+ system(command, exception:, **options)
31
32
  end
32
33
  end
33
34
 
@@ -59,10 +60,10 @@ def git_safe_needed?
59
60
  ENV["PATH"].include?(".git/safe/../../bin") && !Dir.exist?(".git/safe")
60
61
  end
61
62
 
62
- def with_original_bundler_env(&block)
63
+ def with_original_bundler_env(&)
63
64
  return yield unless defined?(Bundler)
64
65
 
65
- Bundler.with_original_env(&block)
66
+ Bundler.with_original_env(&)
66
67
  end
67
68
 
68
69
  def env(env_file, from:)
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The staging environment is based on production
2
4
  require_relative "production"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Rails.application.config.generators do |g|
2
4
  # Disable generators we don't need.
3
5
  g.javascripts false
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  return unless defined?(Rack::MiniProfiler)
2
4
 
3
5
  # https://github.com/MiniProfiler/rack-mini-profiler#configuration-options
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  return unless defined?(Sidekiq)
2
4
 
3
5
  # Disable SSL certificate verification if using Heroku Redis
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "puma/plugin"
2
4
 
3
5
  Puma::Plugin.create do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  return unless Rails.env.development?
2
4
 
3
5
  require "annotate"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  desc "Run erblint"
2
4
  task :erblint do
3
5
  sh "bin/erblint --lint-all"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  desc "Run ESLint"
2
4
  task :eslint do
3
5
  sh "yarn lint:js"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  return unless Gem.loaded_specs.key?("rubocop")
2
4
 
3
5
  require "rubocop/rake_task"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  desc "Run Stylelint"
2
4
  task :stylelint do
3
5
  sh "yarn lint:css"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rails_helper"
2
4
 
3
5
  RSpec.describe "<%= class_name %>" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ViteInlineSvgFileLoader
2
4
  class << self
3
5
  def named(filename)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.configure do |config|
2
4
  config.include FactoryBot::Syntax::Methods
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.configure do |config|
2
4
  config.before(:each) do
3
5
  ActionMailer::Base.deliveries.clear
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Shoulda::Matchers.configure do |config|
2
4
  config.integrate do |with|
3
5
  with.test_framework :rspec
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.configure do |config|
2
4
  config.before(:each, type: :system) do
3
5
  driven_by :selenium,
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "webmock/rspec"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
  require "vite_helper"
3
5
 
@@ -1,12 +1,17 @@
1
- require "capybara/rails"
2
- <% if rspec? -%>
3
- require "capybara/rspec"
4
- <% end -%>
1
+ # frozen_string_literal: true
5
2
 
6
- Capybara.configure do |config|
7
- config.default_max_wait_time = 2
8
- config.save_path = "tmp/screenshots"
9
- config.enable_aria_label = true
10
- config.server = :puma, {Silent: true}
11
- config.test_id = "data-testid"
3
+ ActiveSupport.on_load(:action_dispatch_system_test_case) do
4
+ require "capybara"
5
+ require "capybara/rails"
6
+ <% if rspec? -%>
7
+ require "capybara/rspec"
8
+ <% end -%>
9
+
10
+ Capybara.configure do |config|
11
+ config.default_max_wait_time = 2
12
+ config.save_path = "tmp/screenshots"
13
+ config.enable_aria_label = true
14
+ config.server = :puma, {Silent: true}
15
+ config.test_id = "data-testid"
16
+ end
12
17
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ActiveSupport.on_load(:active_support_test_case) do
2
4
  include FactoryBot::Syntax::Methods
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ActiveSupport.on_load(:active_support_test_case) do
2
4
  setup { ActionMailer::Base.deliveries.clear }
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Shoulda::Matchers.configure do |config|
2
4
  config.integrate do |with|
3
5
  with.test_framework :minitest
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "vcr"
2
4
 
3
5
  VCR.configure do |config|
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "webmock/minitest"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  return if ViteRuby.config.auto_build
2
4
 
3
5
  # Compile assets once at the start of testing
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nextgen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Brictson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-12 00:00:00.000000000 Z
11
+ date: 2024-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -215,14 +215,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
215
215
  requirements:
216
216
  - - ">="
217
217
  - !ruby/object:Gem::Version
218
- version: '3.0'
218
+ version: '3.1'
219
219
  required_rubygems_version: !ruby/object:Gem::Requirement
220
220
  requirements:
221
221
  - - ">="
222
222
  - !ruby/object:Gem::Version
223
223
  version: '0'
224
224
  requirements: []
225
- rubygems_version: 3.5.8
225
+ rubygems_version: 3.5.10
226
226
  signing_key:
227
227
  specification_version: 4
228
228
  summary: Generate your next Rails app interactively!