diff options
| author | Boggs <hello.boggs@gmail.com> | 2016-06-16 12:27:23 +0800 |
|---|---|---|
| committer | Boggs <hello.boggs@gmail.com> | 2016-06-16 12:27:23 +0800 |
| commit | bf1de4c1d4b988aaf3305127fbfc3b64bef8aea6 (patch) | |
| tree | 8c18522a323f38010c0110eef35ccfefe66381be /lib/bundler/injector.rb | |
| parent | f59164dee5bd9f84979b23ade5a1c1c7a947696e (diff) | |
| download | bundler-bf1de4c1d4b988aaf3305127fbfc3b64bef8aea6.tar.gz | |
Add option to `remove_timestamp` from `Injector` class.
Diffstat (limited to 'lib/bundler/injector.rb')
| -rw-r--r-- | lib/bundler/injector.rb | 11 |
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 |
