8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/constants.rb', line 8
def self.get(var_name)
tsrails_config = File.expand_path(File.join("~", ".tsrails.yml"))
unless File.exist?(tsrails_config)
File.open(tsrails_config, 'w') do |f|
f.printf "# Configuration for the TSRails gem - EDIT THIS!\n"
f.printf "staging_server: staging.server.com\n"
f.printf "staging_ssh_user: %s\n", Etc.getlogin
f.printf "remote_git_dir: /var/git\n"
f.printf "remote_apache_dir: /var/sites\n"
f.printf "test_app_domain: example.com\n"
end
puts "A tsrails configuration file was generated as "
puts " #{tsrails_config}"
puts "Please edit it as appropriate and rerun the tsrails command."
exit 1
end
tsrails_config = YAML.load_file(tsrails_config)
tsrails_config[var_name.to_s]
end
|