blob: c4d81e28d765a167d19c6a8303a857400045f43b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
|