Skip to content

Commit 496432a

Browse files
committed
Added a --clobber option to script/use_rails to remove existing lock
1 parent f7d37a0 commit 496432a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

script/use_rails

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ end
1212
version = ARGV[0]
1313

1414
unless version
15-
puts "usage: ./script/#{__FILE__} VERSION"
15+
puts "USAGE: ./script/#{__FILE__} VERSION [OPTIONS]"
16+
puts
17+
puts "Options:"
18+
puts " --clobber Add this flag to remove the existing Gemfile.lock before running"
1619
exit(1)
1720
end
1821

@@ -26,7 +29,13 @@ gem_lock_file = "#{gem_lock_dir}/Gemfile-#{version}.lock"
2629
# Ensure our lock dir is created
2730
cmd "mkdir #{gem_lock_dir}" unless File.exists?(gem_lock_dir)
2831

32+
# --clobber passed in
33+
if File.exists?(gem_lock_file) && ARGV.include?('--clobber')
34+
cmd "rm #{gem_lock_file}"
35+
end
36+
2937
unless File.exists?(gem_lock_file)
38+
# Generate it
3039
cmd "rm Gemfile.lock" if file_or_symlink?("Gemfile.lock")
3140
cmd "export RAILS=#{version} && bundle install"
3241
cmd "mv Gemfile.lock #{gem_lock_file}"

0 commit comments

Comments
 (0)