summaryrefslogtreecommitdiff
path: root/lib/bundler/injector.rb
diff options
context:
space:
mode:
authorBoggs <hello.boggs@gmail.com>2016-06-16 12:27:23 +0800
committerBoggs <hello.boggs@gmail.com>2016-06-16 12:27:23 +0800
commitbf1de4c1d4b988aaf3305127fbfc3b64bef8aea6 (patch)
tree8c18522a323f38010c0110eef35ccfefe66381be /lib/bundler/injector.rb
parentf59164dee5bd9f84979b23ade5a1c1c7a947696e (diff)
downloadbundler-bf1de4c1d4b988aaf3305127fbfc3b64bef8aea6.tar.gz
Add option to `remove_timestamp` from `Injector` class.
Diffstat (limited to 'lib/bundler/injector.rb')
-rw-r--r--lib/bundler/injector.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/bundler/injector.rb b/lib/bundler/injector.rb
index c27e2499ca..33f271399a 100644
--- a/lib/bundler/injector.rb
+++ b/lib/bundler/injector.rb
@@ -1,13 +1,14 @@
# frozen_string_literal: true
module Bundler
class Injector
- def self.inject(new_deps)
- injector = new(new_deps)
+ def self.inject(new_deps, options = {})
+ injector = new(new_deps, options)
injector.inject(Bundler.default_gemfile, Bundler.default_lockfile)
end
- def initialize(new_deps)
+ def initialize(new_deps, options = {})
@new_deps = new_deps
+ @options = options
end
def inject(gemfile_path, lockfile_path)
@@ -55,7 +56,9 @@ module Bundler
def append_to(gemfile_path)
gemfile_path.open("a") do |f|
f.puts
- f.puts "# Added at #{Time.now} by #{`whoami`.chomp}:"
+ unless !!@options[:remove_timestamp]
+ f.puts "# Added at #{Time.now} by #{`whoami`.chomp}:"
+ end
f.puts new_gem_lines
end
end