Skip to content

Instantly share code, notes, and snippets.

@jerodsanto
Created April 25, 2012 19:12
Show Gist options
  • Save jerodsanto/2492386 to your computer and use it in GitHub Desktop.
Save jerodsanto/2492386 to your computer and use it in GitHub Desktop.
Run this on a WordPress SQL dump before importing it into your dev env
#!/usr/bin/env ruby
unless filename = ARGV.first
abort "usage: #{__FILE__} file [http://host] [theme]"
end
host = ARGV[1] || "http://wp33.dev"
theme = ARGV[2] || "twentyten"
text = File.read(filename)
text.gsub! /'siteurl','.*',/, "'siteurl','#{host}',"
text.gsub! /'home','.*',/, "'home','#{host}',"
text.gsub! /'template','.*',/, "'template','#{theme}',"
File.open(filename, "w") { |file| file.write(text) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment