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
  • Select an option

  • Save zph/4631392 to your computer and use it in GitHub Desktop.

Select an option

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

iwakura commented Jan 25, 2013

Copy link
Copy Markdown

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

@rosenfeld

Copy link
Copy Markdown
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