kcapifony 2.1.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of kcapifony might be problematic. Click here for more details.

data/lib/ksymfony2.rb ADDED
@@ -0,0 +1,377 @@
1
+ load Gem.find_files('kcapifony.rb').last.to_s
2
+
3
+ # Symfony application path
4
+ set :app_path, "app"
5
+
6
+ # Symfony web path
7
+ set :web_path, "web"
8
+
9
+ # Symfony console bin
10
+ set :symfony_console, app_path + "/console"
11
+
12
+ # Symfony log path
13
+ set :log_path, app_path + "/logs"
14
+
15
+ # Symfony cache path
16
+ set :cache_path, app_path + "/cache"
17
+
18
+ # Use AsseticBundle
19
+ set :dump_assetic_assets, false
20
+
21
+ # Whether to run the bin/vendors script to update vendors
22
+ set :update_vendors, false
23
+
24
+ # run bin/vendors script in mode (upgrade, install (faster if shared /vendor folder) or reinstall)
25
+ set :vendors_mode, "reinstall"
26
+
27
+ # Whether to run cache warmup
28
+ set :cache_warmup, true
29
+
30
+ # Assets install
31
+ set :assets_install, true
32
+
33
+ # Dirs that need to remain the same between deploys (shared dirs)
34
+ set :shared_children, [log_path, web_path + "/uploads"]
35
+
36
+ # Files that need to remain the same between deploys
37
+ set :shared_files, false
38
+
39
+ # Asset folders (that need to be timestamped)
40
+ set :asset_children, [web_path + "/css", web_path + "/images", web_path + "/js"]
41
+
42
+ set :model_manager, "doctrine"
43
+ # Or: `propel`
44
+
45
+ set :update_schema, false
46
+ set :force_schema, false
47
+ set :do_migrations, false
48
+ set :load_fixtures, false
49
+ set :setfacl, false
50
+
51
+ namespace :deploy do
52
+ desc "Symlink static directories and static files that need to remain between deployments."
53
+ task :share_childs do
54
+ if shared_children
55
+ shared_children.each do |link|
56
+ try_sudo "mkdir -p #{shared_path}/#{link}"
57
+ try_sudo "sh -c 'if [ -d #{release_path}/#{link} ] ; then rm -rf #{release_path}/#{link}; fi'"
58
+ try_sudo "ln -nfs #{shared_path}/#{link} #{release_path}/#{link}"
59
+ end
60
+ end
61
+ if shared_files
62
+ shared_files.each do |link|
63
+ link_dir = File.dirname("#{shared_path}/#{link}")
64
+ try_sudo "mkdir -p #{link_dir}"
65
+ try_sudo "touch #{shared_path}/#{link}"
66
+ try_sudo "ln -nfs #{shared_path}/#{link} #{release_path}/#{link}"
67
+ end
68
+ end
69
+ end
70
+
71
+ desc "Update latest release source path."
72
+ task :finalize_update, :except => { :no_release => true } do
73
+ try_sudo "chmod -R g+w #{latest_release}" if fetch(:group_writable, true)
74
+ try_sudo "sh -c 'if [ -d #{latest_release}/#{cache_path} ] ; then rm -rf #{latest_release}/#{cache_path}; fi'"
75
+ try_sudo "mkdir -p #{latest_release}/#{cache_path}"
76
+ try_sudo "chmod -R 0777 #{latest_release}/#{cache_path}"
77
+ try_sudo "chmod -R g+w #{latest_release}/#{cache_path}"
78
+
79
+ if fetch(:setfacl, false)
80
+ try_sudo "setfacl -R -m d:group::rx,d:other::000,d:group:admin:rwx,group:admin:rwx #{latest_release}/#{cache_path}"
81
+ apache_runner = fetch(:apache_runner, "www-data")
82
+ try_sudo "sh -c 'if [ -d #{latest_release}/#{web_path} ] ; then setfacl -R -m d:group::r,d:other::000,d:user:#{apache_runner}:rx,d:group:admin:rwx,d:user:#{apache_runner}:rx,group:admin:rwx #{latest_release}/#{web_path}; fi'"
83
+ end
84
+
85
+ share_childs
86
+
87
+ if fetch(:normalize_asset_timestamps, true)
88
+ stamp = Time.now.utc.strftime("%Y%m%d%H%M.%S")
89
+ asset_paths = asset_children.map { |p| "#{latest_release}/#{p}" }.join(" ")
90
+ try_sudo "find #{asset_paths} -exec touch -t #{stamp} {} ';'; true", :env => { "TZ" => "UTC" }
91
+ end
92
+ end
93
+
94
+ desc "Deploy the application and start it."
95
+ task :cold do
96
+ update
97
+ start
98
+ end
99
+
100
+ desc "Deploy the application and run the test suite."
101
+ task :testall do
102
+ update_code
103
+ symlink
104
+ try_sudo "sh -c 'cd #{latest_release} && phpunit -c #{app_path} src'"
105
+ end
106
+
107
+ desc "Migrate Symfony2 Doctrine ORM database."
108
+ task :migrate do
109
+ currentVersion = nil
110
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:status --env=#{symfony_env_prod}'" do |ch, stream, out|
111
+ if stream == :out and out =~ /Current Version:[^$]+\(([0-9]+)\)/
112
+ currentVersion = Regexp.last_match(1)
113
+ end
114
+ if stream == :out and out =~ /Current Version:\s*0\s*$/
115
+ currentVersion = 0
116
+ end
117
+ end
118
+
119
+ if currentVersion == nil
120
+ raise "Could not find current database migration version"
121
+ end
122
+ puts "Current database version: #{currentVersion}"
123
+
124
+ on_rollback {
125
+ if Capistrano::CLI.ui.agree("Do you really want to migrate #{symfony_env_prod}'s database back to version #{currentVersion}? (y/N)")
126
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:migrate #{currentVersion} --env=#{symfony_env_prod} --no-interaction'"
127
+ end
128
+ }
129
+
130
+ if Capistrano::CLI.ui.agree("Do you really want to migrate #{symfony_env_prod}'s database? (y/N)")
131
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:migrate --env=#{symfony_env_prod} --no-interaction'"
132
+ end
133
+ end
134
+ end
135
+
136
+ namespace :symfony do
137
+ desc "Runs custom symfony task"
138
+ task :default do
139
+ prompt_with_default(:task_arguments, "cache:clear")
140
+
141
+ stream "cd #{latest_release} && #{php_bin} #{symfony_console} #{task_arguments} --env=#{symfony_env_prod}"
142
+ end
143
+
144
+ namespace :assets do
145
+ desc "Install bundle's assets"
146
+ task :install do
147
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} assets:install #{web_path} --env=#{symfony_env_prod}'"
148
+ end
149
+ end
150
+
151
+ namespace :assetic do
152
+ desc "Dumps all assets to the filesystem"
153
+ task :dump do
154
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} assetic:dump #{web_path} --env=#{symfony_env_prod} --no-debug'"
155
+ end
156
+ end
157
+
158
+ namespace :vendors do
159
+ desc "Runs the bin/vendors script to install the vendors (fast if already installed)"
160
+ task :install do
161
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} bin/vendors install'"
162
+ end
163
+
164
+ desc "Runs the bin/vendors script to reinstall the vendors"
165
+ task :reinstall do
166
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} bin/vendors install --reinstall'"
167
+ end
168
+
169
+ desc "Runs the bin/vendors script to upgrade the vendors"
170
+ task :upgrade do
171
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} bin/vendors update'"
172
+ end
173
+ end
174
+
175
+ namespace :cache do
176
+ desc "Clears project cache."
177
+ task :clear do
178
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} cache:clear --env=#{symfony_env_prod}'"
179
+ try_sudo "chmod -R g+w #{latest_release}/#{cache_path}"
180
+ end
181
+
182
+ desc "Warms up an empty cache."
183
+ task :warmup do
184
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} cache:warmup --env=#{symfony_env_prod}'"
185
+ try_sudo "chmod -R g+w #{latest_release}/#{cache_path}"
186
+ end
187
+ end
188
+
189
+ namespace :doctrine do
190
+ namespace :cache do
191
+ desc "Clear all metadata cache for a entity manager."
192
+ task :clear_metadata do
193
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-metadata --env=#{symfony_env_prod}'"
194
+ end
195
+
196
+ desc "Clear all query cache for a entity manager."
197
+ task :clear_query do
198
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-query --env=#{symfony_env_prod}'"
199
+ end
200
+
201
+ desc "Clear result cache for a entity manager."
202
+ task :clear_result do
203
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-result --env=#{symfony_env_prod}'"
204
+ end
205
+ end
206
+
207
+ namespace :fixtures do
208
+
209
+ desc "Load data fixtures to your database."
210
+ task :load_data do
211
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:fixtures:load --env=#{symfony_env_prod}'"
212
+ end
213
+ end
214
+
215
+ namespace :database do
216
+ desc "Create the configured databases."
217
+ task :create do
218
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:database:create --env=#{symfony_env_prod}'"
219
+ end
220
+
221
+ desc "Drop the configured databases."
222
+ task :drop do
223
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:database:drop --env=#{symfony_env_prod}'"
224
+ end
225
+ end
226
+
227
+ namespace :generate do
228
+ desc "Generates proxy classes for entity classes."
229
+ task :hydrators do
230
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:generate:proxies --env=#{symfony_env_prod}'"
231
+ end
232
+
233
+ desc "Generate repository classes from your mapping information."
234
+ task :hydrators do
235
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:generate:repositories --env=#{symfony_env_prod}'"
236
+ end
237
+ end
238
+
239
+ namespace :schema do
240
+ desc "Processes the schema and either create it directly on EntityManager Storage Connection or generate the SQL output."
241
+ task :create do
242
+ force = force_schema ? " --force": ""
243
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:create --env=#{symfony_env_prod} #{force}'"
244
+ end
245
+
246
+ desc "Drop the complete database schema of EntityManager Storage Connection or generate the corresponding SQL output."
247
+ task :drop do
248
+ force = force_schema ? " --force": ""
249
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:drop --env=#{symfony_env_prod} #{force}'"
250
+ end
251
+
252
+ desc "Drop the complete database schema of EntityManager Storage Connection or generate the corresponding SQL output."
253
+ task :update do
254
+ force = force_schema ? " --force": ""
255
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:update --env=#{symfony_env_prod} #{force}'"
256
+ end
257
+ end
258
+
259
+ namespace :migrations do
260
+ desc "Execute a migration to a specified version or the latest available version."
261
+ task :migrate do
262
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:migrate --env=#{symfony_env_prod} --no-interaction'"
263
+ end
264
+
265
+ desc "View the status of a set of migrations."
266
+ task :status do
267
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:status --env=#{symfony_env_prod}'"
268
+ end
269
+ end
270
+
271
+ namespace :mongodb do
272
+ namespace :generate do
273
+ desc "Generates hydrator classes for document classes."
274
+ task :hydrators do
275
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:generate:hydrators --env=#{symfony_env_prod}'"
276
+ end
277
+
278
+ desc "Generates proxy classes for document classes."
279
+ task :hydrators do
280
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:generate:proxies --env=#{symfony_env_prod}'"
281
+ end
282
+
283
+ desc "Generates repository classes for document classes."
284
+ task :hydrators do
285
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:generate:repositories --env=#{symfony_env_prod}'"
286
+ end
287
+ end
288
+
289
+ namespace :schema do
290
+ desc "Allows you to create databases, collections and indexes for your documents."
291
+ task :create do
292
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:schema:create --env=#{symfony_env_prod}'"
293
+ end
294
+
295
+ desc "Allows you to drop databases, collections and indexes for your documents."
296
+ task :drop do
297
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:schema:drop --env=#{symfony_env_prod}'"
298
+ end
299
+ end
300
+ end
301
+ end
302
+
303
+ namespace :propel do
304
+ namespace :database do
305
+ desc "Create the configured databases."
306
+ task :create do
307
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} propel:database:create --env=#{symfony_env_prod}'"
308
+ end
309
+
310
+ desc "Drop the configured databases."
311
+ task :drop do
312
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} propel:database:drop --env=#{symfony_env_prod}'"
313
+ end
314
+ end
315
+
316
+ namespace :build do
317
+ desc "Build the Model classes."
318
+ task :model do
319
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} propel:build-model --env=#{symfony_env_prod}'"
320
+ end
321
+
322
+ desc "Build SQL statements."
323
+ task :sql do
324
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} propel:build-sql --env=#{symfony_env_prod}'"
325
+ end
326
+
327
+ desc "Build the Model classes, SQL statements and insert SQL."
328
+ task :all_and_load do
329
+ try_sudo "sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} propel:build --insert-sql --env=#{symfony_env_prod}'"
330
+ end
331
+ end
332
+ end
333
+ end
334
+
335
+ # After finalizing update:
336
+ after "deploy:finalize_update" do
337
+ if update_vendors
338
+ # share the children first (to get the vendor symlink)
339
+ deploy.share_childs
340
+ vendors_mode.chomp # To remove trailing whiteline
341
+ case vendors_mode
342
+ when "upgrade" then symfony.vendors.upgrade
343
+ when "install" then symfony.vendors.install
344
+ when "reinstall" then symfony.vendors.reinstall
345
+ end
346
+ end
347
+
348
+ if do_migrations
349
+ symfony.doctrine.migrations.migrate if model_manager == "doctrine"
350
+ end
351
+
352
+ if update_schema
353
+ symfony.doctrine.schema.update if model_manager == "doctrine" # Update the schema
354
+ end
355
+
356
+ if load_fixtures
357
+ symfony.doctrine.fixtures.load_data if model_manager == "doctrine"
358
+ end
359
+
360
+ if assets_install
361
+ symfony.assets.install # 2. Publish bundle assets
362
+ end
363
+
364
+ symfony.cache.clear # Clear the cache because a new deploy has been done
365
+
366
+ if cache_warmup
367
+ symfony.cache.warmup # 3. Warmup clean cache
368
+ end
369
+
370
+ if dump_assetic_assets
371
+ symfony.assetic.dump # 4. Dump assetic assets
372
+ end
373
+
374
+ if model_manager == "propel"
375
+ symfony.propel.build.model
376
+ end
377
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kcapifony
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.1.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Kunstmaan
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: capistrano
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 2.5.10
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 2.5.10
30
+ description: ! ' kCapistrano is an open source tool for running scripts on multiple
31
+ servers. It’s primary use is for easily deploying applications. While it was built
32
+ specifically for deploying Rails apps, it’s pretty simple to customize it to deploy
33
+ other types of applications. This package is a deployment “recipe” to work with
34
+ symfony (both 1 and 2) applications. This is a fork to make working with our deployment
35
+ system more easy.
36
+
37
+ '
38
+ email: support@kunstmaan.be
39
+ executables:
40
+ - kcapifony
41
+ extensions: []
42
+ extra_rdoc_files: []
43
+ files:
44
+ - bin/kcapifony
45
+ - lib/kcapifony.rb
46
+ - lib/ksymfony1.rb
47
+ - lib/ksymfony2.rb
48
+ - README.md
49
+ - LICENSE
50
+ - CHANGELOG
51
+ homepage: https://github.com/Kunstmaan/kCapifony
52
+ licenses: []
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ requirements: []
70
+ rubyforge_project:
71
+ rubygems_version: 1.8.23
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: Deploying symfony PHP applications with Capistrano.
75
+ test_files: []