Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
Remove workaround needed for Rails 7.1.0
Browse files Browse the repository at this point in the history
Now that 7.1.1 has been released
  • Loading branch information
mattbrictson committed Oct 11, 2023
1 parent 74ab96e commit 9ed04b1
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions template.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "bundler"
require "json"
RAILS_REQUIREMENT = "~> 7.1.0".freeze
RAILS_REQUIREMENT = "~> 7.1.1".freeze
NODE_REQUIREMENTS = ["~> 16.14", ">= 18.0.0"].freeze

def apply_template!
Expand Down Expand Up @@ -72,7 +72,7 @@ def apply_template!

apply "app/template.rb"

add_initial_migrations
create_database_and_initial_migration
run_with_clean_bundler_env "bin/setup"

binstubs = %w[brakeman bundler bundler-audit erb_lint rubocop sidekiq thor]
Expand Down Expand Up @@ -243,17 +243,10 @@ def run_rubocop_autocorrections
run_with_clean_bundler_env "bin/erblint --lint-all -a > /dev/null || true"
end

def add_initial_migrations
migration_tasks = %w[
action_mailbox:install:migrations
action_text:install:migrations
active_storage:install
]
all_tasks = rails_command("-T", capture: true).scan(/^\S+\s+(\S+)/).flatten
tasks_to_run = migration_tasks & all_tasks
tasks_to_run.each { |task| rails_command(task) }

run_with_clean_bundler_env "bin/rails generate migration initial_migration" unless Dir["db/migrate/**/*.rb"].any?
def create_database_and_initial_migration
return if Dir["db/migrate/**/*.rb"].any?
run_with_clean_bundler_env "bin/rails db:create"
run_with_clean_bundler_env "bin/rails generate migration initial_migration"
end

def add_yarn_start_script
Expand Down

0 comments on commit 9ed04b1

Please sign in to comment.