Skip to content

Instantly share code, notes, and snippets.

@TiuTalk
Created November 29, 2013 17:52
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TiuTalk/7709501 to your computer and use it in GitHub Desktop.
Save TiuTalk/7709501 to your computer and use it in GitHub Desktop.
outdated_gems = `gem outdated`
regex = %r((?<gem>[\w-]+) \((?<old>[\d\.]+) < (?<new>[\d\.]+)\))
gemfile = File.read("./Gemfile")
outdated_gems.each_line do |line|
data = line.match(regex)
gemfile.gsub!(%r(gem '#{data[:gem]}',(\s+)'[^']+'), "gem '#{data[:gem]}',\\1'#{data[:new]}'")
end
puts gemfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment