Last active
April 5, 2023 14:44
-
-
Save DevGW/090ff27af03d70665abdc2f78dca17dd to your computer and use it in GitHub Desktop.
shell :: fixsite.rb #bash #rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
file_names = ['config/database.yml'] | |
text = File.read(file_names[0]) | |
new_contents = text.gsub(/\/tmp\/mysql\.sock/, "\/var\/lib\/mysql\/mysql\.sock") | |
# To merely print the contents of the file, use: | |
# puts new_contents | |
# To write changes to the file, use: | |
File.open(file_names[0], "w") {|file| file.puts new_contents } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment