More consistent quotes in template files

This commit is contained in:
Henrik Nyh 2021-03-22 21:39:12 +00:00
parent 043184d903
commit c13fee85ba
6 changed files with 22 additions and 22 deletions

@ -1,6 +1,6 @@
<% if spring_install? -%>
load File.expand_path("spring", __dir__)
<% end -%>
APP_PATH = File.expand_path('../config/application', __dir__)
APP_PATH = File.expand_path("../config/application", __dir__)
require_relative "../config/boot"
require "rails/commands"

@ -1,7 +1,7 @@
require "fileutils"
# path to your application root.
APP_ROOT = File.expand_path('..', __dir__)
APP_ROOT = File.expand_path("..", __dir__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
@ -12,28 +12,28 @@ FileUtils.chdir APP_ROOT do
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file.
puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
puts "== Installing dependencies =="
system! "gem install bundler --conservative"
system("bundle check") || system!("bundle install")
<% unless options.skip_javascript? -%>
# Install JavaScript dependencies
system! 'bin/yarn'
system! "bin/yarn"
<% end -%>
<% unless options.skip_active_record? -%>
# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
# unless File.exist?("config/database.yml")
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
# end
puts "\n== Preparing database =="
system! 'bin/rails db:prepare'
system! "bin/rails db:prepare"
<% end -%>
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'
system! "bin/rails log:clear tmp:clear"
puts "\n== Restarting application server =="
system! 'bin/rails restart'
system! "bin/rails restart"
end

@ -1,4 +1,4 @@
APP_ROOT = File.expand_path('..', __dir__)
APP_ROOT = File.expand_path("..", __dir__)
Dir.chdir(APP_ROOT) do
yarn = ENV["PATH"].split(File::PATH_SEPARATOR).
select { |dir| File.expand_path(dir) != __dir__ }.

@ -1,14 +1,14 @@
# This command will automatically be run when you run "rails" with Rails gems
# installed from the root of your application.
ENGINE_ROOT = File.expand_path('..', __dir__)
ENGINE_PATH = File.expand_path('../lib/<%= namespaced_name -%>/engine', __dir__)
ENGINE_ROOT = File.expand_path("..", __dir__)
ENGINE_PATH = File.expand_path("../lib/<%= namespaced_name -%>/engine", __dir__)
<% if with_dummy_app? -%>
APP_PATH = File.expand_path('../<%= dummy_path -%>/config/application', __dir__)
APP_PATH = File.expand_path("../<%= dummy_path -%>/config/application", __dir__)
<% end -%>
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
<% if include_all_railties? -%>

@ -304,7 +304,7 @@ def test_adds_bin_yarn_into_setup_script
assert_file "bin/setup" do |content|
# Does not comment yarn install
assert_match(/(?=[^#]*?) system! 'bin\/yarn'/, content)
assert_match(/(?=[^#]*?) system! "bin\/yarn"/, content)
end
end
@ -320,7 +320,7 @@ def test_app_update_does_not_generate_yarn_contents_when_bin_yarn_is_not_used
assert_no_file "#{app_root}/bin/yarn"
assert_file "#{app_root}/bin/setup" do |content|
assert_no_match(/system! 'bin\/yarn'/, content)
assert_no_match(/system! "bin\/yarn"/, content)
end
end
end

@ -541,9 +541,9 @@ def test_creating_gemspec
def test_usage_of_engine_commands
run_generator [destination_root, "--full"]
assert_file "bin/rails", /ENGINE_PATH = File\.expand_path\('\.\.\/lib\/bukkits\/engine', __dir__\)/
assert_file "bin/rails", /ENGINE_ROOT = File\.expand_path\('\.\.', __dir__\)/
assert_file "bin/rails", %r|APP_PATH = File\.expand_path\('\.\./test/dummy/config/application', __dir__\)|
assert_file "bin/rails", /ENGINE_PATH = File\.expand_path\("\.\.\/lib\/bukkits\/engine", __dir__\)/
assert_file "bin/rails", /ENGINE_ROOT = File\.expand_path\("\.\.", __dir__\)/
assert_file "bin/rails", %r|APP_PATH = File\.expand_path\("\.\./test/dummy/config/application", __dir__\)|
assert_file "bin/rails", /require "rails\/all"/
assert_file "bin/rails", /require "rails\/engine\/commands"/
end
@ -866,7 +866,7 @@ def test_app_update_generates_bin_file
quietly { Rails::Engine::Updater.run(:create_bin_files) }
assert_file "#{destination_root}/bin/rails" do |content|
assert_match(%r|APP_PATH = File\.expand_path\('\.\./test/dummy/config/application', __dir__\)|, content)
assert_match(%r|APP_PATH = File\.expand_path\("\.\./test/dummy/config/application", __dir__\)|, content)
end
ensure
Object.send(:remove_const, "ENGINE_ROOT")