Permalink
Browse files

capify and enable private app settings

  • Loading branch information...
1 parent fd754f4 commit 4246c0ced99f81136f31a96bd9b67fd30236d423 @ehutzelman committed Oct 11, 2009
Showing with 53 additions and 0 deletions.
  1. +3 −0 Capfile
  2. +15 −0 config/application.example.yml
  3. +29 −0 config/deploy.rb
  4. +6 −0 config/initializers/app_config.rb
View
@@ -0,0 +1,3 @@
+load 'deploy' if respond_to?(:namespace) # cap2 differentiator
+Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
+load 'config/deploy'
@@ -0,0 +1,15 @@
+global:
+ first_setting: value1
+ second_setting: value2
+
+development:
+ first_setting: value1
+ second_setting: value2
+
+test:
+ first_setting: value1
+ second_setting: value2
+
+production:
+ first_setting: value1
+ second_setting: value2
View
@@ -0,0 +1,29 @@
+default_run_options[:pty] = true
+
+set :application, "houstonrb"
+set :repository, "git@github.com:ehutzelman/houstonrb.git"
+
+set :deploy_via, :remote_cache
+set :deploy_to, "/Users/eric/Projects/#{application}"
+
+set :scm, :git
+
+set :domain, "raptor"
+role :app, domain
+role :web, domain
+role :db, domain, :primary => true
+
+namespace :deploy do
+ desc "Restarting mod_rails with restart.txt"
+ task :restart, :roles => :app, :except => { :no_release => true } do
+ run "touch #{current_path}/tmp/restart.txt"
+ end
+
+ desc "copy the private settings in config/application.yml to the servers"
+ task :copy_application_yml do
+ put(File.read("config/application.yml"), "#{release_path}/config/application.yml")
+ end
+end
+
+after "deploy:update_code", "deploy:copy_application_yml"
+
@@ -0,0 +1,6 @@
+# Warning: this needs to be loaded before any dependent initializers
+config_file_path = File.read(RAILS_ROOT + "/config/application.yml")
+config = YAML.load(config_file_path)
+
+APP_CONFIG = config.has_key?('global') ? config['global'].symbolize_keys : {}
+APP_CONFIG.merge!(config[RAILS_ENV].symbolize_keys)

0 comments on commit 4246c0c

Please sign in to comment.