Skip to content

Instantly share code, notes, and snippets.

@GUI
Created December 31, 2014 00:04
Show Gist options
  • Save GUI/b021428a3517e9dc518f to your computer and use it in GitHub Desktop.
Save GUI/b021428a3517e9dc518f to your computer and use it in GitHub Desktop.
Big ugly regex to convert Ruby hash object-ish text into Seed-Fu seed syntax (used to translate some custom db/seeds.rb into seed-fu compatible files)
perl -p -i -e 's/^ *:/ s./g;s/s\._id/s.id/g;s/ => / = /g;s/, *$//g;s/^ *} *$/end\n/g;s/^ *{ *$/ModelName.seed do |s|/g' seed_file.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment