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/{CHANGELOG → CHANGELOG.md}
RENAMED
@@ -1,4 +1,50 @@
|
|
1
|
-
|
1
|
+
### 2.2.0 / October 22, 2012
|
2
|
+
|
3
|
+
* Minor fixes
|
4
|
+
* Clean output in tests
|
5
|
+
* Fix travis build
|
6
|
+
* Dump autoloader generation
|
7
|
+
* Refactor specs
|
8
|
+
* Update CHANGELOG
|
9
|
+
* Fix #244
|
10
|
+
* Correct pretty_print on composer:get based on @simonchrz's patch
|
11
|
+
* Enable web tasks
|
12
|
+
* Update gemspec file
|
13
|
+
* Make version consistent with capistrano
|
14
|
+
* Add UPGRADE file
|
15
|
+
* Fix command again
|
16
|
+
* Fix missing method
|
17
|
+
* Fix command
|
18
|
+
* Rename files
|
19
|
+
* Improve command
|
20
|
+
* Remove old README.ja.md as it's not maintained anymore
|
21
|
+
* Add note about tests in README
|
22
|
+
* Update CHANGELOG
|
23
|
+
* Minor fixes
|
24
|
+
* Add tests for propel namespace
|
25
|
+
* Add tests for doctrine namespace
|
26
|
+
* Fix travis-ci setup
|
27
|
+
* Add more tests for the symfony namespace (Symfony2)
|
28
|
+
* Fix encoding
|
29
|
+
* Trying to fix dependencies
|
30
|
+
* Add testing tools to gemfile
|
31
|
+
* fix gemfile
|
32
|
+
* Add travis/bundler configs, bump version to 2.2.x-dev
|
33
|
+
* Introducing a test suite
|
34
|
+
* Refactored Symfony2 code
|
35
|
+
* Fix conflict with the pp gem
|
36
|
+
* cd command not found when composer self-update
|
37
|
+
* Fix #240
|
38
|
+
* Fixing spelling mistakes an code
|
39
|
+
* Fix composer tasks
|
40
|
+
* Fixing logic in deep_merge method for symfony1
|
41
|
+
* Fix symfony:doctrine:migrations:migrate when using pty by not using try_sudo. Also log current database version with level info.
|
42
|
+
* Fixed a problem with case-insensitivity. This worked on OS X, but not on Linux, because the file system is case sensitive.
|
43
|
+
* Take capistrano/ext/multistage parameter deploy_env into account when using different deploy environments.
|
44
|
+
* Avoid the unnecessary use of try_sudo to make remote dumps work, as Capifony doesn't seem to check if use_sudo is false.
|
45
|
+
* Added patch-5 branch modifications from https://github.com/leek/capifony/tree/patch-5 to enable using parameters.ini config files.
|
46
|
+
|
47
|
+
### 2.1.16 / September 25, 2012
|
2
48
|
|
3
49
|
* Add composer:dump_autoload to the finalize_update after hook
|
4
50
|
* Add new task to allow composer dump-autoload
|
@@ -7,7 +53,7 @@
|
|
7
53
|
* run "#{try_sudo}"
|
8
54
|
* Use try_sudo instead of run
|
9
55
|
|
10
|
-
|
56
|
+
### 2.1.15 / September 10, 2012
|
11
57
|
|
12
58
|
* Fix #203
|
13
59
|
* 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.
|
@@ -21,11 +67,11 @@
|
|
21
67
|
* set_permissions: fix for acl method
|
22
68
|
* Fix this fucking dumb task. #195
|
23
69
|
|
24
|
-
|
70
|
+
### 2.1.14 / August 22, 2012
|
25
71
|
|
26
72
|
* Fix escaping in clear controllers #195
|
27
73
|
|
28
|
-
|
74
|
+
### 2.1.13 / August 21, 2012
|
29
75
|
|
30
76
|
* check all .php files in stead of only _app.php
|
31
77
|
* fix clear controllers to also work with try_sudo
|
@@ -39,14 +85,14 @@
|
|
39
85
|
* Fix running doctrine migrations with allocated PTY
|
40
86
|
* Update lib/symfony1.rb
|
41
87
|
|
42
|
-
|
88
|
+
### 2.1.12 / August 6, 2012
|
43
89
|
|
44
90
|
* Enable options for assets:install
|
45
91
|
* Looked for sf1 settings DB file instead of sf2 one
|
46
92
|
* Add ability to tail `dev|prod.log`
|
47
93
|
* Put remote tmp directory in a variable so that it can be overriden
|
48
94
|
|
49
|
-
|
95
|
+
### 2.1.11 / July 20, 2012
|
50
96
|
|
51
97
|
* Fix hard-coded "app" references
|
52
98
|
* Fix hard-coded path to "app"
|
@@ -58,7 +104,7 @@
|
|
58
104
|
* Fix #163
|
59
105
|
* fix elsif synthax
|
60
106
|
|
61
|
-
|
107
|
+
### 2.1.10 / July 16, 2012
|
62
108
|
|
63
109
|
* Fix CS
|
64
110
|
* Add ownership check before changing permissions
|
@@ -78,11 +124,11 @@
|
|
78
124
|
* Since `:roles` isn't used in Capifony, these need `:no_release` *at least*.
|
79
125
|
* Fixing missing `pretty_print`.
|
80
126
|
|
81
|
-
|
127
|
+
### 2.1.9 / July 3, 2012
|
82
128
|
|
83
129
|
* fixed regression
|
84
130
|
|
85
|
-
|
131
|
+
### 2.1.8 / July 2, 2012
|
86
132
|
|
87
133
|
* bugfixes
|
88
134
|
* fix database tasks to use role :db
|
@@ -96,7 +142,7 @@
|
|
96
142
|
* added human readable messages in deploy related tasks.
|
97
143
|
* removed unexistent Doctrine commands
|
98
144
|
|
99
|
-
|
145
|
+
### 2.1.7 / June 21, 2012
|
100
146
|
|
101
147
|
* added maintenance page feature for Symfony2, use symfony 1.4 tasks
|
102
148
|
(project:disable, project:enable) to do the same.
|
@@ -112,78 +158,78 @@
|
|
112
158
|
working directory.
|
113
159
|
* bugfixes.
|
114
160
|
|
115
|
-
|
161
|
+
### 2.1.6 / April 12, 2012
|
116
162
|
|
117
163
|
* bugfixes
|
118
164
|
|
119
|
-
|
165
|
+
### 2.1.3 / September 27, 2011
|
120
166
|
|
121
167
|
* propel support for Symfony2 (by @willdurand)
|
122
168
|
* cache warmup and assets install configurable (by @gigo6000)
|
123
169
|
* always use --no-debug with assetic (by @fernanDOTdo)
|
124
170
|
* fixed assetic bug (by @mbontemps)
|
125
171
|
|
126
|
-
|
172
|
+
### 2.1.2 / August 11, 2011
|
127
173
|
|
128
174
|
* fix for vendors install
|
129
175
|
|
130
|
-
|
176
|
+
### 2.1.1 / July 13, 2011
|
131
177
|
|
132
178
|
* support for rubygems 1.8
|
133
179
|
|
134
|
-
|
180
|
+
### 2.1.0 / June 24, 2011
|
135
181
|
|
136
182
|
* fully support different app path
|
137
183
|
|
138
|
-
|
184
|
+
### 2.0.9 / June 15, 2011
|
139
185
|
|
140
186
|
* migrations fixed in Symfony2
|
141
187
|
|
142
|
-
|
188
|
+
### 2.0.8 / June 14, 2011
|
143
189
|
|
144
190
|
* update_vendors functionality support (via @weaverryan)
|
145
191
|
|
146
|
-
|
192
|
+
### 2.0.7 / June 9, 2011
|
147
193
|
|
148
194
|
* more modular behavior (thanks Alif Rachmawadi)
|
149
195
|
* cache:clear command fix (thanks Marijn Huizendveld)
|
150
196
|
|
151
|
-
|
197
|
+
### 2.0.6 / May 4, 2011
|
152
198
|
|
153
199
|
* add write access to cache folder for deployer's usergroup
|
154
200
|
|
155
|
-
|
201
|
+
### 2.0.5 / May 3, 2011
|
156
202
|
|
157
203
|
* made the Symfony2 console command configurable (symfony_console) (thanks @ruudk)
|
158
204
|
* added --env=#{symfony_env_prod} to every Symfony2 console command (thanks @ruudk)
|
159
205
|
|
160
|
-
|
206
|
+
### 2.0.4 / April 23, 2011
|
161
207
|
|
162
208
|
* shared lib support in symfony1 (thanks @jakzal)
|
163
209
|
|
164
|
-
|
210
|
+
### 2.0.3 / April 16, 2011
|
165
211
|
|
166
212
|
* windows support for symfony1 database: tasks (thanks @akloboucnik)
|
167
213
|
|
168
|
-
|
214
|
+
### 2.0.2 / April 6, 2011
|
169
215
|
|
170
216
|
* db migration task refactoring (thanks @schmittjoh)
|
171
217
|
|
172
|
-
|
218
|
+
### 2.0.1 / March 30, 2011
|
173
219
|
|
174
220
|
* fixed wrong assetic command
|
175
221
|
|
176
|
-
|
222
|
+
### 2.0.0 / March 22, 2011
|
177
223
|
|
178
224
|
* optimized shared commands in symfony1 scripts
|
179
225
|
* added symfony2 deployment strategy
|
180
226
|
* added `use_orm` option to symfony1 recipes. Turn it off if you don't use ORM
|
181
227
|
|
182
|
-
|
228
|
+
### 0.4.2 / September 23, 2010
|
183
229
|
|
184
230
|
* added `symfony:doctrine:compile` task
|
185
231
|
|
186
|
-
|
232
|
+
### 0.4.1 / June 17, 2010
|
187
233
|
|
188
234
|
* added `symfony_env_local` variable, specifying local symfony environment to work with
|
189
235
|
* added third parameter (blocks) to `prompt_with_default` (as in `ask`)
|
@@ -191,46 +237,46 @@
|
|
191
237
|
* added confirmation dialogs to destructive ORM tasks
|
192
238
|
* run `project:clear-controllers` only on `prod` environment
|
193
239
|
|
194
|
-
|
240
|
+
### 0.4.0 / June 16, 2010
|
195
241
|
|
196
242
|
* added propel tasks (thanks to http://github.com/arlo)
|
197
243
|
* added orm abstraction
|
198
244
|
* added doctrine/symfony tasks
|
199
245
|
* huge refactoring of mostly everything (thanks to http://github.com/arlo)
|
200
246
|
|
201
|
-
|
247
|
+
### 0.3.3 / June 13, 2010
|
202
248
|
|
203
249
|
* added ability to change called php binary (thanks to http://github.com/xgorse)
|
204
250
|
|
205
|
-
|
251
|
+
### 0.3.2 / June 12, 2010
|
206
252
|
|
207
253
|
* fixed :finalize_update hooks (clear_controllers task now runs)
|
208
254
|
|
209
|
-
|
255
|
+
### 0.3.1 / June 11, 2010
|
210
256
|
|
211
257
|
* fixed deployment bug with new shared link instruction
|
212
258
|
|
213
|
-
|
259
|
+
### 0.3.0 / June 11, 2010
|
214
260
|
|
215
261
|
* fixed incorrect links bug (thanks to arlo)
|
216
262
|
* added database dumpers tasks
|
217
263
|
* database:move:* now uses database dumpers to actually dump
|
218
264
|
|
219
|
-
|
265
|
+
### 0.2.2 / June 6, 2010
|
220
266
|
|
221
267
|
* deployment bug with `mkdir shared/config` fixed
|
222
268
|
|
223
|
-
|
269
|
+
### 0.2.1 / June 5, 2010
|
224
270
|
|
225
271
|
* dependency fix
|
226
272
|
|
227
|
-
|
273
|
+
### 0.2.0 / June 5, 2010
|
228
274
|
|
229
275
|
* some fixes
|
230
276
|
* symfony:check_configuration task
|
231
277
|
* database move tasks
|
232
278
|
* shared folder tasks (move to_local, move to_remote)
|
233
279
|
|
234
|
-
|
280
|
+
### 0.1.0 / June 3, 2010
|
235
281
|
|
236
282
|
First ever working version.
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
Deploying symfony Applications with Capistrano
|
2
2
|
==============================================
|
3
3
|
|
4
|
+
[![Build Status](https://secure.travis-ci.org/everzet/capifony.png?branch=master)](http://travis-ci.org/everzet/capifony)
|
5
|
+
|
4
6
|
Capistrano is an open source tool for running scripts on multiple servers.
|
5
7
|
Its primary use is for easily deploying applications. While it was built
|
6
8
|
specifically for deploying Rails apps, it’s pretty simple to customize it
|
@@ -35,6 +37,19 @@ lot easier.
|
|
35
37
|
|
36
38
|
Read the [capifony documentation](http://capifony.org/)
|
37
39
|
|
40
|
+
## Running the test suite ##
|
41
|
+
|
42
|
+
You need a set of dependencies in order to run the capifony's test suite.
|
43
|
+
You can use **Bundler** to install these dependencies:
|
44
|
+
|
45
|
+
bundle install --gemfile=.gemfile
|
46
|
+
|
47
|
+
Then, run the tests using **Rake**:
|
48
|
+
|
49
|
+
rake spec
|
50
|
+
|
51
|
+
For more information, see the `.travis.yml` file.
|
52
|
+
|
38
53
|
|
39
54
|
## Contributors ##
|
40
55
|
|
data/UPGRADE.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
UPGRADE FROM 2.1.x TO 2.2.x
|
2
|
+
===========================
|
3
|
+
|
4
|
+
Upgrading your capifony configuration from **2.1.x** to **2.2.x** is quite easy.
|
5
|
+
If you don't have a custom `Capfile` file, delete it and recreate it using the
|
6
|
+
following command:
|
7
|
+
|
8
|
+
capifony .
|
9
|
+
|
10
|
+
Important: This is mandatory for both symfony 1.x and Symfony2 projects.
|
11
|
+
|
12
|
+
If you have a custom `Capfile` file, you just have to change the way you load
|
13
|
+
capifony. In capifony 2.1.x and for Symfony2 projects, the line below was used
|
14
|
+
to load capifony:
|
15
|
+
|
16
|
+
load Gem.find_files('symfony2.rb').first.to_s
|
17
|
+
|
18
|
+
You have to replace this line by the following one:
|
19
|
+
|
20
|
+
require 'capifony_symfony2'
|
21
|
+
|
22
|
+
For symfony 1.x projects, the line below was used for the same purpose:
|
23
|
+
|
24
|
+
load Gem.find_files('symfony1.rb').first.to_s
|
25
|
+
|
26
|
+
You have to replace it by the following line:
|
27
|
+
|
28
|
+
load Gem.find_files('capifony_symfony1.rb').first.to_s
|
29
|
+
|
30
|
+
That's all.
|
data/bin/capifony
CHANGED
@@ -5,6 +5,7 @@ require 'fileutils'
|
|
5
5
|
|
6
6
|
symfony_version = nil
|
7
7
|
symfony_app_path = 'app'
|
8
|
+
capifony_version = '2.2.0'
|
8
9
|
|
9
10
|
OptionParser.new do |opts|
|
10
11
|
opts.banner = "Usage: #{File.basename($0)} [path]"
|
@@ -14,6 +15,11 @@ OptionParser.new do |opts|
|
|
14
15
|
exit 0
|
15
16
|
end
|
16
17
|
|
18
|
+
opts.on("-v", "--version", "") do
|
19
|
+
puts "capifony v#{capifony_version}"
|
20
|
+
exit 0
|
21
|
+
end
|
22
|
+
|
17
23
|
opts.on("-s", "--symfony VERSION", "Capify specific symfony verion (1|2)") do |version|
|
18
24
|
symfony_version = version.to_i
|
19
25
|
end
|
@@ -38,7 +44,7 @@ elsif !File.exists?(ARGV.first)
|
|
38
44
|
elsif !File.directory?(ARGV.first)
|
39
45
|
abort "`#{ARGV.first}' is not a directory."
|
40
46
|
elsif ARGV.length > 1
|
41
|
-
abort "Too many arguments; please specify only the directory to
|
47
|
+
abort "Too many arguments; please specify only the directory to capifony."
|
42
48
|
end
|
43
49
|
|
44
50
|
def unindent(string)
|
@@ -53,8 +59,8 @@ if symfony_version == 2
|
|
53
59
|
files = {
|
54
60
|
"Capfile" => unindent(<<-FILE),
|
55
61
|
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
56
|
-
|
57
|
-
|
62
|
+
|
63
|
+
require 'capifony_symfony2'
|
58
64
|
load '#{symfony_app_path}/config/deploy'
|
59
65
|
FILE
|
60
66
|
|
@@ -86,7 +92,8 @@ else
|
|
86
92
|
"Capfile" => unindent(<<-FILE),
|
87
93
|
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
88
94
|
Dir['plugins/*/lib/recipes/*.rb'].each { |plugin| load(plugin) }
|
89
|
-
|
95
|
+
|
96
|
+
load Gem.find_files('capifony_symfony1.rb').first.to_s
|
90
97
|
load 'config/deploy'
|
91
98
|
FILE
|
92
99
|
|
@@ -54,8 +54,19 @@ end
|
|
54
54
|
|
55
55
|
def deep_merge(hash1, hash2)
|
56
56
|
|
57
|
+
#if both 'all' and env keys are nil break
|
58
|
+
if(hash1 == nil && hash2 == nil)
|
59
|
+
return nil
|
60
|
+
end
|
61
|
+
|
62
|
+
#the config.yml may not have 'all' key but instead 'dev' 'prod' and so on
|
63
|
+
if(hash1 == nil && hash2 != nil)
|
64
|
+
return hash2 # no need to merge
|
65
|
+
end
|
66
|
+
|
67
|
+
#if only the 'all' key is specified
|
57
68
|
#There might not be a second has to cascade to
|
58
|
-
if(hash2 == nil)
|
69
|
+
if(hash2 == nil && hash1 != nil)
|
59
70
|
return hash1;
|
60
71
|
end
|
61
72
|
hash1.merge(hash2){|key, subhash1, subhash2|
|
@@ -0,0 +1,255 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'capistrano'
|
3
|
+
require 'colored'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'inifile'
|
6
|
+
require 'yaml'
|
7
|
+
require 'zlib'
|
8
|
+
|
9
|
+
module Capifony
|
10
|
+
module Symfony2
|
11
|
+
def self.load_into(configuration)
|
12
|
+
configuration.load do
|
13
|
+
|
14
|
+
load_paths.push File.expand_path('../', __FILE__)
|
15
|
+
load 'capifony'
|
16
|
+
load 'symfony2/symfony'
|
17
|
+
load 'symfony2/database'
|
18
|
+
load 'symfony2/deploy'
|
19
|
+
load 'symfony2/doctrine'
|
20
|
+
load 'symfony2/propel'
|
21
|
+
load 'symfony2/web'
|
22
|
+
|
23
|
+
# Symfony application path
|
24
|
+
set :app_path, "app"
|
25
|
+
|
26
|
+
# Symfony web path
|
27
|
+
set :web_path, "web"
|
28
|
+
|
29
|
+
# Symfony console bin
|
30
|
+
set :symfony_console, app_path + "/console"
|
31
|
+
|
32
|
+
# Symfony log path
|
33
|
+
set :log_path, app_path + "/logs"
|
34
|
+
|
35
|
+
# Symfony cache path
|
36
|
+
set :cache_path, app_path + "/cache"
|
37
|
+
|
38
|
+
# Symfony config file path
|
39
|
+
set :app_config_path, app_path + "/config"
|
40
|
+
|
41
|
+
# Symfony config file (parameters.(ini|yml|etc...)
|
42
|
+
set :app_config_file, "parameters.yml"
|
43
|
+
|
44
|
+
# Symfony bin vendors
|
45
|
+
set :symfony_vendors, "bin/vendors"
|
46
|
+
|
47
|
+
# Symfony build_bootstrap script
|
48
|
+
set :build_bootstrap, "bin/build_bootstrap"
|
49
|
+
|
50
|
+
# Whether to use composer to install vendors.
|
51
|
+
# If set to false, it will use the bin/vendors script
|
52
|
+
set :use_composer, false
|
53
|
+
|
54
|
+
# Path to composer binary
|
55
|
+
# If set to false, Capifony will download/install composer
|
56
|
+
set :composer_bin, false
|
57
|
+
|
58
|
+
# Options to pass to composer when installing/updating
|
59
|
+
set :composer_options, "--no-scripts --verbose --prefer-dist"
|
60
|
+
|
61
|
+
# Whether to update vendors using the configured dependency manager (composer or bin/vendors)
|
62
|
+
set :update_vendors, false
|
63
|
+
|
64
|
+
# run bin/vendors script in mode (upgrade, install (faster if shared /vendor folder) or reinstall)
|
65
|
+
set :vendors_mode, "reinstall"
|
66
|
+
|
67
|
+
# Whether to run cache warmup
|
68
|
+
set :cache_warmup, true
|
69
|
+
|
70
|
+
# Use AsseticBundle
|
71
|
+
set :dump_assetic_assets, false
|
72
|
+
|
73
|
+
# Assets install
|
74
|
+
set :assets_install, true
|
75
|
+
set :assets_symlinks, false
|
76
|
+
set :assets_relative, false
|
77
|
+
|
78
|
+
# Whether to update `assets_version` in `config.yml`
|
79
|
+
set :update_assets_version, false
|
80
|
+
|
81
|
+
# Need to clear *_dev controllers
|
82
|
+
set :clear_controllers, true
|
83
|
+
|
84
|
+
# Files that need to remain the same between deploys
|
85
|
+
set :shared_files, false
|
86
|
+
|
87
|
+
# Dirs that need to remain the same between deploys (shared dirs)
|
88
|
+
set :shared_children, [log_path, web_path + "/uploads"]
|
89
|
+
|
90
|
+
# Asset folders (that need to be timestamped)
|
91
|
+
set :asset_children, [web_path + "/css", web_path + "/images", web_path + "/js"]
|
92
|
+
|
93
|
+
# Dirs that need to be writable by the HTTP Server (i.e. cache, log dirs)
|
94
|
+
set :writable_dirs, [log_path, cache_path]
|
95
|
+
|
96
|
+
# Name used by the Web Server (i.e. www-data for Apache)
|
97
|
+
set :webserver_user, "www-data"
|
98
|
+
|
99
|
+
# Method used to set permissions (:chmod, :acl, or :chown)
|
100
|
+
set :permission_method, false
|
101
|
+
|
102
|
+
# Model manager: (doctrine, propel)
|
103
|
+
set :model_manager, "doctrine"
|
104
|
+
|
105
|
+
# Symfony2 version
|
106
|
+
set(:symfony_version) { guess_symfony_version }
|
107
|
+
|
108
|
+
# If set to false, it will never ask for confirmations (migrations task for instance)
|
109
|
+
# Use it carefully, really!
|
110
|
+
set :interactive_mode, true
|
111
|
+
|
112
|
+
def load_database_config(data, env)
|
113
|
+
read_parameters(data)['parameters']
|
114
|
+
end
|
115
|
+
|
116
|
+
def read_parameters(data)
|
117
|
+
if '.ini' === File.extname(app_config_file) then
|
118
|
+
File.readable?(data) ? IniFile::load(data) : IniFile.new(data)
|
119
|
+
else
|
120
|
+
YAML::load(data)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def guess_symfony_version
|
125
|
+
capture("cd #{latest_release} && #{php_bin} #{symfony_console} --version |cut -d \" \" -f 3")
|
126
|
+
end
|
127
|
+
|
128
|
+
def remote_file_exists?(full_path)
|
129
|
+
'true' == capture("if [ -e #{full_path} ]; then echo 'true'; fi").strip
|
130
|
+
end
|
131
|
+
|
132
|
+
def remote_command_exists?(command)
|
133
|
+
'true' == capture("if [ -x \"$(which #{command})\" ]; then echo 'true'; fi").strip
|
134
|
+
end
|
135
|
+
|
136
|
+
STDOUT.sync
|
137
|
+
$error = false
|
138
|
+
$pretty_errors_defined = false
|
139
|
+
|
140
|
+
# Be less verbose by default
|
141
|
+
logger.level = Capistrano::Logger::IMPORTANT
|
142
|
+
|
143
|
+
def capifony_pretty_print(msg)
|
144
|
+
if logger.level == Capistrano::Logger::IMPORTANT
|
145
|
+
pretty_errors
|
146
|
+
|
147
|
+
msg = msg.slice(0, 57)
|
148
|
+
msg << '.' * (60 - msg.size)
|
149
|
+
print msg
|
150
|
+
else
|
151
|
+
puts msg.green
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def capifony_puts_ok
|
156
|
+
if logger.level == Capistrano::Logger::IMPORTANT && !$error
|
157
|
+
puts '✔'.green
|
158
|
+
end
|
159
|
+
|
160
|
+
$error = false
|
161
|
+
end
|
162
|
+
|
163
|
+
def pretty_errors
|
164
|
+
if !$pretty_errors_defined
|
165
|
+
$pretty_errors_defined = true
|
166
|
+
|
167
|
+
class << $stderr
|
168
|
+
@@firstLine = true
|
169
|
+
alias _write write
|
170
|
+
|
171
|
+
def write(s)
|
172
|
+
if @@firstLine
|
173
|
+
s = '✘' << "\n" << s
|
174
|
+
@@firstLine = false
|
175
|
+
end
|
176
|
+
|
177
|
+
_write(s.red)
|
178
|
+
$error = true
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
after "deploy:finalize_update" do
|
185
|
+
if use_composer
|
186
|
+
if update_vendors
|
187
|
+
symfony.composer.update
|
188
|
+
else
|
189
|
+
symfony.composer.install
|
190
|
+
end
|
191
|
+
else
|
192
|
+
if update_vendors
|
193
|
+
vendors_mode.chomp # To remove trailing whiteline
|
194
|
+
case vendors_mode
|
195
|
+
when "upgrade" then symfony.vendors.upgrade
|
196
|
+
when "install" then symfony.vendors.install
|
197
|
+
when "reinstall" then symfony.vendors.reinstall
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
symfony.bootstrap.build
|
203
|
+
|
204
|
+
if model_manager == "propel"
|
205
|
+
symfony.propel.build.model
|
206
|
+
end
|
207
|
+
|
208
|
+
if use_composer
|
209
|
+
symfony.composer.dump_autoload
|
210
|
+
end
|
211
|
+
|
212
|
+
if assets_install
|
213
|
+
symfony.assets.install # Publish bundle assets
|
214
|
+
end
|
215
|
+
|
216
|
+
if update_assets_version
|
217
|
+
symfony.assets.update_version # Update `assets_version`
|
218
|
+
end
|
219
|
+
|
220
|
+
if cache_warmup
|
221
|
+
symfony.cache.warmup # Warmup clean cache
|
222
|
+
end
|
223
|
+
|
224
|
+
if dump_assetic_assets
|
225
|
+
symfony.assetic.dump # Dump assetic assets
|
226
|
+
end
|
227
|
+
|
228
|
+
if clear_controllers
|
229
|
+
symfony.project.clear_controllers
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
before "deploy:update_code" do
|
234
|
+
msg = "--> Updating code base with #{deploy_via} strategy"
|
235
|
+
|
236
|
+
if logger.level == Capistrano::Logger::IMPORTANT
|
237
|
+
pretty_errors
|
238
|
+
puts msg
|
239
|
+
else
|
240
|
+
puts msg.green
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
after "deploy:create_symlink" do
|
245
|
+
puts "--> Successfully deployed!".green
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
if Capistrano::Configuration.instance
|
254
|
+
Capifony::Symfony2.load_into(Capistrano::Configuration.instance)
|
255
|
+
end
|