capifony 2.3.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,17 @@
1
+ ### 2.4.0 / September 17, 2013
2
+
3
+ * Fixed: copy vendor dir to latest_release, not to latest_release/vendor
4
+ * Added: -h option with host into postgresql dump tasks
5
+ * Fixed: assets install step disappeared ??
6
+ * Added: variable to set options of dump-autoload action
7
+ * Added: missing backup_path definition for symfony 1
8
+ * Added: new gem dependency on fakefs (specs)
9
+ * Added: backup task for the shared folder
10
+ * Fixed: changed database backup filename to be human readable
11
+ * Added: license to gemspec
12
+ * Added: web_path variable
13
+ * Fixed: set symfony environment prior calling composer install
14
+
1
15
  ### 2.3.0 / July 26, 2013
2
16
 
3
17
  * Use `symfony_env_*` variables to tail
@@ -5,7 +5,7 @@ require 'fileutils'
5
5
 
6
6
  symfony_version = nil
7
7
  symfony_app_path = 'app'
8
- capifony_version = '2.3.0'
8
+ capifony_version = '2.4.0'
9
9
 
10
10
  OptionParser.new do |opts|
11
11
  opts.banner = "Usage: #{File.basename($0)} [path]"
@@ -20,6 +20,9 @@ set :shared_files, %w(config/databases.yml)
20
20
  # Asset folders (that need to be timestamped)
21
21
  set :asset_children, %w(web/css web/images web/js)
22
22
 
23
+ # Database backup folder
24
+ set :backup_path, "backups"
25
+
23
26
  # Use ORM
24
27
  set :use_orm, true
25
28
 
@@ -21,6 +21,7 @@ module Capifony
21
21
  load 'symfony2/doctrine'
22
22
  load 'symfony2/propel'
23
23
  load 'symfony2/web'
24
+ load 'symfony2/shared'
24
25
 
25
26
  # Symfony application path
26
27
  set :app_path, "app"
@@ -66,6 +67,9 @@ module Capifony
66
67
  # Options to pass to composer when installing/updating
67
68
  set :composer_options, "--no-dev --verbose --prefer-dist --optimize-autoloader --no-progress"
68
69
 
70
+ # Options to pass to composer when dumping the autoloader (dump-autoloader)
71
+ set :composer_dump_autoload_options, "--optimize"
72
+
69
73
  # Whether to update vendors using the configured dependency manager (composer or bin/vendors)
70
74
  set :update_vendors, false
71
75
 
@@ -82,6 +86,7 @@ module Capifony
82
86
  set :dump_assetic_assets, false
83
87
 
84
88
  # Assets install
89
+ set :assets_install, false
85
90
  set :assets_symlinks, false
86
91
  set :assets_relative, false
87
92
  set :assets_install_path, web_path
@@ -309,6 +314,10 @@ module Capifony
309
314
  symfony.cache.warmup # Warmup clean cache
310
315
  end
311
316
 
317
+ if assets_install
318
+ symfony.assets.install # Install assets
319
+ end
320
+
312
321
  if dump_assetic_assets
313
322
  symfony.assetic.dump # Dump assetic assets
314
323
  end
@@ -26,12 +26,12 @@ namespace :shared do
26
26
  namespace :uploads do
27
27
  desc "Download all files from remote web/uploads folder to local one"
28
28
  task :to_local do
29
- download("#{shared_path}/web/uploads", "web", :via => :scp, :recursive => true)
29
+ download("#{shared_path}/#{web_path}/uploads", "#{web_path}", :via => :scp, :recursive => true)
30
30
  end
31
31
 
32
32
  desc "Upload all files from local web/uploads folder to remote one"
33
33
  task :to_remote do
34
- upload("web/uploads", "#{shared_path}/web", :via => :scp, :recursive => true)
34
+ upload("#{web_path}/uploads", "#{shared_path}/#{web_path}", :via => :scp, :recursive => true)
35
35
  end
36
36
  end
37
37
 
