Skip to content

Instantly share code, notes, and snippets.

@zph
Forked from anthonymoralez/gist:4627717
Last active December 11, 2015 16:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zph/4631392 to your computer and use it in GitHub Desktop.
Save zph/4631392 to your computer and use it in GitHub Desktop.
# Re-write for run by @_ZPH
# OO Ruby
gem = File.open('Gemfile').readlines.reject { |l| l =~ /lame/ }.join
File.write('Gemfile', gem)
# obtuse bash
grep -v "lame" Gemfile > !!3.new && mv !!3{.new,}
# ruby one liner
ruby -i -ne 'print unless /lame/' Gemfile
@iwakura
Copy link

iwakura commented Jan 25, 2013

Other variant:
sed -i'.bak' '/factory_girl_rails/d' Gemfile && rm "Gemfile.bak"

@rosenfeld
Copy link

File.write('Gemfile', File.read('Gemfile').gsub(/.*['"]lame['"].*\n/, ''))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment