capifony 2.2.10 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### 2.3.0 / July 26, 2013
2
+
3
+ * Use `symfony_env_*` variables to tail
4
+ * Allow more Capistrano version
5
+ * Allow custom backup path
6
+ * chown deployment is recursive now
7
+
1
8
  ### 2.2.10 / June 9, 2013
2
9
 
3
10
  * "interactive_mode" should also affect composer
data/bin/capifony CHANGED
@@ -5,7 +5,7 @@ require 'fileutils'
5
5
 
6
6
  symfony_version = nil
7
7
  symfony_app_path = 'app'
8
- capifony_version = '2.2.10'
8
+ capifony_version = '2.3.0'
9
9
 
10
10
  OptionParser.new do |opts|
11
11
  opts.banner = "Usage: #{File.basename($0)} [path]"
@@ -64,7 +64,7 @@ module Capifony
64
64
  set :composer_bin, false
65
65
 
66
66
  # Options to pass to composer when installing/updating
67
- set :composer_options, "--no-scripts --no-dev --verbose --prefer-dist --optimize-autoloader --no-progress"
67
+ set :composer_options, "--no-dev --verbose --prefer-dist --optimize-autoloader --no-progress"
68
68
 
69
69
  # Whether to update vendors using the configured dependency manager (composer or bin/vendors)
70
70
  set :update_vendors, false
@@ -82,7 +82,6 @@ module Capifony
82
82
  set :dump_assetic_assets, false
83
83
 
84
84
  # Assets install
85
- set :assets_install, true
86
85
  set :assets_symlinks, false
87
86
  set :assets_relative, false
88
87
  set :assets_install_path, web_path
@@ -123,6 +122,9 @@ module Capifony
123
122
  # Doctrine custom entity manager
124
123
  set :doctrine_em, false
125
124
 
125
+ # Database backup folder
126
+ set :backup_path, "backups"
127
+
126
128
  # Use --flush option in doctrine:clear_* task
127
129
  set :doctrine_clear_use_flush_option, false
128
130
 
@@ -287,8 +289,6 @@ module Capifony
287
289
  end
288
290
  end
289
291
 
290
- symfony.bootstrap.build
291
-
292
292
  if use_set_permissions
293
293
  symfony.deploy.set_permissions
294
294
  end
@@ -305,10 +305,6 @@ module Capifony
305
305
  symfony.assets.update_version # Update `assets_version`
306
306
  end
307
307
 
308
- if assets_install
309
- symfony.assets.install # Publish bundle assets
310
- end
311
-
312
308
  if cache_warmup
313
309
  symfony.cache.warmup # Warmup clean cache
314
310
  end
@@ -19,12 +19,12 @@ namespace :database do
19
19
  logger.level = saved_log_level
20
20
 
21
21
  require "fileutils"
22
- FileUtils.mkdir_p("backups")
23
- get file, "backups/#{filename}"
22
+ FileUtils.mkdir_p("#{backup_path}")
23
+ get file, "#{backup_path}/#{filename}"
24
24
  begin
25
- FileUtils.ln_sf(filename, "backups/#{application}.remote_dump.latest.sql.gz")
25
+ FileUtils.ln_sf(filename, "#{backup_path}/#{application}.remote_dump.latest.sql.gz")
26
26
  rescue Exception # fallback for file systems that don't support symlinks
27
- FileUtils.cp_r("backups/#{filename}", "backups/#{application}.remote_dump.latest.sql.gz")
27
+ FileUtils.cp_r("#{backup_path}/#{filename}", "#{backup_path}/#{application}.remote_dump.latest.sql.gz")
28
28
  end
29
29
  run "#{try_sudo} rm #{file}"
30
30
  end
@@ -32,13 +32,13 @@ namespace :database do
32
32
  desc "Dump local database"
33
33
  task :local do
34
34
  filename = "#{application}.local_dump.#{Time.now.strftime("%Y-%m-%d_%H-%M-%S")}.sql.gz"
35
- tmpfile = "backups/#{application}_dump_tmp.sql"
36
- file = "backups/#{filename}"
35
+ tmpfile = "#{backup_path}/#{application}_dump_tmp.sql"
36
+ file = "#{backup_path}/#{filename}"
37
37
  config = load_database_config IO.read('config/databases.yml'), symfony_env_local
38
38
  sqlfile = "#{application}_dump.sql"
39
39
 
40
40
  require "fileutils"
41
- FileUtils::mkdir_p("backups")
41
+ FileUtils::mkdir_p("#{backup_path}")
42
42
 
43
43
  sql_dump_cmd = generate_sql_command('dump', config)
44
44
  run_locally "#{sql_dump_cmd} > #{tmpfile}"
