Skip to content
Snippets Groups Projects
Commit 86466ff0 authored by Valery Sizov's avatar Valery Sizov
Browse files

Add switch

parent 52905776
No related branches found
No related tags found
1 merge request!93[WIP] Add switcher
switch 0 → 100644
#!/usr/bin/env ruby
require "fileutils"
ROOT = File.dirname(__FILE__)
where = ARGV.shift
unless ["ce", "ee"].include?(where)
puts "argument can be 'ce' or 'ee'"
exit
end
unless Dir.exist?(File.join(ROOT, "repositories_#{where}"))
puts "You are already on it"
exit
end
inversed_where = where == "ce" ? "ee" : "ce"
database_config_path = File.join(ROOT, "gitlab", "config", "database.yml")
database_config = File.read(database_config_path).gsub("_#{inversed_where}", "_#{where}")
File.write(database_config_path, database_config)
FileUtils.mv(File.join(ROOT, "repositories"), File.join(ROOT, "repositories_#{inversed_where}"))
FileUtils.mv(File.join(ROOT, "repositories_#{where}"), File.join(ROOT, "repositories"))
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment