capifony 2.8.2 → 2.8.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ ### 2.8.3 / December 17, 2014
2
+
3
+ Fixed: rollback using the sudo context if available.
4
+ Fixed: support for hosts other then localhost when using `database:copy:to_local`
5
+ Fixed: revert "Recreated composer autoload after `deploy:rollback`
6
+
1
7
  ### 2.8.2 / October 7, 2014
2
8
 
3
9
  * Fixed: set default `:use_composer` to true
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
- Deploying symfony Applications with Capistrano
2
- ==============================================
1
+ Capifony
2
+ ========
3
3
 
4
4
  [![Build Status](https://secure.travis-ci.org/everzet/capifony.png?branch=master)](http://travis-ci.org/everzet/capifony)
5
5
 
@@ -5,7 +5,7 @@ require 'fileutils'
5
5
 
6
6
  symfony_version = nil
7
7
  symfony_app_path = 'app'
8
- capifony_version = '2.8.2'
8
+ capifony_version = '2.8.3'
9
9
 
10
10
  OptionParser.new do |opts|
11
11
  opts.banner = "Usage: #{File.basename($0)} [path]"
@@ -58,4 +58,21 @@ namespace :deploy do
58
58
  run "#{try_sudo} mkdir -p #{dirs.join(' ')}"
59
59
  run "#{try_sudo} chmod g+w #{dirs.join(' ')}" if fetch(:group_writable, true)
60
60
  end
61
+
62
+ desc <<-DESC
63
+ Copies your project to the remote servers. This is the first stage \
64
+ of any deployment; moving your updated code and assets to the deployment \
65
+ servers. You will rarely call this task directly, however; instead, you \
66
+ should call the `deploy' task (to do a complete deploy) or the `update' \
67
+ task (if you want to perform the `restart' task separately).
68
+ You will need to make sure you set the :scm variable to the source \
69
+ control software you are using (it defaults to :subversion), and the \
70
+ :deploy_via variable to the strategy you want to use to deploy (it \
71
+ defaults to :checkout).
72
+ DESC
73
+ task :update_code, :except => { :no_release => true } do
74
+ on_rollback { run "#{try_sudo} rm -rf #{release_path}; true" }
75
+ strategy.deploy!
76
+ finalize_update
77
+ end
61
78
  end
@@ -11,11 +11,13 @@ load 'symfony1/web'
11
11
 
12
12
  require 'yaml'
13
13
 
14
+ set :databases_config_path, "config/databases.yml"
15
+
14
16
  # Dirs that need to remain the same between deploys (shared dirs)
15
17
  set :shared_children, %w(log web/uploads)
16
18
 
17
19
  # Files that need to remain the same between deploys
18
- set :shared_files, %w(config/databases.yml)
20
+ set :shared_files, %w(#{databases_config_path})
19
21
 
20
22
  # Asset folders (that need to be timestamped)
21
23
  set :asset_children, %w(web/css web/images web/js)
@@ -40,7 +42,7 @@ set :use_shared_symfony, false
40
42
  set :symfony_version, "1.4.18"
41
43
 
42
44
  def guess_symfony_orm
43
- databases = YAML::load(IO.read('config/databases.yml'))
45
+ databases = YAML::load(IO.read(databases_config_path))
44
46
 
45
47
  if databases[symfony_env_local]
46
48
  databases[symfony_env_local].keys[0].to_s
@@ -347,13 +347,6 @@ module Capifony
347
347
  after "deploy:create_symlink" do
348
348
  puts "--> Successfully deployed!".green
349
349
  end
350
-
351
- # Recreate the autoload file after rolling back
352
- # https://github.com/everzet/capifony/issues/422
353
- after "deploy:rollback" do
354
- run "cd #{current_path} && #{composer_bin} dump-autoload #{composer_dump_autoload_options}"
355
- end
356
-
357
350
  end
358
351
 
359
352
  end
@@ -7,7 +7,7 @@ namespace :database do
7
7
  sqlfile = "#{application}_dump.sql"
8
8
  config = ""
9
9
 
10
- run "#{try_sudo} cat #{shared_path}/config/databases.yml" do |ch, st, data|
10
+ run "#{try_sudo} cat #{shared_path}/#{databases_config_path}" do |ch, st, data|
11
11
  config = load_database_config data, symfony_env_prod
12
12
  end
13
13
 
@@ -34,7 +34,7 @@ namespace :database do
34
34
  filename = "#{application}.local_dump.#{Time.now.strftime("%Y-%m-%d_%H-%M-%S")}.sql.gz"
35
35
  tmpfile = "#{backup_path}/#{application}_dump_tmp.sql"
36
36
  file = "#{backup_path}/#{filename}"
37
- config = load_database_config IO.read('config/databases.yml'), symfony_env_local
37
+ config = load_database_config IO.read(databases_config_path), symfony_env_local
38
38
  sqlfile = "#{application}_dump.sql"
39
39
 
40
40
  require "fileutils"
@@ -76,7 +76,7 @@ namespace :database do
76
76
 
77
77
  run_locally "gunzip -c #{zipped_file_path} > #{unzipped_file_path}"
78
78
 
79
- config = load_database_config IO.read('config/databases.yml'), symfony_env_local
79
+ config = load_database_config IO.read(databases_config_path), symfony_env_local
80
80
 
81
81
  run_locally generate_sql_command('drop', config)
82
82
  run_locally generate_sql_command('create', config)
@@ -100,7 +100,7 @@ namespace :database do
100
100
  upload(file, "#{remote_tmp_dir}/#{filename}", :via => :scp)
101
101
  run "#{try_sudo} gunzip -c #{remote_tmp_dir}/#{filename} > #{remote_tmp_dir}/#{sqlfile}"
102
102
 
103
- run "#{try_sudo} cat #{shared_path}/config/databases.yml" do |ch, st, data|
103
+ run "#{try_sudo} cat #{shared_path}/#{databases_config_path}" do |ch, st, data|
104
104
  config = load_database_config data, symfony_env_prod
105
105
  end
106
106
 
@@ -7,7 +7,7 @@ namespace :symfony do
7
7
 
8
8
  desc "Ensure Doctrine is correctly configured"
9
9
  task :setup do
10
- conf_files_exists = capture("if test -s #{shared_path}/config/databases.yml ; then echo 'exists' ; fi").strip
10
+ conf_files_exists = capture("if test -s #{shared_path}/#{databases_config_path} ; then echo 'exists' ; fi").strip
11
11
  if (!conf_files_exists.eql?("exists"))
12
12
  symfony.configure.database
13
13
  end
@@ -2,7 +2,7 @@ namespace :symfony do
2
2
  namespace :propel do
3
3
  desc "Ensure Propel is correctly configured"
4
4
  task :setup, :roles => :app, :except => { :no_release => true } do
5
- conf_files_exists = capture("if test -s #{shared_path}/config/propel.ini -a -s #{shared_path}/config/databases.yml ; then echo 'exists' ; fi").strip
5
+ conf_files_exists = capture("if test -s #{shared_path}/config/propel.ini -a -s #{shared_path}/#{databases_config_path} ; then echo 'exists' ; fi").strip
6
6
 
7
7
  # share childs again (for propel.ini file)
8
8
  shared_files << "config/propel.ini"
@@ -1,13 +1,13 @@
1
1
  namespace :shared do
2
2
  namespace :databases do
3
- desc "Download config/databases.yml from remote server"
3
+ desc "Download database config file from remote server"
4
4
  task :to_local do
5
- download("#{shared_path}/config/databases.yml", "config/databases.yml", :via => :scp)
5
+ download("#{shared_path}/#{databases_config_path}", databases_config_path, :via => :scp)
6
6
  end
7
7
 
8
- desc "Upload config/databases.yml to remote server"
8
+ desc "Upload database config to remote server"
9
9
  task :to_remote do
10
- upload("config/databases.yml", "#{shared_path}/config/databases.yml", :via => :scp)
10
+ upload(databases_config_path, "#{shared_path}/#{databases_config_path}", :via => :scp)
11
11
  end
12
12
  end
13
13
 
@@ -89,9 +89,9 @@ namespace :database do
89
89
 
90
90
  case config['database_driver']
91
91
  when "pdo_mysql", "mysql"
92
- `mysql -u#{config['database_user']} --password=\"#{config['database_password']}\" #{config['database_name']} < #{backup_path}/#{sqlfile}`
92
+ `mysql -u#{config['database_user']} --host=\"#{config['database_host']}\" --password=\"#{config['database_password']}\" #{config['database_name']} < #{backup_path}/#{sqlfile}`
93
93
  when "pdo_pgsql", "pgsql"
94
- `PGPASSWORD=\"#{config['database_password']}\" psql -U #{config['database_user']} #{config['database_name']} < #{backup_path}/#{sqlfile}`
94
+ `PGPASSWORD=\"#{config['database_password']}\" psql -U #{config['database_user']} #{config['database_name']} -h#{config['database_host']}< #{backup_path}/#{sqlfile}`
95
95
  end
96
96
  FileUtils.rm("#{backup_path}/#{sqlfile}")
97
97
  end
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.8.2
4
+ version: 2.8.3
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: 2014-10-07 00:00:00.000000000 Z
13
+ date: 2014-12-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: capistrano