diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d59a0e1..068f9755 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,7 +70,7 @@ jobs: - name: Run Rubocop run: bundle exec rubocop - test_generated_apps: + apps: # GitHub UI truncates job names so keep this short permissions: contents: read runs-on: ubuntu-latest @@ -82,21 +82,22 @@ jobs: js_package_manager: - name: npm installer: npm - - name: yarn_berry - installer: yarn - linker: pnp - - name: yarn_berry - installer: yarn - linker: node-modules - - name: yarn_berry - installer: yarn - linker: pnpm - - name: yarn_classic - installer: yarn - - name: pnpm - installer: pnpm - - name: bun - installer: bun + # TODO: temp disable to make CI easier to grok + # - name: yarn_berry + # installer: yarn + # linker: pnp + # - name: yarn_berry + # installer: yarn + # linker: node-modules + # - name: yarn_berry + # installer: yarn + # linker: pnpm + # - name: yarn_classic + # installer: yarn + # - name: pnpm + # installer: pnpm + # - name: bun + # installer: bun variant: - name: defaults config_path: 'ackama_rails_template.config.yml' @@ -203,7 +204,9 @@ jobs: # "react", "sidekiq" etc. APP_NAME: ${{ matrix.variant.name }}-demo CONFIG_PATH: ${{ matrix.variant.config_path }} - SKIPS: '--skip-javascript --skip-docker ${{ matrix.variant.skips }}' + SKIPS: + '--skip-javascript --skip-docker --skip-kamal --skip-solid ${{ + matrix.variant.skips }}' PGUSER: postgres PGPASSWORD: postgres PGHOST: localhost diff --git a/Gemfile.lock b/Gemfile.lock index 6e1f5cd3..a0574593 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -83,4 +83,4 @@ DEPENDENCIES rubocop-rspec (~> 2.12) BUNDLED WITH - 2.3.11 + 2.5.23 diff --git a/README.md b/README.md index a4267a35..16d99b43 100644 --- a/README.md +++ b/README.md @@ -193,7 +193,7 @@ $ wget https://raw.githubusercontent.com/ackama/rails-template/main/ackama_rails # Create a new app using the template. Template options will be taken from # ./ackama_rails_template.config.yml -$ rails new my_app --no-rc --database=postgresql --skip-javascript --skip-docker --template=https://raw.githubusercontent.com/ackama/rails-template/main/template.rb +$ rails new my_app --no-rc --database=postgresql --skip-javascript --skip-docker --skip-kamal --skip-solid --template=https://raw.githubusercontent.com/ackama/rails-template/main/template.rb # Example 2 # ######### @@ -201,7 +201,7 @@ $ rails new my_app --no-rc --database=postgresql --skip-javascript --skip-docker # Create a custom config YAML file, saving as ./my_custom_config.yml # Template options will be taken from ../my_custom_config.yml (relative to the new app directory) -$ CONFIG_PATH=../my_custom_config.yml rails new my_app --no-rc --database=postgresql --skip-javascript --skip-docker --template=https://raw.githubusercontent.com/ackama/rails-template/main/template.rb +$ CONFIG_PATH=../my_custom_config.yml rails new my_app --no-rc --database=postgresql --skip-javascript --skip-docker --skip-kamal --skip-solid --template=https://raw.githubusercontent.com/ackama/rails-template/main/template.rb ``` Here are some additional options you can add to this command. We don't @@ -230,6 +230,8 @@ To make this the default Rails application template on your system, create a -d postgresql --skip-javascript --skip-docker +--skip-kamal +--skip-solid -m https://raw.githubusercontent.com/ackama/rails-template/main/template.rb ``` diff --git a/target_versions.yml b/target_versions.yml index eadfffcc..8191b681 100644 --- a/target_versions.yml +++ b/target_versions.yml @@ -2,7 +2,7 @@ # # This is stored in a separate file so we can share it between the template and # our CI configuration. -target_rails_major_minor: '7.2' # specify as major.minor +target_rails_major_minor: '8.0' # specify as major.minor # Set this to the minimum version of Ruby that the chosen Rails version supports. -minimum_ruby_major_minor: '3.1' +minimum_ruby_major_minor: '3.2' diff --git a/template.rb b/template.rb index 55d58014..9a1c0ac4 100644 --- a/template.rb +++ b/template.rb @@ -147,6 +147,8 @@ def apply_template! # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Met # but also after `shakapacker:install` and after Rails has initialized the git # repo after_bundle do # rubocop:disable Metrics/BlockLength + TERMINAL.puts_header "START after_bundle block" + require_package_json_gem apply "variants/backend-base/lib/template.rb" @@ -157,6 +159,7 @@ def apply_template! # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Met # its own `spec/` directory remove_dir "test" + TERMINAL.puts_header "START bin/setup" run_with_clean_bundler_env "bin/setup" apply "variants/frontend-base/template.rb" @@ -231,8 +234,8 @@ def apply_template! # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Met # erblint does not like some of Rails auto-generated ERB code e.g. # `app/views/layouts/mailer.html.erb` so we auto-correct it. - copy_file "variants/backend-base/.erb-lint.yml", ".erb-lint.yml" - run_with_clean_bundler_env "bundle exec erblint --autocorrect ." + copy_file "variants/backend-base/.erb_lint.yml", ".erb_lint.yml" + run_with_clean_bundler_env "bundle exec erb_lint --autocorrect ." git add: "-A ." git commit: "-n -m 'Set up erblint'" @@ -249,6 +252,8 @@ def apply_template! # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Met # Run prettier one last time to ensure that everything is formatted apply_prettier_all_over + + TERMINAL.puts_header "END after_bundle block" end end diff --git a/variants/accessibility/Gemfile.rb b/variants/accessibility/Gemfile.rb index f9470ea4..a4328f20 100644 --- a/variants/accessibility/Gemfile.rb +++ b/variants/accessibility/Gemfile.rb @@ -1,3 +1,5 @@ +TERMINAL.puts_header "Installing accessibility checking gems" + insert_into_file "Gemfile", after: /gem "selenium-webdriver"\n/ do <<~GEMS diff --git a/variants/backend-base/.erb-lint.yml b/variants/backend-base/.erb_lint.yml similarity index 100% rename from variants/backend-base/.erb-lint.yml rename to variants/backend-base/.erb_lint.yml diff --git a/variants/backend-base/Gemfile.tt b/variants/backend-base/Gemfile.tt index 5dddbee0..b861dab1 100644 --- a/variants/backend-base/Gemfile.tt +++ b/variants/backend-base/Gemfile.tt @@ -6,7 +6,7 @@ ruby File.read(".ruby-version") gem "rails", "<%= Rails.version %>" gem "puma" gem "pg" -gem 'dotenv-rails', require: "dotenv/load" +gem "dotenv-rails", require: "dotenv/load" gem "bootsnap", require: false gem "shakapacker" @@ -15,10 +15,13 @@ gem "okcomputer" gem "sentry-ruby" gem "sentry-rails" +# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword] +# gem "bcrypt", "~> 3.1.7" + gem "rack-canonical-host" -# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] -gem "sprockets-rails" +# The modern asset pipeline for Rails [https://github.com/rails/propshaft] +gem "propshaft" # Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev] gem "turbo-rails" diff --git a/variants/backend-base/config/environments/production.rb b/variants/backend-base/config/environments/production.rb index eeea4680..917d9b07 100644 --- a/variants/backend-base/config/environments/production.rb +++ b/variants/backend-base/config/environments/production.rb @@ -1,13 +1,3 @@ -insert_into_file "config/environments/production.rb", - after: /# config\.assets\.css_compressor = :sass\n/ do - <<-RUBY - - # Disable minification since it adds a *huge* amount of time to precompile. - # Anyway, gzip alone gets us about 70% of the benefits of minify+gzip. - config.assets.css_compressor = false - RUBY -end - gsub_file! "config/environments/production.rb", "config.force_ssl = true", <<~RUBY @@ -46,10 +36,7 @@ 'ENV.fetch("RAILS_LOG_LEVEL", "info")', 'ENV.fetch("RAILS_LOG_LEVEL", ENV.fetch("LOG_LEVEL", "info"))' -gsub_file! "config/environments/production.rb", - "ActiveSupport::Logger.new(STDOUT)", - "ActiveSupport::Logger.new($stdout)" - +# TODO: https://github.com/ackama/rails-template/issues/569 insert_into_file "config/environments/production.rb", after: /.*config\.public_file_server\.enabled.*\n/ do <<~'RUBY' @@ -81,7 +68,6 @@ config.public_file_server.headers = { "Cache-Control" => "public, s-maxage=#{365.days.seconds}, max-age=#{365.days.seconds}" } - RUBY end diff --git a/variants/bullet/template.rb b/variants/bullet/template.rb index 27ce6534..1e50f65e 100644 --- a/variants/bullet/template.rb +++ b/variants/bullet/template.rb @@ -1,6 +1,6 @@ insert_into_file "Gemfile", after: /^group :development, :test do\n/ do <<~GEMS - gem "bullet" + gem "bullet", ">= 8.0" # Rails 8+ requires Bullet 8+ GEMS end diff --git a/variants/code-annotation/template.rb b/variants/code-annotation/template.rb index 67161781..8e86f176 100644 --- a/variants/code-annotation/template.rb +++ b/variants/code-annotation/template.rb @@ -7,7 +7,7 @@ <<-GEMS # code annotation gem "chusaku", require: false - gem "annotate", require: false + gem "annotaterb", require: false GEMS end @@ -15,12 +15,13 @@ run "bundle install" # adds a rake task which causes annotate to auto-run on every migration -run "bundle exec rails generate annotate:install" +run "bundle exec rails generate annotate_rb:install" TERMINAL.puts_header "Annotating code" run "bundle exec chusaku" -run "bundle exec annotate" +run "bundle exec annotaterb models" +run "bundle exec annotaterb routes" TERMINAL.puts_header "Running rubocop -A to fix formatting in files related to annotations" run "bundle exec rubocop -A -c ./.rubocop.yml"