Created
December 19, 2008 18:27
-
-
Save zmoazeni/38071 to your computer and use it in GitHub Desktop.
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 | |
require "fileutils" | |
@current_path = File.dirname(__FILE__) | |
def database_config(branch) | |
"#{current_path}/../database_configs/#{branch}.yml" | |
end | |
def current_path | |
@current_path | |
end | |
new_ref = ARGV[1] | |
if new_ref | |
new_branch = `git name-rev #{new_ref}`.split[1] | |
return unless new_branch | |
if File.exist?(database_config(new_branch)) | |
puts "#{File.basename(__FILE__)}: Symlinking database config for #{new_branch}" | |
FileUtils.ln_sf database_config(new_branch), "#{@current_path}/../../config/database.yml" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment