summaryrefslogtreecommitdiff
path: root/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb')
-rw-r--r--lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb b/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb
index afdbd53dd0..62c82b3dba 100644
--- a/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb
+++ b/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb
@@ -251,7 +251,8 @@ class Bundler::Thor
# path<String>:: path of the file to be changed
# flag<Regexp|String>:: the regexp or string to be replaced
# replacement<String>:: the replacement, can be also given as a block
- # config<Hash>:: give :verbose => false to not log the status.
+ # config<Hash>:: give :verbose => false to not log the status, and
+ # :force => true, to force the replacement regardles of runner behavior.
#
# ==== Example
#
@@ -262,9 +263,10 @@ class Bundler::Thor
# end
#
def gsub_file(path, flag, *args, &block)
- return unless behavior == :invoke
config = args.last.is_a?(Hash) ? args.pop : {}
+ return unless behavior == :invoke || config.fetch(:force, false)
+
path = File.expand_path(path, destination_root)
say_status :gsub, relative_to_original_destination_root(path), config.fetch(:verbose, true)