capifony 2.1.16 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{CHANGELOG → CHANGELOG.md} +82 -36
- data/README.md +15 -0
- data/UPGRADE.md +30 -0
- data/bin/capifony +11 -4
- data/lib/{symfony1.rb → capifony_symfony1.rb} +12 -1
- data/lib/capifony_symfony2.rb +255 -0
- data/lib/symfony2/database.rb +12 -10
- data/lib/symfony2/deploy.rb +12 -12
- data/lib/symfony2/doctrine.rb +26 -17
- data/lib/symfony2/propel.rb +11 -11
- data/lib/symfony2/symfony.rb +40 -37
- metadata +25 -9
- data/lib/symfony2.rb +0 -175
- data/lib/symfony2/output.rb +0 -48
data/lib/symfony2/database.rb
CHANGED
@@ -1,16 +1,17 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'fileutils'
|
2
|
+
require 'zlib'
|
3
3
|
|
4
4
|
namespace :database do
|
5
5
|
namespace :dump do
|
6
6
|
desc "Dumps remote database"
|
7
7
|
task :remote, :roles => :db, :only => { :primary => true } do
|
8
|
-
|
8
|
+
env = fetch(:deploy_env, "remote")
|
9
|
+
filename = "#{application}.#{env}_dump.#{Time.now.to_i}.sql.gz"
|
9
10
|
file = "#{remote_tmp_dir}/#{filename}"
|
10
11
|
sqlfile = "#{application}_dump.sql"
|
11
12
|
config = ""
|
12
13
|
|
13
|
-
run "#{try_sudo} cat #{current_path}/#{
|
14
|
+
run "#{try_sudo} cat #{current_path}/#{app_config_path}/#{app_config_file}" do |ch, st, data|
|
14
15
|
config = load_database_config data, symfony_env_prod
|
15
16
|
end
|
16
17
|
|
@@ -28,9 +29,9 @@ namespace :database do
|
|
28
29
|
FileUtils.mkdir_p("backups")
|
29
30
|
get file, "backups/#{filename}"
|
30
31
|
begin
|
31
|
-
FileUtils.ln_sf(filename, "backups/#{application}.
|
32
|
+
FileUtils.ln_sf(filename, "backups/#{application}.#{env}_dump.latest.sql.gz")
|
32
33
|
rescue NotImplementedError # hack for windows which doesnt support symlinks
|
33
|
-
FileUtils.cp_r("backups/#{filename}", "backups/#{application}.
|
34
|
+
FileUtils.cp_r("backups/#{filename}", "backups/#{application}.#{env}_dump.latest.sql.gz")
|
34
35
|
end
|
35
36
|
run "#{try_sudo} rm #{file}"
|
36
37
|
end
|
@@ -40,7 +41,7 @@ namespace :database do
|
|
40
41
|
filename = "#{application}.local_dump.#{Time.now.to_i}.sql.gz"
|
41
42
|
tmpfile = "backups/#{application}_dump_tmp.sql"
|
42
43
|
file = "backups/#{filename}"
|
43
|
-
config = load_database_config IO.read("#{
|
44
|
+
config = load_database_config IO.read("#{app_config_path}/#{app_config_file}"), symfony_env_local
|
44
45
|
sqlfile = "#{application}_dump.sql"
|
45
46
|
|
46
47
|
FileUtils::mkdir_p("backups")
|
@@ -72,8 +73,9 @@ namespace :database do
|
|
72
73
|
namespace :move do
|
73
74
|
desc "Dumps remote database, downloads it to local, and populates here"
|
74
75
|
task :to_local, :roles => :db, :only => { :primary => true } do
|
75
|
-
|
76
|
-
|
76
|
+
env = fetch(:deploy_env, "remote")
|
77
|
+
filename = "#{application}.#{env}_dump.latest.sql.gz"
|
78
|
+
config = load_database_config IO.read("#{app_config_path}/#{app_config_file}"), symfony_env_local
|
77
79
|
sqlfile = "#{application}_dump.sql"
|
78
80
|
|
79
81
|
database.dump.remote
|
@@ -104,7 +106,7 @@ namespace :database do
|
|
104
106
|
upload(file, "#{remote_tmp_dir}/#{filename}", :via => :scp)
|
105
107
|
run "#{try_sudo} gunzip -c #{remote_tmp_dir}/#{filename} > #{remote_tmp_dir}/#{sqlfile}"
|
106
108
|
|
107
|
-
run "#{try_sudo} cat #{current_path}/#{
|
109
|
+
run "#{try_sudo} cat #{current_path}/#{app_config_path}/#{app_config_file}" do |ch, st, data|
|
108
110
|
config = load_database_config data, symfony_env_prod
|
109
111
|
end
|
110
112
|
|
data/lib/symfony2/deploy.rb
CHANGED
@@ -31,7 +31,7 @@ namespace :deploy do
|
|
31
31
|
}
|
32
32
|
|
33
33
|
if methods[permission_method]
|
34
|
-
|
34
|
+
capifony_pretty_print "--> Setting permissions"
|
35
35
|
|
36
36
|
if fetch(:use_sudo, false)
|
37
37
|
methods[permission_method].each do |cmd|
|
@@ -51,7 +51,7 @@ namespace :deploy do
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
54
|
-
|
54
|
+
capifony_puts_ok
|
55
55
|
else
|
56
56
|
puts " Permission method '#{permission_method}' does not exist.".yellow
|
57
57
|
end
|
@@ -61,7 +61,7 @@ namespace :deploy do
|
|
61
61
|
desc "Symlinks static directories and static files that need to remain between deployments"
|
62
62
|
task :share_childs, :roles => :app, :except => { :no_release => true } do
|
63
63
|
if shared_children
|
64
|
-
|
64
|
+
capifony_pretty_print "--> Creating symlinks for shared directories"
|
65
65
|
|
66
66
|
shared_children.each do |link|
|
67
67
|
run "#{try_sudo} mkdir -p #{shared_path}/#{link}"
|
@@ -69,11 +69,11 @@ namespace :deploy do
|
|
69
69
|
run "#{try_sudo} ln -nfs #{shared_path}/#{link} #{release_path}/#{link}"
|
70
70
|
end
|
71
71
|
|
72
|
-
|
72
|
+
capifony_puts_ok
|
73
73
|
end
|
74
74
|
|
75
75
|
if shared_files
|
76
|
-
|
76
|
+
capifony_pretty_print "--> Creating symlinks for shared files"
|
77
77
|
|
78
78
|
shared_files.each do |link|
|
79
79
|
link_dir = File.dirname("#{shared_path}/#{link}")
|
@@ -82,7 +82,7 @@ namespace :deploy do
|
|
82
82
|
run "#{try_sudo} ln -nfs #{shared_path}/#{link} #{release_path}/#{link}"
|
83
83
|
end
|
84
84
|
|
85
|
-
|
85
|
+
capifony_puts_ok
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
@@ -90,13 +90,13 @@ namespace :deploy do
|
|
90
90
|
task :finalize_update, :roles => :app, :except => { :no_release => true } do
|
91
91
|
run "#{try_sudo} chmod -R g+w #{latest_release}" if fetch(:group_writable, true)
|
92
92
|
|
93
|
-
|
93
|
+
capifony_pretty_print "--> Creating cache directory"
|
94
94
|
|
95
95
|
run "#{try_sudo} sh -c 'if [ -d #{latest_release}/#{cache_path} ] ; then rm -rf #{latest_release}/#{cache_path}; fi'"
|
96
96
|
run "#{try_sudo} sh -c 'mkdir -p #{latest_release}/#{cache_path} && chmod -R 0777 #{latest_release}/#{cache_path}'"
|
97
97
|
run "#{try_sudo} chmod -R g+w #{latest_release}/#{cache_path}"
|
98
98
|
|
99
|
-
|
99
|
+
capifony_puts_ok
|
100
100
|
|
101
101
|
share_childs
|
102
102
|
|
@@ -107,10 +107,10 @@ namespace :deploy do
|
|
107
107
|
if asset_paths.chomp.empty?
|
108
108
|
puts " No asset paths found, skipped".yellow
|
109
109
|
else
|
110
|
-
|
110
|
+
capifony_pretty_print "--> Normalizing asset timestamps"
|
111
111
|
|
112
112
|
run "#{try_sudo} find #{asset_paths} -exec touch -t #{stamp} {} ';' &> /dev/null || true", :env => { "TZ" => "UTC" }
|
113
|
-
|
113
|
+
capifony_puts_ok
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|
@@ -125,7 +125,7 @@ namespace :deploy do
|
|
125
125
|
end
|
126
126
|
|
127
127
|
desc "Deploys the application and runs the test suite"
|
128
|
-
task :
|
128
|
+
task :test_all, :roles => :app, :except => { :no_release => true } do
|
129
129
|
update_code
|
130
130
|
create_symlink
|
131
131
|
run "#{try_sudo} sh -c 'cd #{latest_release} && phpunit -c #{app_path} src'"
|
@@ -142,7 +142,7 @@ namespace :deploy do
|
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
|
-
desc "
|
145
|
+
desc "Drops :deploy_to directory"
|
146
146
|
task :drop do
|
147
147
|
if Capistrano::CLI.ui.ask("Are you sure remove #{deploy_to} (y/n)") == 'y'
|
148
148
|
run "#{try_sudo} rm -rf #{deploy_to}"
|
data/lib/symfony2/doctrine.rb
CHANGED
@@ -3,26 +3,26 @@ namespace :symfony do
|
|
3
3
|
namespace :cache do
|
4
4
|
desc "Clears all metadata cache for a entity manager"
|
5
5
|
task :clear_metadata, :roles => :app, :except => { :no_release => true } do
|
6
|
-
|
6
|
+
capifony_pretty_print "--> Clearing Doctrine metadata cache"
|
7
7
|
|
8
8
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-metadata --env=#{symfony_env_prod}'"
|
9
|
-
|
9
|
+
capifony_puts_ok
|
10
10
|
end
|
11
11
|
|
12
12
|
desc "Clears all query cache for a entity manager"
|
13
13
|
task :clear_query, :roles => :app, :except => { :no_release => true } do
|
14
|
-
|
14
|
+
capifony_pretty_print "--> Clearing Doctrine query cache"
|
15
15
|
|
16
16
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-query --env=#{symfony_env_prod}'"
|
17
|
-
|
17
|
+
capifony_puts_ok
|
18
18
|
end
|
19
19
|
|
20
20
|
desc "Clears result cache for a entity manager"
|
21
21
|
task :clear_result, :roles => :app, :except => { :no_release => true } do
|
22
|
-
|
22
|
+
capifony_pretty_print "--> Clearing Doctrine result cache"
|
23
23
|
|
24
24
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-result --env=#{symfony_env_prod}'"
|
25
|
-
|
25
|
+
capifony_puts_ok
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -32,13 +32,13 @@ namespace :symfony do
|
|
32
32
|
task action, :roles => :app, :except => { :no_release => true } do
|
33
33
|
case action.to_s
|
34
34
|
when "create"
|
35
|
-
|
35
|
+
capifony_pretty_print "--> Creating databases"
|
36
36
|
when "drop"
|
37
|
-
|
37
|
+
capifony_pretty_print "--> Dropping databases"
|
38
38
|
end
|
39
39
|
|
40
40
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:database:#{action.to_s} --env=#{symfony_env_prod}'", :once => true
|
41
|
-
|
41
|
+
capifony_puts_ok
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -46,17 +46,26 @@ namespace :symfony do
|
|
46
46
|
namespace :schema do
|
47
47
|
desc "Processes the schema and either create it directly on EntityManager Storage Connection or generate the SQL output"
|
48
48
|
task :create, :roles => :app, :except => { :no_release => true } do
|
49
|
+
capifony_pretty_print "--> Creating schema"
|
50
|
+
|
49
51
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:create --env=#{symfony_env_prod}'", :once => true
|
52
|
+
capifony_puts_ok
|
50
53
|
end
|
51
54
|
|
52
55
|
desc "Drops the complete database schema of EntityManager Storage Connection or generate the corresponding SQL output"
|
53
56
|
task :drop, :roles => :app, :except => { :no_release => true } do
|
57
|
+
capifony_pretty_print "--> Droping schema"
|
58
|
+
|
54
59
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:drop --env=#{symfony_env_prod}'", :once => true
|
60
|
+
capifony_puts_ok
|
55
61
|
end
|
56
62
|
|
57
63
|
desc "Updates database schema of EntityManager Storage Connection"
|
58
64
|
task :update, :roles => :app, :except => { :no_release => true } do
|
59
|
-
|
65
|
+
capifony_pretty_print "--> Updating schema"
|
66
|
+
|
67
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:update --force --env=#{symfony_env_prod}'", :once => true
|
68
|
+
capifony_puts_ok
|
60
69
|
end
|
61
70
|
end
|
62
71
|
|
@@ -76,7 +85,7 @@ namespace :symfony do
|
|
76
85
|
if currentVersion == nil
|
77
86
|
raise "Could not find current database migration version"
|
78
87
|
end
|
79
|
-
|
88
|
+
logger.info " Current database version: #{currentVersion}"
|
80
89
|
|
81
90
|
on_rollback {
|
82
91
|
if !interactive_mode || Capistrano::CLI.ui.agree("Do you really want to migrate #{symfony_env_prod}'s database back to version #{currentVersion}? (y/N)")
|
@@ -100,10 +109,10 @@ namespace :symfony do
|
|
100
109
|
namespace :schema do
|
101
110
|
desc "Allows you to #{action.to_s} databases, collections and indexes for your documents"
|
102
111
|
task action, :roles => :app, :except => { :no_release => true } do
|
103
|
-
|
112
|
+
capifony_pretty_print "--> Executing MongoDB schema #{action.to_s}"
|
104
113
|
|
105
114
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:schema:#{action.to_s} --env=#{symfony_env_prod}'", :once => true
|
106
|
-
|
115
|
+
capifony_puts_ok
|
107
116
|
end
|
108
117
|
end
|
109
118
|
|
@@ -111,10 +120,10 @@ namespace :symfony do
|
|
111
120
|
namespace :indexes do
|
112
121
|
desc "Allows you to #{action.to_s} indexes *only* for your documents"
|
113
122
|
task action, :roles => :app do
|
114
|
-
|
123
|
+
capifony_pretty_print "--> Executing MongoDB indexes #{action.to_s}"
|
115
124
|
|
116
125
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:schema:#{action.to_s} --index --env=#{symfony_env_prod}'", :once => true
|
117
|
-
|
126
|
+
capifony_puts_ok
|
118
127
|
end
|
119
128
|
end
|
120
129
|
end
|
@@ -124,10 +133,10 @@ namespace :symfony do
|
|
124
133
|
namespace :init do
|
125
134
|
desc "Mounts ACL tables in the database"
|
126
135
|
task :acl, :roles => :app, :except => { :no_release => true } do
|
127
|
-
|
136
|
+
capifony_pretty_print "--> Mounting Doctrine ACL tables"
|
128
137
|
|
129
138
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} init:acl --env=#{symfony_env_prod}'", :once => true
|
130
|
-
|
139
|
+
capifony_puts_ok
|
131
140
|
end
|
132
141
|
end
|
133
142
|
end
|
data/lib/symfony2/propel.rb
CHANGED
@@ -6,13 +6,13 @@ namespace :symfony do
|
|
6
6
|
task action, :roles => :app, :except => { :no_release => true } do
|
7
7
|
case action.to_s
|
8
8
|
when "create"
|
9
|
-
|
9
|
+
capifony_pretty_print "--> Creating databases"
|
10
10
|
when "drop"
|
11
|
-
|
11
|
+
capifony_pretty_print "--> Dropping databases"
|
12
12
|
end
|
13
13
|
|
14
14
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} propel:database:#{action.to_s} --env=#{symfony_env_prod}'", :once => true
|
15
|
-
|
15
|
+
capifony_puts_ok
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -25,10 +25,10 @@ namespace :symfony do
|
|
25
25
|
command = "propel:build-model"
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
capifony_pretty_print "--> Generating Propel classes"
|
29
29
|
|
30
30
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} #{command} --env=#{symfony_env_prod}'"
|
31
|
-
|
31
|
+
capifony_puts_ok
|
32
32
|
end
|
33
33
|
|
34
34
|
desc "Builds SQL statements"
|
@@ -38,10 +38,10 @@ namespace :symfony do
|
|
38
38
|
command = "propel:build-sql"
|
39
39
|
end
|
40
40
|
|
41
|
-
|
41
|
+
capifony_pretty_print "--> Generating Propel SQL"
|
42
42
|
|
43
43
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} #{command} --env=#{symfony_env_prod}'"
|
44
|
-
|
44
|
+
capifony_puts_ok
|
45
45
|
end
|
46
46
|
|
47
47
|
desc "Inserts SQL statements"
|
@@ -51,18 +51,18 @@ namespace :symfony do
|
|
51
51
|
command = "propel:insert-sql"
|
52
52
|
end
|
53
53
|
|
54
|
-
|
54
|
+
capifony_pretty_print "--> Inserting Propel SQL"
|
55
55
|
|
56
56
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} #{command} --force --env=#{symfony_env_prod}'", :once => true
|
57
|
-
|
57
|
+
capifony_puts_ok
|
58
58
|
end
|
59
59
|
|
60
60
|
desc "Builds the Model classes, SQL statements and insert SQL"
|
61
61
|
task :all_and_load, :roles => :app, :except => { :no_release => true } do
|
62
|
-
|
62
|
+
capifony_pretty_print "--> Setting up Propel (classes, SQL)"
|
63
63
|
|
64
64
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} propel:build --insert-sql --env=#{symfony_env_prod}'"
|
65
|
-
|
65
|
+
capifony_puts_ok
|
66
66
|
end
|
67
67
|
|
68
68
|
desc "Generates ACLs models"
|
data/lib/symfony2/symfony.rb
CHANGED
@@ -25,68 +25,68 @@ namespace :symfony do
|
|
25
25
|
namespace :assets do
|
26
26
|
desc "Updates assets version (in config.yml)"
|
27
27
|
task :update_version, :roles => :app, :except => { :no_release => true } do
|
28
|
-
|
28
|
+
run "#{try_sudo} sed -i 's/\\(assets_version: \\)\\([a-zA-Z0-9_]*\\)\\(.*\\)$/\\1 \"#{real_revision[0,7]}\"\\3/g' #{latest_release}/#{app_path}/config/config.yml"
|
29
29
|
end
|
30
30
|
|
31
31
|
desc "Installs bundle's assets"
|
32
32
|
task :install, :roles => :app, :except => { :no_release => true } do
|
33
|
-
|
33
|
+
capifony_pretty_print "--> Installing bundle's assets"
|
34
34
|
|
35
35
|
install_options = ''
|
36
36
|
|
37
37
|
if true == assets_symlinks then
|
38
|
-
|
38
|
+
install_options += " --symlink"
|
39
39
|
end
|
40
40
|
|
41
41
|
if true == assets_relative then
|
42
|
-
|
42
|
+
install_options += " --relative"
|
43
43
|
end
|
44
44
|
|
45
|
-
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} assets:install #{web_path}
|
46
|
-
|
45
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} assets:install #{web_path}#{install_options} --env=#{symfony_env_prod}'"
|
46
|
+
capifony_puts_ok
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
namespace :assetic do
|
51
51
|
desc "Dumps all assets to the filesystem"
|
52
52
|
task :dump, :roles => :app, :except => { :no_release => true } do
|
53
|
-
|
53
|
+
capifony_pretty_print "--> Dumping all assets to the filesystem"
|
54
54
|
|
55
55
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} assetic:dump --env=#{symfony_env_prod} --no-debug'"
|
56
|
-
|
56
|
+
capifony_puts_ok
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
60
|
namespace :vendors do
|
61
61
|
desc "Runs the bin/vendors script to install the vendors (fast if already installed)"
|
62
62
|
task :install, :roles => :app, :except => { :no_release => true } do
|
63
|
-
|
63
|
+
capifony_pretty_print "--> Installing vendors"
|
64
64
|
|
65
65
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_vendors} install'"
|
66
|
-
|
66
|
+
capifony_puts_ok
|
67
67
|
end
|
68
68
|
|
69
69
|
desc "Runs the bin/vendors script to reinstall the vendors"
|
70
70
|
task :reinstall, :roles => :app, :except => { :no_release => true } do
|
71
|
-
|
71
|
+
capifony_pretty_print "--> Reinstalling vendors"
|
72
72
|
|
73
73
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_vendors} install --reinstall'"
|
74
|
-
|
74
|
+
capifony_puts_ok
|
75
75
|
end
|
76
76
|
|
77
77
|
desc "Runs the bin/vendors script to upgrade the vendors"
|
78
78
|
task :upgrade, :roles => :app, :except => { :no_release => true } do
|
79
|
-
|
79
|
+
capifony_pretty_print "--> Upgrading vendors"
|
80
80
|
|
81
81
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_vendors} update'"
|
82
|
-
|
82
|
+
capifony_puts_ok
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
86
|
namespace :bootstrap do
|
87
87
|
desc "Runs the bin/build_bootstrap script"
|
88
88
|
task :build, :roles => :app, :except => { :no_release => true } do
|
89
|
-
|
89
|
+
capifony_pretty_print "--> Building bootstrap file"
|
90
90
|
|
91
91
|
if !remote_file_exists?("#{latest_release}/#{build_bootstrap}") && true == use_composer then
|
92
92
|
set :build_bootstrap, "vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php"
|
@@ -95,99 +95,102 @@ namespace :symfony do
|
|
95
95
|
run "#{try_sudo} sh -c 'cd #{latest_release} && test -f #{build_bootstrap} && #{php_bin} #{build_bootstrap} || echo '#{build_bootstrap} not found, skipped''"
|
96
96
|
end
|
97
97
|
|
98
|
-
|
98
|
+
capifony_puts_ok
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
102
|
namespace :composer do
|
103
103
|
desc "Gets composer and installs it"
|
104
104
|
task :get, :roles => :app, :except => { :no_release => true } do
|
105
|
-
pretty_print "--> Downloading Composer"
|
106
105
|
if !remote_file_exists?("#{latest_release}/composer.phar")
|
106
|
+
capifony_pretty_print "--> Downloading Composer"
|
107
|
+
|
107
108
|
run "#{try_sudo} sh -c 'cd #{latest_release} && curl -s http://getcomposer.org/installer | #{php_bin}'"
|
108
109
|
else
|
109
|
-
|
110
|
+
capifony_pretty_print "--> Updating Composer"
|
111
|
+
|
112
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} composer.phar self-update'"
|
110
113
|
end
|
111
|
-
|
114
|
+
capifony_puts_ok
|
112
115
|
end
|
113
116
|
|
114
117
|
desc "Updates composer"
|
115
|
-
task :
|
116
|
-
|
118
|
+
task :self_update, :roles => :app, :except => { :no_release => true } do
|
119
|
+
capifony_pretty_print "--> Updating Composer"
|
117
120
|
try_sudo "#{composer_bin} self-update"
|
118
|
-
|
121
|
+
capifony_puts_ok
|
119
122
|
end
|
120
123
|
|
121
124
|
desc "Runs composer to install vendors from composer.lock file"
|
122
125
|
task :install, :roles => :app, :except => { :no_release => true } do
|
123
126
|
if composer_bin
|
124
|
-
symfony.composer.
|
127
|
+
symfony.composer.self_update
|
125
128
|
else
|
126
129
|
symfony.composer.get
|
127
130
|
composer_bin = "#{php_bin} composer.phar"
|
128
131
|
end
|
129
132
|
|
130
|
-
|
133
|
+
capifony_pretty_print "--> Installing Composer dependencies"
|
131
134
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{composer_bin} install #{composer_options}'"
|
132
|
-
|
135
|
+
capifony_puts_ok
|
133
136
|
end
|
134
137
|
|
135
138
|
desc "Runs composer to update vendors, and composer.lock file"
|
136
139
|
task :update, :roles => :app, :except => { :no_release => true } do
|
137
140
|
if composer_bin
|
138
|
-
symfony.composer.
|
141
|
+
symfony.composer.self_update
|
139
142
|
else
|
140
143
|
symfony.composer.get
|
141
144
|
composer_bin = "#{php_bin} composer.phar"
|
142
145
|
end
|
143
146
|
|
144
|
-
|
147
|
+
capifony_pretty_print "--> Updating Composer dependencies"
|
145
148
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{composer_bin} update #{composer_options}'"
|
146
|
-
|
149
|
+
capifony_puts_ok
|
147
150
|
end
|
148
151
|
|
149
152
|
desc "Dumps an optimized autoloader"
|
150
153
|
task :dump_autoload, :roles => :app, :except => { :no_release => true } do
|
151
154
|
if composer_bin
|
152
|
-
symfony.composer.
|
155
|
+
symfony.composer.self_update
|
153
156
|
else
|
154
157
|
symfony.composer.get
|
155
158
|
composer_bin = "#{php_bin} composer.phar"
|
156
159
|
end
|
157
160
|
|
158
|
-
|
161
|
+
capifony_pretty_print "--> Dumping an optimized autoloader"
|
159
162
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{composer_bin} dump-autoload --optimize'"
|
160
|
-
|
163
|
+
capifony_puts_ok
|
161
164
|
end
|
162
165
|
end
|
163
166
|
|
164
167
|
namespace :cache do
|
165
168
|
desc "Clears cache"
|
166
169
|
task :clear, :roles => :app, :except => { :no_release => true } do
|
167
|
-
|
170
|
+
capifony_pretty_print "--> Clearing cache"
|
168
171
|
|
169
172
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} cache:clear --env=#{symfony_env_prod}'"
|
170
173
|
run "#{try_sudo} chmod -R g+w #{latest_release}/#{cache_path}"
|
171
|
-
|
174
|
+
capifony_puts_ok
|
172
175
|
end
|
173
176
|
|
174
177
|
desc "Warms up an empty cache"
|
175
178
|
task :warmup, :roles => :app, :except => { :no_release => true } do
|
176
|
-
|
179
|
+
capifony_pretty_print "--> Warming up cache"
|
177
180
|
|
178
181
|
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} cache:warmup --env=#{symfony_env_prod}'"
|
179
182
|
run "#{try_sudo} chmod -R g+w #{latest_release}/#{cache_path}"
|
180
|
-
|
183
|
+
capifony_puts_ok
|
181
184
|
end
|
182
185
|
end
|
183
186
|
|
184
187
|
namespace :project do
|
185
188
|
desc "Clears all non production environment controllers"
|
186
189
|
task :clear_controllers do
|
187
|
-
|
190
|
+
capifony_pretty_print "--> Clear controllers"
|
188
191
|
|
189
192
|
run "#{try_sudo} sh -c 'cd #{latest_release} && rm -f #{web_path}/app_*.php'"
|
190
|
-
|
193
|
+
capifony_puts_ok
|
191
194
|
end
|
192
195
|
end
|
193
196
|
end
|