Permalink
Browse files

Merge pull request #27 from alifity/master

Capifony made (more) modular
  • Loading branch information...
2 parents 7815cdb + 6e32dab commit 796367780404f688f5bc88c3847a0ed7056ba994 @everzet committed Jun 9, 2011
Showing with 37 additions and 31 deletions.
  1. +37 −31 lib/symfony2.rb
View
@@ -7,13 +7,19 @@
set :web_path, "web"
# Symfony console bin
-set :symfony_console, "console"
+set :symfony_console, app_path + "/console"
+
+# Symfony log path
+set :log_path, app_path + "/logs"
+
+# Symfony cache path
+set :cache_path, app_path + "/cache"
# Use AsseticBundle
set :dump_assetic_assets, false
# Dirs that need to remain the same between deploys (shared dirs)
-set :shared_children, [app_path + "/logs", web_path + "/uploads"]
+set :shared_children, [log_path, web_path + "/uploads"]
# Files that need to remain the same between deploys
set :shared_files, false
@@ -44,9 +50,9 @@
desc "Update latest release source path."
task :finalize_update, :except => { :no_release => true } do
run "chmod -R g+w #{latest_release}" if fetch(:group_writable, true)
- run "if [ -d #{latest_release}/#{app_path}/cache ] ; then rm -rf #{latest_release}/#{app_path}/cache; fi"
- run "mkdir -p #{latest_release}/#{app_path}/cache && chmod -R 0777 #{latest_release}/#{app_path}/cache"
- run "chmod -R g+w #{latest_release}/#{app_path}/cache"
+ run "if [ -d #{latest_release}/#{cache_path} ] ; then rm -rf #{latest_release}/#{cache_path}; fi"
+ run "mkdir -p #{latest_release}/#{cache_path} && chmod -R 0777 #{latest_release}/#{cache_path}"
+ run "chmod -R g+w #{latest_release}/#{cache_path}"
share_childs
@@ -73,7 +79,7 @@
desc "Migrate Symfony2 Doctrine ORM database."
task :migrate do
currentVersion = nil
- run "#{php-bin} #{app-path}/#{symfony_console} doctrine:migrations:status --env=#{symfony_env_prod}" do |ch, stream, out|
+ run "#{php-bin} #{symfony_console} doctrine:migrations:status --env=#{symfony_env_prod}" do |ch, stream, out|
if stream == :out and out =~ /Current Version:[^$]+\(([0-9]+)\)/
currentVersion = Regexp.last_match(1)
end
@@ -88,14 +94,14 @@
puts "Current database version #{currentVersion}"
on_rollback {
- run "#{php-bin} #{app-path}/#{symfony_console} doctrine:migrations:migrate #{currentVersion} --env=#{symfony_env_prod}" do |ch, stream, out|
+ run "#{php-bin} #{symfony_console} doctrine:migrations:migrate #{currentVersion} --env=#{symfony_env_prod}" do |ch, stream, out|
if out =~ /Are you sure you wish to continue/
ch.send_data("y\r\n")
end
end
}
- run "#{php-bin} #{app-path}/#{symfony_console} doctrine:migrations:migrate --env=#{symfony_env_prod}" do |ch, stream, out|
+ run "#{php-bin} #{symfony_console} doctrine:migrations:migrate --env=#{symfony_env_prod}" do |ch, stream, out|
if out =~ /Are you sure you wish to continue/
ch.send_data("y\r\n")
end
@@ -108,130 +114,130 @@
task :default do
prompt_with_default(:task_arguments, "cache:clear")
- stream "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} #{task_arguments} --env=#{symfony_env_prod}"
+ stream "cd #{latest_release} && #{php_bin} #{symfony_console} #{task_arguments} --env=#{symfony_env_prod}"
end
namespace :assets do
desc "Install bundle's assets"
task :install do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} assets:install #{web_path} --env=#{symfony_env_prod}"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} assets:install #{web_path} --env=#{symfony_env_prod}"
end
end
namespace :assetic do
desc "Dumps all assets to the filesystem"
task :dump do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} assetic:dump #{web_path} --env=#{symfony_env_prod}"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} assetic:dump #{web_path} --env=#{symfony_env_prod}"
end
end
namespace :cache do
desc "Clears project cache."
task :clear do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} cache:clear --env=#{symfony_env_prod}"
- run "chmod -R g+w #{latest_release}/#{app_path}/cache"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} cache:clear --env=#{symfony_env_prod}"
+ run "chmod -R g+w #{latest_release}/#{cache_path}"
end
desc "Warms up an empty cache."
task :warmup do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} cache:warmup --env=#{symfony_env_prod}"
- run "chmod -R g+w #{latest_release}/#{app_path}/cache"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} cache:warmup --env=#{symfony_env_prod}"
+ run "chmod -R g+w #{latest_release}/#{cache_path}"
end
end
namespace :doctrine do
namespace :cache do
desc "Clear all metadata cache for a entity manager."
task :clear_metadata do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:cache:clear-metadata --env=#{symfony_env_prod}"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-metadata --env=#{symfony_env_prod}"
end
desc "Clear all query cache for a entity manager."
task :clear_query do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:cache:clear-query --env=#{symfony_env_prod}"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-query --env=#{symfony_env_prod}"
end
desc "Clear result cache for a entity manager."
task :clear_result do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:cache:clear-result --env=#{symfony_env_prod}"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-result --env=#{symfony_env_prod}"
end
end
namespace :database do
desc "Create the configured databases."
task :create do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:database:create --env=#{symfony_env_prod}"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:database:create --env=#{symfony_env_prod}"
end
desc "Drop the configured databases."
task :drop do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:database:drop --env=#{symfony_env_prod}"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:database:drop --env=#{symfony_env_prod}"
end
end
namespace :generate do
desc "Generates proxy classes for entity classes."
task :hydrators do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:generate:proxies --env=#{symfony_env_prod}"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:generate:proxies --env=#{symfony_env_prod}"
end
desc "Generate repository classes from your mapping information."
task :hydrators do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:generate:repositories --env=#{symfony_env_prod}"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:generate:repositories --env=#{symfony_env_prod}"
end
end
namespace :schema do
desc "Processes the schema and either create it directly on EntityManager Storage Connection or generate the SQL output."
task :create do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:schema:create --env=#{symfony_env_prod}"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:create --env=#{symfony_env_prod}"
end
desc "Drop the complete database schema of EntityManager Storage Connection or generate the corresponding SQL output."
task :drop do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:schema:drop --env=#{symfony_env_prod}"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:drop --env=#{symfony_env_prod}"
end
end
namespace :migrations do
desc "Execute a migration to a specified version or the latest available version."
task :migrate do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:migrations:migrate --env=#{symfony_env_prod}"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:migrate --env=#{symfony_env_prod}"
end
desc "View the status of a set of migrations."
task :status do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:migrations:status --env=#{symfony_env_prod}"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:status --env=#{symfony_env_prod}"
end
end
namespace :mongodb do
namespace :generate do
desc "Generates hydrator classes for document classes."
task :hydrators do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:mongodb:generate:hydrators --env=#{symfony_env_prod}"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:generate:hydrators --env=#{symfony_env_prod}"
end
desc "Generates proxy classes for document classes."
task :hydrators do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:mongodb:generate:proxies --env=#{symfony_env_prod}"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:generate:proxies --env=#{symfony_env_prod}"
end
desc "Generates repository classes for document classes."
task :hydrators do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:mongodb:generate:repositories --env=#{symfony_env_prod}"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:generate:repositories --env=#{symfony_env_prod}"
end
end
namespace :schema do
desc "Allows you to create databases, collections and indexes for your documents."
task :create do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:mongodb:schema:create --env=#{symfony_env_prod}"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:schema:create --env=#{symfony_env_prod}"
end
desc "Allows you to drop databases, collections and indexes for your documents."
task :drop do
- run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:mongodb:schema:drop --env=#{symfony_env_prod}"
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:schema:drop --env=#{symfony_env_prod}"
end
end
end

0 comments on commit 7963677

Please sign in to comment.