Sha256: c7751ff82f6b5401fb8f3af65b892133c4fb680ad8c8ade5d3e98e3ca3ab20bc
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
module DRG module Tasks class Gemfile attr_accessor :file def initialize(file = ::Bundler.default_gemfile) @file = file end # Saves a copy of @lines before changing it (note that #dup and #clone weren't working) # # @param [GemfileLine] gem # @param [String] version to update the gem line with def update(gem, version) lines[gem] = gem.update version write end def remove_version(gem) lines[gem] = gem.remove_version write end def find_by_name(name) lines.each_with_index.each do |line, index| next if line =~ /:?path:?\s*(=>)?\s*/ next if line =~ /:?git(hub)?:?\s*(=>)?\s*/ return GemfileLine.new line, index, name if line =~ /gem\s*['"]#{name}["']/ end nil end def write File.open file, 'wb' do |f| lines.each do |line| f << line end end end def lines @lines ||= File.readlines file end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
drg-0.5.0 | lib/drg/tasks/gemfile.rb |