diff options
author | Alex Legler <a3li@gentoo.org> | 2010-09-16 22:11:43 +0200 |
---|---|---|
committer | Alex Legler <a3li@gentoo.org> | 2010-09-16 22:11:43 +0200 |
commit | 01def1679172ebcf2ffddc15ba365916d95e4acf (patch) | |
tree | 9ef0b85d8f6f6f5516cce686e1ab5bdee1964a55 /script | |
parent | Revamp GLSA show action (diff) | |
download | glsamaker-01def1679172ebcf2ffddc15ba365916d95e4acf.tar.gz glsamaker-01def1679172ebcf2ffddc15ba365916d95e4acf.tar.bz2 glsamaker-01def1679172ebcf2ffddc15ba365916d95e4acf.zip |
Adding Capistrano infrastructure
Diffstat (limited to 'script')
-rwxr-xr-x | script/config_init | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/script/config_init b/script/config_init new file mode 100755 index 0000000..c4d81e2 --- /dev/null +++ b/script/config_init @@ -0,0 +1,44 @@ +#!/usr/bin/env ruby +PWD = File.dirname(__FILE__) + +begin + require 'yaml' + + puts "Initializing GLSAMaker 2 configuration in '#{File.expand_path(PWD + '/../')}'..." + + File.umask 0077 + + puts "Reading configuration..." + require PWD + '/../tmp/deploy.private.rb' + + Dir.chdir(File.join(PWD, '../config')) do + puts "Setting database.yml..." + y = YAML.load(open('database.yml.mysql')) + + if DB_CONN == :tcp + y['production']['host'] = DB_HOST + y['production']['port'] = DB_PORT + elsif DB_CONN == :sock + y['production']['socket'] = DB_SOCK + end + + y['production']['username'] = DB_USER + y['production']['password'] = DB_PASS + y['production']['database'] = DB_DB + + File.open('database.yml', 'w') {|f| YAML.dump(y, f) } + + puts "Creating initializers/glsamaker.rb..." + File.open('initializers/glsamaker.rb', 'w') do |f| + f.write INITIALIZER + end + end + + puts "Removing deploy configuration" + File.unlink(PWD + '/../tmp/deploy.private.rb') + + puts 'all done!' +rescue Exception => e + $stderr.puts "!! Failed: #{e.message}" + exit 1 +end |