@@ -95,12 +95,12 @@ namespace :symfony do
95
95
 
96
96
  # First application listed becomes index.php
97
97
  if app = apps.shift
98
- cmd << "cp #{release_path}/web/#{app}_#{env}.php #{release_path}/web/index.php"
98
+ cmd << "cp #{release_path}/#{web_path}/#{app}_#{env}.php #{release_path}/#{web_path}/index.php"
99
99
  end
100
100
 
101
101
  # All other apps are copied to their default controllers
102
102
  for app in apps
103
- cmd << "cp #{release_path}/web/#{app}_#{env}.php #{release_path}/web/#{app}.php"
103
+ cmd << "cp #{release_path}/#{web_path}/#{app}_#{env}.php #{release_path}/#{web_path}/#{app}.php"
104
104
  end
105
105
 
106
106
  run "#{try_sudo} sh -c '#{cmd.join(';')}'" if cmd.join(';')
@@ -6,7 +6,7 @@ namespace :database 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
+ filename = "#{application}.#{env}_dump.#{Time.now.utc.strftime("%Y%m%d%H%M%S")}.sql.gz"
10
10
  file = "#{remote_tmp_dir}/#{filename}"
11
11
  sqlfile = "#{application}_dump.sql"
12
12
  config = ""
@@ -19,7 +19,7 @@ namespace :database do
19
19
  data = capture("#{try_sudo} sh -c 'mysqldump -u#{config['database_user']} --host='#{config['database_host']}' --password='#{config['database_password']}' #{config['database_name']} | gzip -c > #{file}'")
20
20
  puts data
21
21
  when "pdo_pgsql", "pgsql"
22
- data = capture("#{try_sudo} sh -c 'PGPASSWORD=\"#{config['database_password']}\" pg_dump -U #{config['database_user']} #{config['database_name']} --clean | gzip -c > #{file}'")
22
+ data = capture("#{try_sudo} sh -c 'PGPASSWORD=\"#{config['database_password']}\" pg_dump -U #{config['database_user']} #{config['database_name']} -h#{config['database_host']} --clean | gzip -c > #{file}'")
23
23
  puts data
24
24
  end
25
25
 
@@ -40,7 +40,7 @@ namespace :database do
40
40
 
41
41
  desc "Dumps local database"
42
42
  task :local do
43
- filename = "#{application}.local_dump.#{Time.now.to_i}.sql.gz"
43
+ filename = "#{application}.local_dump.#{Time.now.utc.strftime("%Y%m%d%H%M%S")}.sql.gz"
44
44
  tmpfile = "#{backup_path}/#{application}_dump_tmp.sql"
45
45
  file = "#{backup_path}/#{filename}"
46
46
  config = load_database_config IO.read("#{app_config_path}/#{app_config_file}"), symfony_env_local
@@ -116,7 +116,7 @@ namespace :database do
116
116
  data = capture("#{try_sudo} mysql -u#{config['database_user']} --host='#{config['database_host']}' --password='#{config['database_password']}' #{config['database_name']} < #{remote_tmp_dir}/#{sqlfile}")
117
117
  puts data
118
118
  when "pdo_pgsql", "pgsql"
119
- data = capture("#{try_sudo} PGPASSWORD=\"#{config['database_password']}\" psql -U #{config['database_user']} #{config['database_name']} < #{remote_tmp_dir}/#{sqlfile}")
119
+ data = capture("#{try_sudo} PGPASSWORD=\"#{config['database_password']}\" psql -U #{config['database_user']} #{config['database_name']} -h#{config['database_host']} < #{remote_tmp_dir}/#{sqlfile}")
120
120
  puts data
121
121
  end
122
122
 
