Skip to content
Browse files

adds the ability to set your index.php and other application.php file…

…s to an environment
  • Loading branch information...
1 parent a609995 commit 90f74c7f121545f49a9290b5b748b60123edb519 @bshaffer bshaffer committed with Oct 20, 2010
Showing with 20 additions and 0 deletions.
  1. +20 −0 lib/capifony.rb
View
20 lib/capifony.rb
@@ -207,6 +207,26 @@ def load_database_config(data, env)
stream "#{php_bin} #{latest_release}/symfony project:send-emails --message-limit=#{message_limit} --time-limit=#{time_limit} --env=#{symfony_env}"
end
+
+ desc 'Task to set all front controllers to a specific environment'
+ task :set_environment do
+ if (env = fetch(:symfony_env, nil)) && env != 'prod'
+ cmd = []
+ apps = fetch(:symfony_apps, ['frontend'])
+
+ # First application listed becomes index.php
+ if app = apps.shift
+ cmd << "cp #{release_path}/web/#{app}_#{env}.php #{release_path}/web/index.php"
+ end
+
+ # All other apps are copied to their default controllers
+ for app in apps
+ cmd << "cp #{release_path}/web/#{app}_#{env}.php #{release_path}/web/#{app}.php"
+ end
+
+ run cmd.join(';') if cmd.join(';')
+ end
+ end
end
namespace :plugin do

0 comments on commit 90f74c7

Please sign in to comment.
Something went wrong with that request. Please try again.