@@ -53,9 +53,9 @@ namespace :database do
53
53
  end
54
54
 
55
55
  begin
56
- FileUtils.ln_sf(filename, "backups/#{application}.local_dump.latest.sql.gz")
56
+ FileUtils.ln_sf(filename, "#{backup_path}/#{application}.local_dump.latest.sql.gz")
57
57
  rescue Exception # fallback for file systems that don't support symlinks
58
- FileUtils.cp_r("backups/#{filename}", "backups/#{application}.local_dump.latest.sql.gz")
58
+ FileUtils.cp_r("#{backup_path}/#{filename}", "#{backup_path}/#{application}.local_dump.latest.sql.gz")
59
59
  end
60
60
  FileUtils.rm(tmpfile)
61
61
  end
@@ -68,11 +68,11 @@ namespace :database do
68
68
  database.dump.remote
69
69
 
70
70
  begin
71
- zipped_file_path = `readlink -f backups/#{application}.remote_dump.latest.sql.gz`.chop # gunzip does not work with a symlink
71
+ zipped_file_path = `readlink -f #{backup_path}/#{application}.remote_dump.latest.sql.gz`.chop # gunzip does not work with a symlink
72
72
  rescue Exception # fallback for file systems that don't support symlinks
73
- zipped_file_path = "backups/#{application}.remote_dump.latest.sql.gz"
73
+ zipped_file_path = "#{backup_path}/#{application}.remote_dump.latest.sql.gz"
74
74
  end
75
- unzipped_file_path = "backups/#{application}_dump.sql"
75
+ unzipped_file_path = "#{backup_path}/#{application}_dump.sql"
76
76
 
77
77
  run_locally "gunzip -c #{zipped_file_path} > #{unzipped_file_path}"
78
78
 
@@ -91,7 +91,7 @@ namespace :database do
91
91
  task :to_remote, :roles => :db, :only => { :primary => true } do
92
92
 
93
93
  filename = "#{application}.local_dump.latest.sql.gz"
94
- file = "backups/#{filename}"
94
+ file = "#{backup_path}/#{filename}"
95
95
  sqlfile = "#{application}_dump.sql"
96
96
  config = ""
97
97
 
@@ -23,17 +23,17 @@ namespace :database do
23
23
  puts data
24
24
  end
25
25
 
26
- FileUtils.mkdir_p("backups")
26
+ FileUtils.mkdir_p("#{backup_path}")
27
27
 
28
28
  capifony_progress_start
29
- get(file, "backups/#{filename}", :via => :scp) do |channel, name, sent, total|
29
+ get(file, "#{backup_path}/#{filename}", :via => :scp) do |channel, name, sent, total|
30
30
  capifony_progress_update(sent, total)
31
31
  end
32
32
 
33
33
  begin
34
- FileUtils.ln_sf(filename, "backups/#{application}.#{env}_dump.latest.sql.gz")
34
+ FileUtils.ln_sf(filename, "#{backup_path}/#{application}.#{env}_dump.latest.sql.gz")
35
35
  rescue Exception # fallback for file systems that don't support symlinks
36
- FileUtils.cp_r("backups/#{filename}", "backups/#{application}.#{env}_dump.latest.sql.gz")
36
+ FileUtils.cp_r("#{backup_path}/#{filename}", "#{backup_path}/#{application}.#{env}_dump.latest.sql.gz")
37
37
  end
38
38
  run "#{try_sudo} rm -f #{file}"
39
39
  end
@@ -41,12 +41,12 @@ namespace :database do
41
41
  desc "Dumps local database"
42
42
  task :local do
43
43
  filename = "#{application}.local_dump.#{Time.now.to_i}.sql.gz"
44
- tmpfile = "backups/#{application}_dump_tmp.sql"
45
- file = "backups/#{filename}"
44
+ tmpfile = "#{backup_path}/#{application}_dump_tmp.sql"
45
+ file = "#{backup_path}/#{filename}"
46
46
  config = load_database_config IO.read("#{app_config_path}/#{app_config_file}"), symfony_env_local
47
47
  sqlfile = "#{application}_dump.sql"
48
48
 
49
- FileUtils::mkdir_p("backups")
49
+ FileUtils::mkdir_p("#{backup_path}")
50
50
  case config['database_driver']
51
51
  when "pdo_mysql", "mysql"
52
52
  `mysqldump -u#{config['database_user']} --password=\"#{config['database_password']}\" #{config['database_name']} > #{tmpfile}`
@@ -64,9 +64,9 @@ namespace :database do
64
64
  end
65
65
 
66
66
  begin