@@ -0,0 +1,32 @@
1
+ require 'fileutils'
2
+
3
+ namespace :shared do
4
+ namespace :folder do
5
+ desc "Downloads a backup of the shared folder"
6
+ task :download do
7
+ env = fetch(:deploy_env, "remote")
8
+ filename = "#{application}.#{env}_shared.#{Time.now.utc.strftime("%Y%m%d%H%M%S")}.tar.gz"
9
+ file = "#{remote_tmp_dir}/#{filename}"
10
+
11
+ capifony_pretty_print "--> Making a temporary archive of the shared directory"
12
+ run "#{try_sudo} sh -c 'cd #{shared_path}; tar -zcvf #{file} --exclude='cached-copy' .'"
13
+ capifony_puts_ok
14
+
15
+ FileUtils.mkdir_p("backups/")
16
+
17
+ capifony_progress_start
18
+ get(file, "backups/#{filename}", :via => :scp) do |channel, name, sent, total|
19
+ capifony_progress_update(sent, total)
20
+ end
21
+
22
+ capifony_pretty_print "--> Cleaning up"
23
+ begin
24
+ FileUtils.ln_sf(filename, "backups/#{application}.#{env}_shared.latest.tar.gz")
25
+ rescue Exception # fallback for file systems that don't support symlinks
26
+ FileUtils.cp_r("backups/#{filename}", "backups/#{application}.#{env}_shared.latest.tar.gz")
27
+ end
28
+ run "#{try_sudo} rm -f #{file}"
29
+ capifony_puts_ok
30
+ end
31
+ end
32
+ end
@@ -149,11 +149,11 @@ namespace :symfony do
149
149
  if use_composer_tmp
150
150
  logger.debug "Installing composer dependencies to #{$temp_destination}"
151
151
  capifony_pretty_print "--> Installing Composer dependencies in temp location"
152
- run_locally "cd #{$temp_destination} && #{composer_bin} install #{options}"
152
+ run_locally "cd #{$temp_destination} && SYMFONY_ENV=#{symfony_env_prod} #{composer_bin} install #{options}"
153
153
  capifony_puts_ok
154
154
  else
155
155
  capifony_pretty_print "--> Installing Composer dependencies"
156
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{composer_bin} install #{options}'"
156
+ run "#{try_sudo} sh -c 'cd #{latest_release} && SYMFONY_ENV=#{symfony_env_prod} #{composer_bin} install #{options}'"
157
157
  capifony_puts_ok
158
158
  end
159
159
  end
@@ -183,14 +183,14 @@ namespace :symfony do
183
183
  end
184
184
 
185
185
  capifony_pretty_print "--> Dumping an optimized autoloader"
186
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{composer_bin} dump-autoload --optimize'"
186
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{composer_bin} dump-autoload #{composer_dump_autoload_options}'"
187
187
  capifony_puts_ok
188
188
  end
189
189
 
190
190
  task :copy_vendors, :except => { :no_release => true } do
191
191
  capifony_pretty_print "--> Copying vendors from previous release"
192
192
 
193
- run "vendorDir=#{current_path}/vendor; if [ -d $vendorDir ] || [ -h $vendorDir ]; then cp -a $vendorDir #{latest_release}/vendor; fi;"
193
+ run "vendorDir=#{current_path}/vendor; if [ -d $vendorDir ] || [ -h $vendorDir ]; then cp -a $vendorDir #{latest_release}; fi;"
194
194
  capifony_puts_ok
195
195
  end
196
196
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capifony
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-07-26 00:00:00.000000000 Z
13
+ date: 2013-09-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: capistrano
@@ -129,6 +129,7 @@ files:
129
129
  - lib/symfony2/deploy.rb
130
130
  - lib/symfony2/doctrine.rb
131
131
  - lib/symfony2/propel.rb
132
+ - lib/symfony2/shared.rb
132
133
  - lib/symfony2/symfony.rb
133
134
  - lib/symfony2/web.rb
134
135
  - README.md
@@ -136,7 +137,8 @@ files:
136
137
  - CHANGELOG.md
137
138
  - UPGRADE.md
138
139
  homepage: http://capifony.org
139
- licenses: []
140
+ licenses:
141
+ - MIT
140
142
  post_install_message:
141
143
  rdoc_options: []
142
144
  require_paths: