summaryrefslogtreecommitdiff
path: root/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb')
-rw-r--r--lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb b/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb
index f52ced2bcd..bf013307f1 100644
--- a/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb
+++ b/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb
@@ -107,10 +107,7 @@ class Bundler::Thor
#
def replace!(regexp, string, force)
content = File.read(destination)
- before, after = content.split(regexp, 2)
- snippet = (behavior == :after ? after : before).to_s
-
- if force || !snippet.include?(replacement)
+ if force || !content.include?(replacement)
success = content.gsub!(regexp, string)
File.open(destination, "wb") { |file| file.write(content) } unless pretend?