Skip to content

Commit

Permalink
fix: update gsub_file calls that are not actually matching anything
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Feb 19, 2024
1 parent dbd5d1f commit b50397d
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 30 deletions.
2 changes: 1 addition & 1 deletion variants/backend-base/app/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@

# Configure the default mailer to use the our default from address
gsub_file! "app/mailers/application_mailer.rb",
"default from: 'from@example.com'",
/default from: ['"]from@example\.com['"]/,
"default from: Rails.application.config.app.mail_from"
2 changes: 1 addition & 1 deletion variants/backend-base/config/application.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
gsub_file! "config/application.rb",
"# config.time_zone = 'Central Time (US & Canada)'",
/# config.time_zone = ['"]Central Time \(US & Canada\)['"]/,
"config.time_zone = 'Wellington'"

insert_into_file "config/application.rb", after: /^require_relative ['"]boot['"]/ do
Expand Down
4 changes: 0 additions & 4 deletions variants/backend-base/config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
RUBY
end

gsub_file! "config/environments/development.rb",
"join('tmp', 'caching-dev.txt')",
'join("tmp/caching-dev.txt")'

gsub_file! "config/environments/development.rb",
"config.action_controller.raise_on_missing_callback_actions = true",
"# config.action_controller.raise_on_missing_callback_actions = true"
6 changes: 3 additions & 3 deletions variants/backend-base/config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
end

gsub_file! "config/environments/production.rb",
"# config.force_ssl = true",
"config.force_ssl = true",
<<~RUBY
##
# `force_ssl` defaults to on. Set `force_ssl` to false if (and only if) RAILS_FORCE_SSL=false, otherwise set it to true.
Expand Down Expand Up @@ -43,8 +43,8 @@
end

gsub_file! "config/environments/production.rb",
"config.log_level = :info",
'config.log_level = ENV.fetch("LOG_LEVEL", "info").to_sym'
'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)",
Expand Down
4 changes: 0 additions & 4 deletions variants/backend-base/config/environments/test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
gsub_file! "config/environments/test.rb",
"config.eager_load = false",
"config.eager_load = defined?(SimpleCov).present?"

insert_into_file \
"config/environments/test.rb",
after: /config\.action_mailer\.delivery_method = :test\n/ do
Expand Down
6 changes: 3 additions & 3 deletions variants/backend-base/config/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
copy_file "variants/backend-base/config/initializers/check_env.rb", "config/initializers/check_env.rb"
copy_file "variants/backend-base/config/initializers/sentry.rb", "config/initializers/sentry.rb"

gsub_file! "config/initializers/filter_parameter_logging.rb", /\[:password\]/ do
"%w[password secret session cookie csrf]"
end
gsub_file! "config/initializers/filter_parameter_logging.rb",
/ {2}:passw, :secret, /,
" :passw, :secret, :session, :cookie, :csrf, "

apply "variants/backend-base/config/environments/development.rb"
apply "variants/backend-base/config/environments/production.rb"
Expand Down
7 changes: 2 additions & 5 deletions variants/devise/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@
" # t.datetime :locked_at",
" t.datetime :locked_at"
gsub_file! devise_migration_path,
" # add_index :users, :unlock_token",
" add_index :users, :unlock_token"
gsub_file! devise_migration_path,
/ # add_index :users, :unlock_token.+/,
" add_index :users, :unlock_token, unique: true"
" # add_index :users, :unlock_token",
" add_index :users, :unlock_token"

TERMINAL.puts_header "Running db migration"
run "bundle exec rails db:migrate"
Expand Down
4 changes: 0 additions & 4 deletions variants/frontend-base/sentry/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,3 @@
//
EO_JS
end

gsub_file! "config/initializers/content_security_policy.rb",
/# policy.report_uri ".+"/,
'policy.report_uri(ENV["SENTRY_CSP_HEADER_REPORT_ENDPOINT"]) if ENV["SENTRY_CSP_HEADER_REPORT_ENDPOINT"]'
7 changes: 3 additions & 4 deletions variants/frontend-base/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@
run "mv app/javascript app/frontend"
copy_file "config/webpack/webpack.config.js", force: true

gsub_file! "config/shakapacker.yml", "source_entry_path: /", "source_entry_path: packs", force: true
gsub_file! "config/shakapacker.yml", "cache_path: tmp/shakapacker", "cache_path: tmp/cache/shakapacker", force: true
gsub_file! "config/shakapacker.yml", "source_path: app/javascript", "source_path: app/frontend", force: true
gsub_file! "config/shakapacker.yml", "ensure_consistent_versioning: false", "ensure_consistent_versioning: true", force: true
gsub_file! "config/shakapacker.yml", "cache_path: tmp/shakapacker", "cache_path: tmp/cache/shakapacker"
gsub_file! "config/shakapacker.yml", "source_path: app/javascript", "source_path: app/frontend"
gsub_file! "config/shakapacker.yml", "ensure_consistent_versioning: false", "ensure_consistent_versioning: true"

old_shakapacker_test_compile_snippet = <<~EO_OLD
test:
Expand Down
2 changes: 1 addition & 1 deletion variants/frontend-react/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
# import ReactRailsUJS from 'react_ujs';

gsub_file! "app/views/layouts/application.html.erb",
" <%= javascript_pack_tag \"application\", \"data-turbolinks-track\": \"reload\", defer: true %>\n",
" <%= javascript_pack_tag \"application\", \"data-turbolinks-track\": \"reload\", defer: true, nonce: true %>\n",
" <%= javascript_pack_tag \"application\" %>\n"

copy_file "jest.config.js"
Expand Down

0 comments on commit b50397d

Please sign in to comment.