Skip to content

Commit e42d4f2

Browse files
committed
Ensure railsrc options affect caching
1 parent aa6a78d commit e42d4f2

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lib/rails/diff.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def ensure_template_app_exists(commit, new_app_options)
4949
end
5050

5151
def template_app_path
52-
@template_app_path ||= File.join(CACHE_DIR, commit, new_app_options_hash, app_name)
52+
@template_app_path ||= File.join(CACHE_DIR, commit, rails_new_options_hash, app_name)
5353
end
5454

5555
def rails_path
@@ -167,15 +167,13 @@ def generate_app
167167
system("bundle install >/dev/null 2>&1")
168168
end
169169

170-
rails_new_command = "bundle exec rails new #{template_app_path} --main --skip-bundle --force --skip-test --skip-system-test --quiet #{new_app_options}"
171-
172170
if railsrc_options
173-
rails_new_command = "#{rails_new_command} #{railsrc_options}"
174-
175171
puts "Using default options from #{railsrc_path}:"
176172
puts " > #{railsrc_options}\n\n"
177173
end
178174

175+
rails_new_command = "bundle exec rails new #{template_app_path} --main --skip-bundle --force --skip-test --skip-system-test --quiet #{rails_new_options}"
176+
179177
puts "Generating new Rails application"
180178
puts " > #{rails_new_command}\n\n"
181179

@@ -198,9 +196,9 @@ def latest_commit
198196
end
199197
end
200198

201-
def new_app_options_hash
202-
Digest::SHA256.hexdigest(new_app_options.to_s)
203-
end
199+
def rails_new_options = [new_app_options, railsrc_options].compact.join(" ")
200+
201+
def rails_new_options_hash = Digest::SHA256.hexdigest(rails_new_options)
204202
end
205203

206204
class CLI < Thor

0 commit comments

Comments
 (0)