67
- FileUtils.ln_sf(filename, "backups/#{application}.local_dump.latest.sql.gz")
67
+ FileUtils.ln_sf(filename, "#{backup_path}/#{application}.local_dump.latest.sql.gz")
68
68
  rescue Exception # fallback for file systems that don't support symlinks
69
- FileUtils.cp_r("backups/#{filename}", "backups/#{application}.local_dump.latest.sql.gz")
69
+ FileUtils.cp_r("#{backup_path}/#{filename}", "#{backup_path}/#{application}.local_dump.latest.sql.gz")
70
70
  end
71
71
  FileUtils.rm(tmpfile)
72
72
  end
@@ -82,24 +82,24 @@ namespace :database do
82
82
 
83
83
  database.dump.remote
84
84
 
85
- f = File.new("backups/#{sqlfile}", "a+")
86
- gz = Zlib::GzipReader.new(File.open("backups/#{filename}", "r"))
85
+ f = File.new("#{backup_path}/#{sqlfile}", "a+")
86
+ gz = Zlib::GzipReader.new(File.open("#{backup_path}/#{filename}", "r"))
87
87
  f << gz.read
88
88
  f.close
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']} < backups/#{sqlfile}`
92
+ `mysql -u#{config['database_user']} --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']} < backups/#{sqlfile}`
94
+ `PGPASSWORD=\"#{config['database_password']}\" psql -U #{config['database_user']} #{config['database_name']} < #{backup_path}/#{sqlfile}`
95
95
  end
96
- FileUtils.rm("backups/#{sqlfile}")
96
+ FileUtils.rm("#{backup_path}/#{sqlfile}")
97
97
  end
98
98
 
99
99
  desc "Dumps local database, loads it to remote, and populates there"
100
100
  task :to_remote, :roles => :db, :only => { :primary => true } do
101
101
  filename = "#{application}.local_dump.latest.sql.gz"
102
- file = "backups/#{filename}"
102
+ file = "#{backup_path}/#{filename}"
103
103
  sqlfile = "#{application}_dump.sql"
104
104
  config = ""
105
105
 
@@ -27,7 +27,7 @@ namespace :deploy do
27
27
  "setfacl -R -m u:#{user}:rwX -m u:#{webserver_user}:rwX %s",
28
28
  "setfacl -dR -m u:#{user}:rwx -m u:#{webserver_user}:rwx %s"
29
29
  ],
30
- :chown => ["chown #{webserver_user} %s"]
30
+ :chown => ["chown -R #{webserver_user} %s"]
31
31
  }
32
32
 
33
33
  if methods[permission_method]
@@ -13,6 +13,7 @@ namespace :symfony do
13
13
  log = action.to_s == 'tail' ? 'prod.log' : 'dev.log'
14
14
  desc "Tail #{log}"
15
15
  task action, :roles => :app, :except => { :no_release => true } do
16
+ log = action.to_s == 'tail' ? "#{symfony_env_prod}.log" : "#{symfony_env_local}.log"
16
17
  run "#{try_sudo} tail -n #{lines} -f #{shared_path}/#{log_path}/#{log}" do |channel, stream, data|
17
18
  trap("INT") { puts 'Interupted'; exit 0; }
18
19
  puts
@@ -28,7 +29,7 @@ namespace :symfony do
28
29
  task :update_version, :roles => :app, :except => { :no_release => true } do
29
30
  capifony_pretty_print "--> Updating assets version (in config.yml)"
30
31
 
31
- run "#{try_sudo} sed -i 's/\\(assets_version:[ ]*\\)\\([a-zA-Z0-9_]*\\)\\(.*\\)$/\\1#{real_revision[0,7]}\\3/g' #{latest_release}/#{app_config_path}/config.yml"
32
+ run "#{try_sudo} sed -i 's/\\(assets_version:[ ]*\\)\\([a-zA-Z0-9_]*\\)\\(.*\\)$/\\1#{real_revision.to_s[0,7]}\\3/g' #{latest_release}/#{app_config_path}/config.yml"
32
33
  capifony_puts_ok
33
34
  end
34
35
 
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.2.10
4
+ version: 2.3.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-06-09 00:00:00.000000000 Z
13
+ date: 2013-07-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: capistrano
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: 2.13.5
23
23
  - - <=
24
24
  - !ruby/object:Gem::Version
25
- version: 2.15.4
25
+ version: 2.16.0
26
26
  type: :runtime
27
27
  prerelease: false
28
28
  version_requirements: !ruby/object:Gem::Requirement
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: 2.13.5
34
34
  - - <=
35
35
  - !ruby/object:Gem::Version
36
- version: 2.15.4
36
+ version: 2.16.0
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: colored
39
39
  requirement: !ruby/object:Gem::Requirement