capifony 2.1.14 → 2.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +14 -0
- data/lib/capifony.rb +2 -2
- data/lib/symfony1/database.rb +8 -12
- data/lib/symfony1/deploy.rb +10 -10
- data/lib/symfony1/doctrine.rb +10 -10
- data/lib/symfony1/propel.rb +8 -8
- data/lib/symfony1/symfony.rb +18 -18
- data/lib/symfony2.rb +15 -8
- data/lib/symfony2/database.rb +10 -10
- data/lib/symfony2/deploy.rb +16 -13
- data/lib/symfony2/doctrine.rb +31 -24
- data/lib/symfony2/propel.rb +7 -7
- data/lib/symfony2/symfony.rb +34 -33
- data/lib/symfony2/web.rb +1 -1
- metadata +4 -4
data/CHANGELOG
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
== 2.1.15 / September 10, 2012
|
2
|
+
|
3
|
+
* Fix #203
|
4
|
+
* Preliminary testing seems to show that this is generally how try_sudo was meant to be implemented, and is in fact how it is required to be implemented to work with things that depend on the output of run.
|
5
|
+
* --index is an invalid option when doing an update
|
6
|
+
* Setup a configurable Composer binary also. Refs #212
|
7
|
+
* Make the Composer options configurable
|
8
|
+
* Added symfony:doctrine:schema:update
|
9
|
+
* Remove unnecessary code.
|
10
|
+
* Fix regression. 'try_sudo' behaves differently from 'run' regarding the 'do' block.
|
11
|
+
* Possible fix for #202
|
12
|
+
* set_permissions: fix for acl method
|
13
|
+
* Fix this fucking dumb task. #195
|
14
|
+
|
1
15
|
== 2.1.14 / August 22, 2012
|
2
16
|
|
3
17
|
* Fix escaping in clear controllers #195
|
data/lib/capifony.rb
CHANGED
@@ -55,7 +55,7 @@ namespace :deploy do
|
|
55
55
|
DESC
|
56
56
|
task :setup, :roles => :app, :except => { :no_release => true } do
|
57
57
|
dirs = [deploy_to, releases_path, shared_path]
|
58
|
-
try_sudo
|
59
|
-
try_sudo
|
58
|
+
run "#{try_sudo} mkdir -p #{dirs.join(' ')}"
|
59
|
+
run "#{try_sudo} chmod g+w #{dirs.join(' ')}" if fetch(:group_writable, true)
|
60
60
|
end
|
61
61
|
end
|
data/lib/symfony1/database.rb
CHANGED
@@ -7,14 +7,12 @@ namespace :database do
|
|
7
7
|
sqlfile = "#{application}_dump.sql"
|
8
8
|
config = ""
|
9
9
|
|
10
|
-
try_sudo
|
10
|
+
run "#{try_sudo} cat #{shared_path}/config/databases.yml" do |ch, st, data|
|
11
11
|
config = load_database_config data, symfony_env_prod
|
12
12
|
end
|
13
13
|
|
14
14
|
sql_dump_cmd = generate_sql_command('dump', config)
|
15
|
-
try_sudo "#{sql_dump_cmd} | gzip -c > #{file}"
|
16
|
-
puts data
|
17
|
-
end
|
15
|
+
try_sudo "#{sql_dump_cmd} | gzip -c > #{file}"
|
18
16
|
|
19
17
|
require "fileutils"
|
20
18
|
FileUtils.mkdir_p("backups")
|
@@ -24,7 +22,7 @@ namespace :database do
|
|
24
22
|
rescue NotImplementedError # hack for windows which doesnt support symlinks
|
25
23
|
FileUtils.cp_r("backups/#{filename}", "backups/#{application}.remote_dump.latest.sql.gz")
|
26
24
|
end
|
27
|
-
try_sudo
|
25
|
+
run "#{try_sudo} rm #{file}"
|
28
26
|
end
|
29
27
|
|
30
28
|
desc "Dump local database"
|
@@ -96,9 +94,9 @@ namespace :database do
|
|
96
94
|
database.dump.local
|
97
95
|
|
98
96
|
upload(file, "#{remote_tmp_dir}/#{filename}", :via => :scp)
|
99
|
-
try_sudo
|
97
|
+
run "#{try_sudo} gunzip -c #{remote_tmp_dir}/#{filename} > #{remote_tmp_dir}/#{sqlfile}"
|
100
98
|
|
101
|
-
try_sudo
|
99
|
+
run "#{try_sudo} cat #{shared_path}/config/databases.yml" do |ch, st, data|
|
102
100
|
config = load_database_config data, symfony_env_prod
|
103
101
|
end
|
104
102
|
|
@@ -107,12 +105,10 @@ namespace :database do
|
|
107
105
|
|
108
106
|
sql_import_cmd = generate_sql_command('import', config)
|
109
107
|
|
110
|
-
try_sudo "#{sql_import_cmd} < #{remote_tmp_dir}/#{sqlfile}"
|
111
|
-
puts data
|
112
|
-
end
|
108
|
+
try_sudo "#{sql_import_cmd} < #{remote_tmp_dir}/#{sqlfile}"
|
113
109
|
|
114
|
-
try_sudo
|
115
|
-
try_sudo
|
110
|
+
run "#{try_sudo} rm #{remote_tmp_dir}/#{filename}"
|
111
|
+
run "#{try_sudo} rm #{remote_tmp_dir}/#{sqlfile}"
|
116
112
|
end
|
117
113
|
end
|
118
114
|
end
|
data/lib/symfony1/deploy.rb
CHANGED
@@ -8,26 +8,26 @@ namespace :deploy do
|
|
8
8
|
task :share_childs do
|
9
9
|
if shared_children
|
10
10
|
shared_children.each do |link|
|
11
|
-
try_sudo
|
12
|
-
try_sudo
|
13
|
-
try_sudo
|
11
|
+
run "#{try_sudo} mkdir -p #{shared_path}/#{link}"
|
12
|
+
run "#{try_sudo} sh -c 'if [ -d #{release_path}/#{link} ] ; then rm -rf #{release_path}/#{link}; fi'"
|
13
|
+
run "#{try_sudo} ln -nfs #{shared_path}/#{link} #{release_path}/#{link}"
|
14
14
|
end
|
15
15
|
end
|
16
16
|
if shared_files
|
17
17
|
shared_files.each do |link|
|
18
18
|
link_dir = File.dirname("#{shared_path}/#{link}")
|
19
|
-
try_sudo
|
20
|
-
try_sudo
|
21
|
-
try_sudo
|
19
|
+
run "#{try_sudo} mkdir -p #{link_dir}"
|
20
|
+
run "#{try_sudo} touch #{shared_path}/#{link}"
|
21
|
+
run "#{try_sudo} ln -nfs #{shared_path}/#{link} #{release_path}/#{link}"
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
desc "Customize the finalize_update task to work with symfony."
|
27
27
|
task :finalize_update, :except => { :no_release => true } do
|
28
|
-
try_sudo
|
29
|
-
try_sudo
|
30
|
-
try_sudo
|
28
|
+
run "#{try_sudo} chmod -R g+w #{latest_release}" if fetch(:group_writable, true)
|
29
|
+
run "#{try_sudo} mkdir -p #{latest_release}/cache"
|
30
|
+
run "#{try_sudo} chmod -R g+w #{latest_release}/cache"
|
31
31
|
|
32
32
|
# Share common files & folders
|
33
33
|
share_childs
|
@@ -35,7 +35,7 @@ namespace :deploy do
|
|
35
35
|
if fetch(:normalize_asset_timestamps, true)
|
36
36
|
stamp = Time.now.utc.strftime("%Y%m%d%H%M.%S")
|
37
37
|
asset_paths = asset_children.map { |p| "#{latest_release}/#{p}" }.join(" ")
|
38
|
-
try_sudo
|
38
|
+
run "#{try_sudo} find #{asset_paths} -exec touch -t #{stamp} {} ';'; true", :env => { "TZ" => "UTC" }
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
data/lib/symfony1/doctrine.rb
CHANGED
@@ -2,7 +2,7 @@ namespace :symfony do
|
|
2
2
|
namespace :doctrine do
|
3
3
|
desc "Compile doctrine"
|
4
4
|
task :compile do
|
5
|
-
try_sudo
|
5
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony doctrine:compile'"
|
6
6
|
end
|
7
7
|
|
8
8
|
desc "Ensure Doctrine is correctly configured"
|
@@ -22,54 +22,54 @@ namespace :symfony do
|
|
22
22
|
|
23
23
|
desc "Dumps data to the fixtures directory"
|
24
24
|
task :data_dump do
|
25
|
-
try_sudo
|
25
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony doctrine:data-dump --env=#{symfony_env_prod}'"
|
26
26
|
end
|
27
27
|
|
28
28
|
desc "Loads YAML fixture data"
|
29
29
|
task :data_load do
|
30
|
-
try_sudo
|
30
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony doctrine:data-load --env=#{symfony_env_prod}'"
|
31
31
|
end
|
32
32
|
|
33
33
|
desc "Loads YAML fixture data without remove"
|
34
34
|
task :data_load_append do
|
35
|
-
try_sudo
|
35
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony doctrine:data-load --append --env=#{symfony_env_prod}'"
|
36
36
|
end
|
37
37
|
|
38
38
|
desc "Migrates database to current version"
|
39
39
|
task :migrate do
|
40
|
-
try_sudo
|
40
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony doctrine:migrate --env=#{symfony_env_prod}'"
|
41
41
|
end
|
42
42
|
|
43
43
|
desc "Generate model lib form and filters classes based on your schema"
|
44
44
|
task :build_classes do
|
45
|
-
try_sudo
|
45
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony doctrine:build --all-classes --env=#{symfony_env_prod}'"
|
46
46
|
end
|
47
47
|
|
48
48
|
desc "Generate code & database based on your schema"
|
49
49
|
task :build_all do
|
50
50
|
if Capistrano::CLI.ui.agree("Do you really want to rebuild #{symfony_env_prod}'s database? (y/N)")
|
51
|
-
try_sudo
|
51
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony doctrine:build --all --no-confirmation --env=#{symfony_env_prod}'"
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
desc "Generate code & database based on your schema & load fixtures"
|
56
56
|
task :build_all_and_load do
|
57
57
|
if Capistrano::CLI.ui.agree("Do you really want to rebuild #{symfony_env_prod}'s database and load #{symfony_env_prod}'s fixtures? (y/N)")
|
58
|
-
try_sudo
|
58
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony doctrine:build --all --and-load --no-confirmation --env=#{symfony_env_prod}'"
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
62
|
desc "Generate sql & database based on your schema"
|
63
63
|
task :build_db do
|
64
64
|
if Capistrano::CLI.ui.agree("Do you really want to rebuild #{symfony_env_prod}'s database? (y/N)")
|
65
|
-
try_sudo
|
65
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony doctrine:build --sql --db --no-confirmation --env=#{symfony_env_prod}'"
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
69
|
desc "Generate sql & database based on your schema & load fixtures"
|
70
70
|
task :build_db_and_load do
|
71
71
|
if Capistrano::CLI.ui.agree("Do you really want to rebuild #{symfony_env_prod}'s database and load #{symfony_env_prod}'s fixtures? (y/N)")
|
72
|
-
try_sudo
|
72
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony doctrine:build --sql --db --and-load --no-confirmation --env=#{symfony_env_prod}'"
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
data/lib/symfony1/propel.rb
CHANGED
@@ -9,7 +9,7 @@ namespace :symfony do
|
|
9
9
|
deploy.share_childs
|
10
10
|
|
11
11
|
if (!conf_files_exists.eql?("exists"))
|
12
|
-
try_sudo
|
12
|
+
run "#{try_sudo} cp #{symfony_lib}/plugins/sfPropelPlugin/config/skeleton/config/propel.ini #{shared_path}/config/propel.ini"
|
13
13
|
symfony.configure.database
|
14
14
|
end
|
15
15
|
end
|
@@ -21,36 +21,36 @@ namespace :symfony do
|
|
21
21
|
|
22
22
|
desc "Generate model lib form and filters classes based on your schema"
|
23
23
|
task :build_classes do
|
24
|
-
try_sudo
|
25
|
-
try_sudo
|
26
|
-
try_sudo
|
24
|
+
run "#{try_sudo} php #{latest_release}/symfony propel:build --model --env=#{symfony_env_prod}"
|
25
|
+
run "#{try_sudo} php #{latest_release}/symfony propel:build --forms --env=#{symfony_env_prod}"
|
26
|
+
run "#{try_sudo} php #{latest_release}/symfony propel:build --filters --env=#{symfony_env_prod}"
|
27
27
|
end
|
28
28
|
|
29
29
|
desc "Generate code & database based on your schema"
|
30
30
|
task :build_all do
|
31
31
|
if Capistrano::CLI.ui.agree("Do you really want to rebuild #{symfony_env_prod}'s database? (y/N)")
|
32
|
-
try_sudo
|
32
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony propel:build --sql --db --no-confirmation --env=#{symfony_env_prod}'"
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
desc "Generate code & database based on your schema & load fixtures"
|
37
37
|
task :build_all_and_load do
|
38
38
|
if Capistrano::CLI.ui.agree("Do you really want to rebuild #{symfony_env_prod}'s database and load #{symfony_env_prod}'s fixtures? (y/N)")
|
39
|
-
try_sudo
|
39
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony propel:build --sql --db --and-load --no-confirmation --env=#{symfony_env_prod}'"
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
desc "Generate sql & database based on your schema"
|
44
44
|
task :build_db do
|
45
45
|
if Capistrano::CLI.ui.agree("Do you really want to rebuild #{symfony_env_prod}'s database? (y/N)")
|
46
|
-
try_sudo
|
46
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony propel:build --sql --db --no-confirmation --env=#{symfony_env_prod}'"
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
desc "Generate sql & database based on your schema & load fixtures"
|
51
51
|
task :build_db_and_load do
|
52
52
|
if Capistrano::CLI.ui.agree("Do you really want to rebuild #{symfony_env_prod}'s database and load #{symfony_env_prod}'s fixtures? (y/N)")
|
53
|
-
try_sudo
|
53
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony propel:build --sql --db --and-load --no-confirmation --env=#{symfony_env_prod}'"
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
data/lib/symfony1/symfony.rb
CHANGED
@@ -10,15 +10,15 @@ namespace :symfony do
|
|
10
10
|
task :check_configuration do
|
11
11
|
prompt_with_default(:version, "1.4")
|
12
12
|
|
13
|
-
try_sudo
|
13
|
+
run "#{try_sudo} wget http://sf-to.org/#{version}/check.php -O /tmp/check_configuration.php"
|
14
14
|
stream "#{php_bin} /tmp/check_configuration.php"
|
15
|
-
try_sudo
|
15
|
+
run "#{try_sudo} rm /tmp/check_configuration.php"
|
16
16
|
end
|
17
17
|
|
18
18
|
desc "Clears the cache"
|
19
19
|
task :cc do
|
20
|
-
try_sudo
|
21
|
-
try_sudo
|
20
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{try_sudo} #{php_bin} ./symfony cache:clear'"
|
21
|
+
run "#{try_sudo} chmod -R g+w #{latest_release}/cache"
|
22
22
|
end
|
23
23
|
|
24
24
|
desc "Creates symbolic link to symfony lib in shared"
|
@@ -26,8 +26,8 @@ namespace :symfony do
|
|
26
26
|
prompt_with_default(:version, symfony_version)
|
27
27
|
symlink_path = "#{latest_release}/lib/vendor/symfony"
|
28
28
|
|
29
|
-
try_sudo
|
30
|
-
try_sudo
|
29
|
+
run "#{try_sudo} sh -c 'if [ ! -d #{shared_path}/symfony-#{version} ]; then exit 1; fi;'"
|
30
|
+
run "#{try_sudo} ln -nfs #{shared_path}/symfony-#{version} #{symlink_path};"
|
31
31
|
end
|
32
32
|
|
33
33
|
namespace :configure do
|
@@ -54,29 +54,29 @@ namespace :symfony do
|
|
54
54
|
namespace :project do
|
55
55
|
desc "Disables an application in a given environment"
|
56
56
|
task :disable do
|
57
|
-
try_sudo
|
57
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony project:disable #{symfony_env_prod}'"
|
58
58
|
end
|
59
59
|
|
60
60
|
desc "Enables an application in a given environment"
|
61
61
|
task :enable do
|
62
|
-
try_sudo
|
62
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony project:enable #{symfony_env_prod}'"
|
63
63
|
end
|
64
64
|
|
65
65
|
desc "Fixes symfony directory permissions"
|
66
66
|
task :permissions do
|
67
|
-
try_sudo
|
67
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony project:permissions'"
|
68
68
|
end
|
69
69
|
|
70
70
|
desc "Optimizes a project for better performance"
|
71
71
|
task :optimize do
|
72
72
|
prompt_with_default(:application, "frontend")
|
73
73
|
|
74
|
-
try_sudo
|
74
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony project:optimize #{application}'"
|
75
75
|
end
|
76
76
|
|
77
77
|
desc "Clears all non production environment controllers"
|
78
78
|
task :clear_controllers do
|
79
|
-
try_sudo
|
79
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony project:clear-controllers'"
|
80
80
|
end
|
81
81
|
|
82
82
|
desc "Sends emails stored in a queue"
|
@@ -103,7 +103,7 @@ namespace :symfony do
|
|
103
103
|
cmd << "cp #{release_path}/web/#{app}_#{env}.php #{release_path}/web/#{app}.php"
|
104
104
|
end
|
105
105
|
|
106
|
-
try_sudo
|
106
|
+
run "#{try_sudo} -s #{cmd.join(';')}" if cmd.join(';')
|
107
107
|
end
|
108
108
|
end
|
109
109
|
end
|
@@ -111,40 +111,40 @@ namespace :symfony do
|
|
111
111
|
namespace :plugin do
|
112
112
|
desc "Publishes web assets for all plugins"
|
113
113
|
task :publish_assets do
|
114
|
-
try_sudo
|
114
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony plugin:publish-assets'"
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
118
|
namespace :log do
|
119
119
|
desc "Clears log files"
|
120
120
|
task :clear do
|
121
|
-
try_sudo
|
121
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony log:clear'"
|
122
122
|
end
|
123
123
|
|
124
124
|
desc "Rotates an application's log files"
|
125
125
|
task :rotate do
|
126
126
|
prompt_with_default(:application, "frontend")
|
127
127
|
|
128
|
-
try_sudo
|
128
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony log:rotate #{application} #{symfony_env_prod}'"
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
132
|
namespace :tests do
|
133
133
|
desc "Launches all tests"
|
134
134
|
task :all do
|
135
|
-
try_sudo
|
135
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony test:all'"
|
136
136
|
end
|
137
137
|
|
138
138
|
desc "Launches functional tests"
|
139
139
|
task :functional do
|
140
140
|
prompt_with_default(:application, "frontend")
|
141
141
|
|
142
|
-
try_sudo
|
142
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony test:functional #{application}'"
|
143
143
|
end
|
144
144
|
|
145
145
|
desc "Launches unit tests"
|
146
146
|
task :unit do
|
147
|
-
try_sudo
|
147
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony test:unit'"
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
data/lib/symfony2.rb
CHANGED
@@ -36,6 +36,13 @@ set :build_bootstrap, "bin/build_bootstrap"
|
|
36
36
|
# If set to false, it will use the bin/vendors script
|
37
37
|
set :use_composer, false
|
38
38
|
|
39
|
+
# Path to composer binary
|
40
|
+
# If set to false, Capifony will download/install composer
|
41
|
+
set :composer_bin, false
|
42
|
+
|
43
|
+
# Options to pass to composer when installing/updating
|
44
|
+
set :composer_options, "--no-scripts --verbose"
|
45
|
+
|
39
46
|
# Whether to update vendors using the configured dependency manager (composer or bin/vendors)
|
40
47
|
set :update_vendors, false
|
41
48
|
|
@@ -57,7 +64,7 @@ set :assets_relative, false
|
|
57
64
|
set :update_assets_version, false
|
58
65
|
|
59
66
|
# Need to clear *_dev controllers
|
60
|
-
set :clear_controllers,
|
67
|
+
set :clear_controllers, true
|
61
68
|
|
62
69
|
# Files that need to remain the same between deploys
|
63
70
|
set :shared_files, false
|
@@ -102,7 +109,7 @@ def remote_file_exists?(full_path)
|
|
102
109
|
end
|
103
110
|
|
104
111
|
def remote_command_exists?(command)
|
105
|
-
'true' == capture("
|
112
|
+
'true' == capture("if [ -x \"$(which #{command})\" ]; then echo 'true'; fi").strip
|
106
113
|
end
|
107
114
|
|
108
115
|
after "deploy:finalize_update" do
|
@@ -130,19 +137,19 @@ after "deploy:finalize_update" do
|
|
130
137
|
end
|
131
138
|
|
132
139
|
if assets_install
|
133
|
-
symfony.assets.install #
|
140
|
+
symfony.assets.install # Publish bundle assets
|
134
141
|
end
|
135
142
|
|
136
|
-
if
|
137
|
-
symfony.
|
143
|
+
if update_assets_version
|
144
|
+
symfony.assets.update_version # Update `assets_version`
|
138
145
|
end
|
139
146
|
|
140
|
-
if
|
141
|
-
symfony.
|
147
|
+
if cache_warmup
|
148
|
+
symfony.cache.warmup # Warmup clean cache
|
142
149
|
end
|
143
150
|
|
144
151
|
if dump_assetic_assets
|
145
|
-
symfony.assetic.dump #
|
152
|
+
symfony.assetic.dump # Dump assetic assets
|
146
153
|
end
|
147
154
|
|
148
155
|
if clear_controllers
|
data/lib/symfony2/database.rb
CHANGED
@@ -10,17 +10,17 @@ namespace :database do
|
|
10
10
|
sqlfile = "#{application}_dump.sql"
|
11
11
|
config = ""
|
12
12
|
|
13
|
-
try_sudo
|
13
|
+
run "#{try_sudo} cat #{current_path}/#{app_path}/config/parameters.yml" do |ch, st, data|
|
14
14
|
config = load_database_config data, symfony_env_prod
|
15
15
|
end
|
16
16
|
|
17
17
|
case config['database_driver']
|
18
18
|
when "pdo_mysql", "mysql"
|
19
|
-
try_sudo
|
19
|
+
run "#{try_sudo} mysqldump -u#{config['database_user']} --password='#{config['database_password']}' #{config['database_name']} | gzip -c > #{file}" do |ch, stream, data|
|
20
20
|
puts data
|
21
21
|
end
|
22
22
|
when "pdo_pgsql", "pgsql"
|
23
|
-
try_sudo
|
23
|
+
run "#{try_sudo} pg_dump -U #{config['database_user']} #{config['database_name']} --clean | gzip -c > #{file}" do |ch, stream, data|
|
24
24
|
puts data
|
25
25
|
end
|
26
26
|
end
|
@@ -32,7 +32,7 @@ namespace :database do
|
|
32
32
|
rescue NotImplementedError # hack for windows which doesnt support symlinks
|
33
33
|
FileUtils.cp_r("backups/#{filename}", "backups/#{application}.remote_dump.latest.sql.gz")
|
34
34
|
end
|
35
|
-
try_sudo
|
35
|
+
run "#{try_sudo} rm #{file}"
|
36
36
|
end
|
37
37
|
|
38
38
|
desc "Dumps local database"
|
@@ -102,25 +102,25 @@ namespace :database do
|
|
102
102
|
database.dump.local
|
103
103
|
|
104
104
|
upload(file, "#{remote_tmp_dir}/#{filename}", :via => :scp)
|
105
|
-
try_sudo
|
105
|
+
run "#{try_sudo} gunzip -c #{remote_tmp_dir}/#{filename} > #{remote_tmp_dir}/#{sqlfile}"
|
106
106
|
|
107
|
-
try_sudo
|
107
|
+
run "#{try_sudo} cat #{current_path}/#{app_path}/config/parameters.yml" do |ch, st, data|
|
108
108
|
config = load_database_config data, symfony_env_prod
|
109
109
|
end
|
110
110
|
|
111
111
|
case config['database_driver']
|
112
112
|
when "pdo_mysql", "mysql"
|
113
|
-
try_sudo
|
113
|
+
run "#{try_sudo} mysql -u#{config['database_user']} --password='#{config['database_password']}' #{config['database_name']} < #{remote_tmp_dir}/#{sqlfile}" do |ch, stream, data|
|
114
114
|
puts data
|
115
115
|
end
|
116
116
|
when "pdo_pgsql", "pgsql"
|
117
|
-
try_sudo
|
117
|
+
run "#{try_sudo} psql -U #{config['database_user']} #{config['database_name']} < #{remote_tmp_dir}/#{sqlfile}" do |ch, stream, data|
|
118
118
|
puts data
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
-
try_sudo
|
123
|
-
try_sudo
|
122
|
+
run "#{try_sudo} rm #{remote_tmp_dir}/#{filename}"
|
123
|
+
run "#{try_sudo} rm #{remote_tmp_dir}/#{sqlfile}"
|
124
124
|
end
|
125
125
|
end
|
126
126
|
end
|
data/lib/symfony2/deploy.rb
CHANGED
@@ -23,7 +23,10 @@ namespace :deploy do
|
|
23
23
|
"chmod +a \"#{user} allow delete,write,append,file_inherit,directory_inherit\" %s",
|
24
24
|
"chmod +a \"#{webserver_user} allow delete,write,append,file_inherit,directory_inherit\" %s"
|
25
25
|
],
|
26
|
-
:acl => [
|
26
|
+
:acl => [
|
27
|
+
"setfacl -R -m u:#{user}:rwx -m u:#{webserver_user}:rwx %s",
|
28
|
+
"setfacl -dR -m u:#{user}:rwx -m u:#{webserver_user}:rwx %s"
|
29
|
+
],
|
27
30
|
:chown => ["chown #{webserver_user} %s"]
|
28
31
|
}
|
29
32
|
|
@@ -61,9 +64,9 @@ namespace :deploy do
|
|
61
64
|
pretty_print "--> Creating symlinks for shared directories"
|
62
65
|
|
63
66
|
shared_children.each do |link|
|
64
|
-
try_sudo
|
65
|
-
try_sudo
|
66
|
-
try_sudo
|
67
|
+
run "#{try_sudo} mkdir -p #{shared_path}/#{link}"
|
68
|
+
run "#{try_sudo} sh -c 'if [ -d #{release_path}/#{link} ] ; then rm -rf #{release_path}/#{link}; fi'"
|
69
|
+
run "#{try_sudo} ln -nfs #{shared_path}/#{link} #{release_path}/#{link}"
|
67
70
|
end
|
68
71
|
|
69
72
|
puts_ok
|
@@ -74,9 +77,9 @@ namespace :deploy do
|
|
74
77
|
|
75
78
|
shared_files.each do |link|
|
76
79
|
link_dir = File.dirname("#{shared_path}/#{link}")
|
77
|
-
try_sudo
|
78
|
-
try_sudo
|
79
|
-
try_sudo
|
80
|
+
run "#{try_sudo} mkdir -p #{link_dir}"
|
81
|
+
run "#{try_sudo} touch #{shared_path}/#{link}"
|
82
|
+
run "#{try_sudo} ln -nfs #{shared_path}/#{link} #{release_path}/#{link}"
|
80
83
|
end
|
81
84
|
|
82
85
|
puts_ok
|
@@ -85,13 +88,13 @@ namespace :deploy do
|
|
85
88
|
|
86
89
|
desc "Updates latest release source path"
|
87
90
|
task :finalize_update, :roles => :app, :except => { :no_release => true } do
|
88
|
-
try_sudo
|
91
|
+
run "#{try_sudo} chmod -R g+w #{latest_release}" if fetch(:group_writable, true)
|
89
92
|
|
90
93
|
pretty_print "--> Creating cache directory"
|
91
94
|
|
92
|
-
try_sudo
|
93
|
-
try_sudo
|
94
|
-
try_sudo
|
95
|
+
run "#{try_sudo} sh -c 'if [ -d #{latest_release}/#{cache_path} ] ; then rm -rf #{latest_release}/#{cache_path}; fi'"
|
96
|
+
run "#{try_sudo} sh -c 'mkdir -p #{latest_release}/#{cache_path} && chmod -R 0777 #{latest_release}/#{cache_path}'"
|
97
|
+
run "#{try_sudo} chmod -R g+w #{latest_release}/#{cache_path}"
|
95
98
|
|
96
99
|
puts_ok
|
97
100
|
|
@@ -106,7 +109,7 @@ namespace :deploy do
|
|
106
109
|
else
|
107
110
|
pretty_print "--> Normalizing asset timestamps"
|
108
111
|
|
109
|
-
try_sudo
|
112
|
+
run "#{try_sudo} find #{asset_paths} -exec touch -t #{stamp} {} ';' &> /dev/null || true", :env => { "TZ" => "UTC" }
|
110
113
|
puts_ok
|
111
114
|
end
|
112
115
|
end
|
@@ -125,7 +128,7 @@ namespace :deploy do
|
|
125
128
|
task :testall, :roles => :app, :except => { :no_release => true } do
|
126
129
|
update_code
|
127
130
|
create_symlink
|
128
|
-
try_sudo
|
131
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && phpunit -c #{app_path} src'"
|
129
132
|
end
|
130
133
|
|
131
134
|
desc "Runs the Symfony2 migrations"
|
data/lib/symfony2/doctrine.rb
CHANGED
@@ -5,7 +5,7 @@ namespace :symfony do
|
|
5
5
|
task :clear_metadata, :roles => :app, :except => { :no_release => true } do
|
6
6
|
pretty_print "--> Clearing Doctrine metadata cache"
|
7
7
|
|
8
|
-
try_sudo
|
8
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-metadata --env=#{symfony_env_prod}'"
|
9
9
|
puts_ok
|
10
10
|
end
|
11
11
|
|
@@ -13,7 +13,7 @@ namespace :symfony do
|
|
13
13
|
task :clear_query, :roles => :app, :except => { :no_release => true } do
|
14
14
|
pretty_print "--> Clearing Doctrine query cache"
|
15
15
|
|
16
|
-
try_sudo
|
16
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-query --env=#{symfony_env_prod}'"
|
17
17
|
puts_ok
|
18
18
|
end
|
19
19
|
|
@@ -21,7 +21,7 @@ namespace :symfony do
|
|
21
21
|
task :clear_result, :roles => :app, :except => { :no_release => true } do
|
22
22
|
pretty_print "--> Clearing Doctrine result cache"
|
23
23
|
|
24
|
-
try_sudo
|
24
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-result --env=#{symfony_env_prod}'"
|
25
25
|
puts_ok
|
26
26
|
end
|
27
27
|
end
|
@@ -37,7 +37,7 @@ namespace :symfony do
|
|
37
37
|
pretty_print "--> Dropping databases"
|
38
38
|
end
|
39
39
|
|
40
|
-
try_sudo
|
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
|
puts_ok
|
42
42
|
end
|
43
43
|
end
|
@@ -46,12 +46,17 @@ 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
|
-
try_sudo
|
49
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:create --env=#{symfony_env_prod}'", :once => true
|
50
50
|
end
|
51
51
|
|
52
52
|
desc "Drops the complete database schema of EntityManager Storage Connection or generate the corresponding SQL output"
|
53
53
|
task :drop, :roles => :app, :except => { :no_release => true } do
|
54
|
-
try_sudo
|
54
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:drop --env=#{symfony_env_prod}'", :once => true
|
55
|
+
end
|
56
|
+
|
57
|
+
desc "Updates database schema of EntityManager Storage Connection"
|
58
|
+
task :update, :roles => :app, :except => { :no_release => true } do
|
59
|
+
try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:update --force --env=#{symfony_env_prod}'", :once => true
|
55
60
|
end
|
56
61
|
end
|
57
62
|
|
@@ -59,7 +64,7 @@ namespace :symfony do
|
|
59
64
|
desc "Executes a migration to a specified version or the latest available version"
|
60
65
|
task :migrate, :roles => :app, :except => { :no_release => true } do
|
61
66
|
currentVersion = nil
|
62
|
-
try_sudo
|
67
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} --no-ansi doctrine:migrations:status --env=#{symfony_env_prod}'", :once => true do |ch, stream, out|
|
63
68
|
if stream == :out and out =~ /Current Version:.+\(([\w]+)\)/
|
64
69
|
currentVersion = Regexp.last_match(1)
|
65
70
|
end
|
@@ -75,18 +80,18 @@ namespace :symfony do
|
|
75
80
|
|
76
81
|
on_rollback {
|
77
82
|
if !interactive_mode || Capistrano::CLI.ui.agree("Do you really want to migrate #{symfony_env_prod}'s database back to version #{currentVersion}? (y/N)")
|
78
|
-
try_sudo
|
83
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:migrate #{currentVersion} --env=#{symfony_env_prod} --no-interaction'", :once => true
|
79
84
|
end
|
80
85
|
}
|
81
86
|
|
82
87
|
if !interactive_mode || Capistrano::CLI.ui.agree("Do you really want to migrate #{symfony_env_prod}'s database? (y/N)")
|
83
|
-
try_sudo
|
88
|
+
run "#{try_sudo} sh -c ' cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:migrate --env=#{symfony_env_prod} --no-interaction'", :once => true
|
84
89
|
end
|
85
90
|
end
|
86
91
|
|
87
92
|
desc "Views the status of a set of migrations"
|
88
93
|
task :status, :roles => :app, :except => { :no_release => true } do
|
89
|
-
try_sudo
|
94
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:status --env=#{symfony_env_prod}'", :once => true
|
90
95
|
end
|
91
96
|
end
|
92
97
|
|
@@ -97,31 +102,33 @@ namespace :symfony do
|
|
97
102
|
task action, :roles => :app, :except => { :no_release => true } do
|
98
103
|
pretty_print "--> Executing MongoDB schema #{action.to_s}"
|
99
104
|
|
100
|
-
try_sudo
|
105
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:schema:#{action.to_s} --env=#{symfony_env_prod}'", :once => true
|
101
106
|
puts_ok
|
102
107
|
end
|
103
108
|
end
|
104
109
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
110
|
+
if action != :update
|
111
|
+
namespace :indexes do
|
112
|
+
desc "Allows you to #{action.to_s} indexes *only* for your documents"
|
113
|
+
task action, :roles => :app do
|
114
|
+
pretty_print "--> Executing MongoDB indexes #{action.to_s}"
|
109
115
|
|
110
|
-
|
111
|
-
|
116
|
+
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
|
+
puts_ok
|
118
|
+
end
|
112
119
|
end
|
113
120
|
end
|
114
121
|
end
|
115
122
|
end
|
116
|
-
end
|
117
123
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
124
|
+
namespace :init do
|
125
|
+
desc "Mounts ACL tables in the database"
|
126
|
+
task :acl, :roles => :app, :except => { :no_release => true } do
|
127
|
+
pretty_print "--> Mounting Doctrine ACL tables"
|
122
128
|
|
123
|
-
|
124
|
-
|
129
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} init:acl --env=#{symfony_env_prod}'", :once => true
|
130
|
+
puts_ok
|
131
|
+
end
|
125
132
|
end
|
126
133
|
end
|
127
134
|
end
|
data/lib/symfony2/propel.rb
CHANGED
@@ -11,7 +11,7 @@ namespace :symfony do
|
|
11
11
|
pretty_print "--> Dropping databases"
|
12
12
|
end
|
13
13
|
|
14
|
-
try_sudo
|
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
|
puts_ok
|
16
16
|
end
|
17
17
|
end
|
@@ -27,7 +27,7 @@ namespace :symfony do
|
|
27
27
|
|
28
28
|
pretty_print "--> Generating Propel classes"
|
29
29
|
|
30
|
-
try_sudo
|
30
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} #{command} --env=#{symfony_env_prod}'"
|
31
31
|
puts_ok
|
32
32
|
end
|
33
33
|
|
@@ -40,7 +40,7 @@ namespace :symfony do
|
|
40
40
|
|
41
41
|
pretty_print "--> Generating Propel SQL"
|
42
42
|
|
43
|
-
try_sudo
|
43
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} #{command} --env=#{symfony_env_prod}'"
|
44
44
|
puts_ok
|
45
45
|
end
|
46
46
|
|
@@ -53,7 +53,7 @@ namespace :symfony do
|
|
53
53
|
|
54
54
|
pretty_print "--> Inserting Propel SQL"
|
55
55
|
|
56
|
-
try_sudo
|
56
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} #{command} --force --env=#{symfony_env_prod}'", :once => true
|
57
57
|
puts_ok
|
58
58
|
end
|
59
59
|
|
@@ -61,18 +61,18 @@ namespace :symfony do
|
|
61
61
|
task :all_and_load, :roles => :app, :except => { :no_release => true } do
|
62
62
|
pretty_print "--> Setting up Propel (classes, SQL)"
|
63
63
|
|
64
|
-
try_sudo
|
64
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} propel:build --insert-sql --env=#{symfony_env_prod}'"
|
65
65
|
puts_ok
|
66
66
|
end
|
67
67
|
|
68
68
|
desc "Generates ACLs models"
|
69
69
|
task :acl, :roles => :app, :except => { :no_release => true } do
|
70
|
-
try_sudo
|
70
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} propel:acl:init --env=#{symfony_env_prod}'"
|
71
71
|
end
|
72
72
|
|
73
73
|
desc "Inserts propel ACL tables"
|
74
74
|
task :acl_load, :roles => :app, :except => { :no_release => true } do
|
75
|
-
try_sudo
|
75
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} propel:acl:init --env=#{symfony_env_prod} --force'", :once => true
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
data/lib/symfony2/symfony.rb
CHANGED
@@ -12,7 +12,7 @@ namespace :symfony do
|
|
12
12
|
log = action.to_s == 'tail' ? 'prod.log' : 'dev.log'
|
13
13
|
desc "Tail #{log}"
|
14
14
|
task action, :roles => :app, :except => { :no_release => true } do
|
15
|
-
try_sudo
|
15
|
+
run "#{try_sudo} tail -n #{lines} -f #{shared_path}/#{log_path}/#{log}" do |channel, stream, data|
|
16
16
|
trap("INT") { puts 'Interupted'; exit 0; }
|
17
17
|
puts
|
18
18
|
puts "#{channel[:host]}: #{data}"
|
@@ -25,7 +25,7 @@ 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
|
-
try_sudo
|
28
|
+
run "#{try_sudo} sed -i 's/\\(assets_version: \\)\\(.*\\)$/\\1 #{real_revision}/g' #{latest_release}/#{app_path}/config/config.yml"
|
29
29
|
end
|
30
30
|
|
31
31
|
desc "Installs bundle's assets"
|
@@ -42,7 +42,7 @@ namespace :symfony do
|
|
42
42
|
install_options += " --relative"
|
43
43
|
end
|
44
44
|
|
45
|
-
try_sudo
|
45
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} assets:install #{web_path} #{install_options} --env=#{symfony_env_prod}'"
|
46
46
|
puts_ok
|
47
47
|
end
|
48
48
|
end
|
@@ -52,7 +52,7 @@ namespace :symfony do
|
|
52
52
|
task :dump, :roles => :app, :except => { :no_release => true } do
|
53
53
|
pretty_print "--> Dumping all assets to the filesystem"
|
54
54
|
|
55
|
-
try_sudo
|
55
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} assetic:dump --env=#{symfony_env_prod} --no-debug'"
|
56
56
|
puts_ok
|
57
57
|
end
|
58
58
|
end
|
@@ -62,7 +62,7 @@ namespace :symfony do
|
|
62
62
|
task :install, :roles => :app, :except => { :no_release => true } do
|
63
63
|
pretty_print "--> Installing vendors"
|
64
64
|
|
65
|
-
try_sudo
|
65
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_vendors} install'"
|
66
66
|
puts_ok
|
67
67
|
end
|
68
68
|
|
@@ -70,7 +70,7 @@ namespace :symfony do
|
|
70
70
|
task :reinstall, :roles => :app, :except => { :no_release => true } do
|
71
71
|
pretty_print "--> Reinstalling vendors"
|
72
72
|
|
73
|
-
try_sudo
|
73
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_vendors} install --reinstall'"
|
74
74
|
puts_ok
|
75
75
|
end
|
76
76
|
|
@@ -78,7 +78,7 @@ namespace :symfony do
|
|
78
78
|
task :upgrade, :roles => :app, :except => { :no_release => true } do
|
79
79
|
pretty_print "--> Upgrading vendors"
|
80
80
|
|
81
|
-
try_sudo
|
81
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_vendors} update'"
|
82
82
|
puts_ok
|
83
83
|
end
|
84
84
|
end
|
@@ -90,9 +90,9 @@ namespace :symfony do
|
|
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"
|
93
|
-
try_sudo
|
93
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && test -f #{build_bootstrap} && #{php_bin} #{build_bootstrap} #{app_path} || echo '#{build_bootstrap} not found, skipped''"
|
94
94
|
else
|
95
|
-
try_sudo
|
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
|
puts_ok
|
@@ -102,46 +102,47 @@ namespace :symfony do
|
|
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
|
-
|
106
|
-
|
107
|
-
|
108
|
-
try_sudo "composer self-update"
|
105
|
+
pretty_print "--> Downloading Composer"
|
106
|
+
if !remote_file_exists?("#{latest_release}/composer.phar")
|
107
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && curl -s http://getcomposer.org/installer | #{php_bin}'"
|
109
108
|
else
|
110
|
-
|
111
|
-
|
112
|
-
try_sudo "sh -c 'cd #{latest_release} && curl -s http://getcomposer.org/installer | #{php_bin}'"
|
109
|
+
run "#{try_sudo} cd #{latest_release} && #{php_bin} composer.phar self-update"
|
113
110
|
end
|
111
|
+
puts_ok
|
112
|
+
end
|
114
113
|
|
114
|
+
desc "Updates composer"
|
115
|
+
task :update, :roles => :app, :except => { :no_release => true } do
|
116
|
+
pretty_print "--> Updating Composer"
|
117
|
+
try_sudo "#{composer_bin} self-update"
|
115
118
|
puts_ok
|
116
119
|
end
|
117
120
|
|
118
121
|
desc "Runs composer to install vendors from composer.lock file"
|
119
122
|
task :install, :roles => :app, :except => { :no_release => true } do
|
120
|
-
composer_bin
|
121
|
-
|
122
|
-
|
123
|
-
elsif !remote_file_exists?("#{latest_release}/composer.phar")
|
123
|
+
if composer_bin
|
124
|
+
symfony.composer.update
|
125
|
+
else
|
124
126
|
symfony.composer.get
|
127
|
+
composer_bin = "#{php_bin} composer.phar"
|
125
128
|
end
|
126
129
|
|
127
130
|
pretty_print "--> Installing Composer dependencies"
|
128
|
-
|
129
|
-
try_sudo "sh -c 'cd #{latest_release} && #{composer_bin} install --no-scripts --verbose'"
|
131
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{composer_bin} install #{composer_options}'"
|
130
132
|
puts_ok
|
131
133
|
end
|
132
134
|
|
133
135
|
desc "Runs composer to update vendors, and composer.lock file"
|
134
136
|
task :update, :roles => :app, :except => { :no_release => true } do
|
135
|
-
composer_bin
|
136
|
-
|
137
|
-
|
138
|
-
elsif !remote_file_exists?("#{latest_release}/composer.phar")
|
137
|
+
if composer_bin
|
138
|
+
symfony.composer.update
|
139
|
+
else
|
139
140
|
symfony.composer.get
|
141
|
+
composer_bin = "#{php_bin} composer.phar"
|
140
142
|
end
|
141
143
|
|
142
144
|
pretty_print "--> Updating Composer dependencies"
|
143
|
-
|
144
|
-
try_sudo "sh -c 'cd #{latest_release} && #{composer_bin} update --no-scripts --verbose'"
|
145
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{composer_bin} update #{composer_options}'"
|
145
146
|
puts_ok
|
146
147
|
end
|
147
148
|
end
|
@@ -151,8 +152,8 @@ namespace :symfony do
|
|
151
152
|
task :clear, :roles => :app, :except => { :no_release => true } do
|
152
153
|
pretty_print "--> Clearing cache"
|
153
154
|
|
154
|
-
try_sudo
|
155
|
-
try_sudo
|
155
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} cache:clear --env=#{symfony_env_prod}'"
|
156
|
+
run "#{try_sudo} chmod -R g+w #{latest_release}/#{cache_path}"
|
156
157
|
puts_ok
|
157
158
|
end
|
158
159
|
|
@@ -160,8 +161,8 @@ namespace :symfony do
|
|
160
161
|
task :warmup, :roles => :app, :except => { :no_release => true } do
|
161
162
|
pretty_print "--> Warming up cache"
|
162
163
|
|
163
|
-
try_sudo
|
164
|
-
try_sudo
|
164
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} cache:warmup --env=#{symfony_env_prod}'"
|
165
|
+
run "#{try_sudo} chmod -R g+w #{latest_release}/#{cache_path}"
|
165
166
|
puts_ok
|
166
167
|
end
|
167
168
|
end
|
@@ -171,7 +172,7 @@ namespace :symfony do
|
|
171
172
|
task :clear_controllers do
|
172
173
|
pretty_print "--> Clear controllers"
|
173
174
|
|
174
|
-
try_sudo
|
175
|
+
run "#{try_sudo} sh -c 'cd #{latest_release} && rm -f #{web_path}/app_*.php'"
|
175
176
|
puts_ok
|
176
177
|
end
|
177
178
|
end
|
data/lib/symfony2/web.rb
CHANGED
@@ -63,7 +63,7 @@ namespace :deploy do
|
|
63
63
|
web-accessible again.
|
64
64
|
DESC
|
65
65
|
task :enable, :roles => :web, :except => { :no_release => true } do
|
66
|
-
try_sudo
|
66
|
+
run "#{try_sudo} rm #{latest_release}/#{web_path}/#{maintenance_basename}.html"
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capifony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 2.1.
|
9
|
+
- 15
|
10
|
+
version: 2.1.15
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Konstantin Kudryashov
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2012-
|
19
|
+
date: 2012-09-10 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: capistrano
|