capifony 2.1.10 → 2.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,15 @@
1
+ == 2.1.11 / July 20, 2012
2
+
3
+ * Fix hard-coded "app" references
4
+ * Fix hard-coded path to "app"
5
+ * Fix set_permissions task. Refs #166
6
+ * Try to fix #166
7
+ * Setting :roles, etc. for each task (Symfony2 only currently)
8
+ * Fix set_permissions task. Refs #166
9
+ * Fix documentation link
10
+ * Fix #163
11
+ * fix elsif synthax
12
+
1
13
  == 2.1.10 / July 16, 2012
2
14
 
3
15
  * Fix CS
@@ -15,7 +27,7 @@
15
27
  * Add task for updating `assets_version` in `config.yml`
16
28
  * Avoid the use of try_sudo
17
29
  * More `:no_release`...
18
- * Since `:roles` isn't used in Capifony, these need `:no_release` *at least*.
30
+ * Since `:roles` isn't used in Capifony, these need `:no_release` *at least*.
19
31
  * Fixing missing `pretty_print`.
20
32
 
21
33
  == 2.1.9 / July 3, 2012
data/README.md CHANGED
@@ -33,7 +33,7 @@ lot easier.
33
33
 
34
34
  ## What's next? ##
35
35
 
36
- Read the [capifony documentation](http://everzet.github.com/capifony/)
36
+ Read the [capifony documentation](http://capifony.org/)
37
37
 
38
38
 
39
39
  ## Contributors ##
data/lib/capifony.rb CHANGED
@@ -19,7 +19,7 @@ namespace :deploy do
19
19
  Blank task exists as a hook into which to install your own environment \
20
20
  specific behaviour.
21
21
  DESC
22
- task :start, :roles => :app do
22
+ task :start, :roles => :app, :except => { :no_release => true } do
23
23
  # Empty Task to overload with your platform specifics
24
24
  end
25
25
 
@@ -27,12 +27,17 @@ namespace :deploy do
27
27
  Blank task exists as a hook into which to install your own environment \
28
28
  specific behaviour.
29
29
  DESC
30
- task :stop, :roles => :app do
30
+ task :stop, :roles => :app, :except => { :no_release => true } do
31
31
  # Empty Task to overload with your platform specifics
32
32
  end
33
33
 
34
- desc "Overwrite the restart task because symfony doesn't need it."
35
- task :restart do ; end
34
+ desc <<-DESC
35
+ Blank task exists as a hook into which to install your own environment \
36
+ specific behaviour.
37
+ DESC
38
+ task :restart, :roles => :app, :except => { :no_release => true } do
39
+ # Empty Task to overload with your platform specifics
40
+ end
36
41
 
37
42
  desc <<-DESC
38
43
  Prepares one or more servers for deployment. Before you can use any \
@@ -46,7 +51,7 @@ namespace :deploy do
46
51
  It is safe to run this task on servers that have already been set up; it \
47
52
  will not destroy any deployed revisions or data.
48
53
  DESC
49
- task :setup, :except => { :no_release => true } do
54
+ task :setup, :roles => :app, :except => { :no_release => true } do
50
55
  dirs = [deploy_to, releases_path, shared_path]
51
56
  run "mkdir -p #{dirs.join(' ')}"
52
57
  run "chmod g+w #{dirs.join(' ')}" if fetch(:group_writable, true)
@@ -1,7 +1,7 @@
1
1
  namespace :database do
2
2
  namespace :dump do
3
3
  desc "Dump remote database"
4
- task :remote do
4
+ task :remote, :roles => :db, :only => { :primary => true } do
5
5
  filename = "#{application}.remote_dump.#{Time.now.strftime("%Y-%m-%d_%H-%M-%S")}.sql.gz"
6
6
  file = "/tmp/#{filename}"
7
7
  sqlfile = "#{application}_dump.sql"
@@ -61,7 +61,7 @@ namespace :database do
61
61
 
62
62
  namespace :move do
63
63
  desc "Dump remote database, download it to local & populate here"
64
- task :to_local do
64
+ task :to_local, :roles => :db, :only => { :primary => true } do
65
65
 
66
66
  database.dump.remote
67
67
 
@@ -86,7 +86,7 @@ namespace :database do
86
86
  end
87
87
 
88
88
  desc "Dump local database, load it to remote & populate there"
89
- task :to_remote do
89
+ task :to_remote, :roles => :db, :only => { :primary => true } do
90
90
 
91
91
  filename = "#{application}.local_dump.latest.sql.gz"
92
92
  file = "backups/#{filename}"
data/lib/symfony2.rb CHANGED
@@ -93,7 +93,11 @@ def guess_symfony_version
93
93
  end
94
94
 
95
95
  def remote_file_exists?(full_path)
96
- 'true' == capture("if [ -e #{full_path} ]; then echo 'true'; fi").strip
96
+ 'true' == capture("if [ -e #{full_path} ]; then echo 'true'; fi").strip
97
+ end
98
+
99
+ def remote_command_exists?(command)
100
+ 'true' == capture("type -P #{command} &>/dev/null && echo 'true' || echo 'false'")
97
101
  end
98
102
 
99
103
  after "deploy:finalize_update" do
@@ -4,13 +4,13 @@ require "zlib"
4
4
  namespace :database do
5
5
  namespace :dump do
6
6
  desc "Dumps remote database"
7
- task :remote do
7
+ task :remote, :roles => :db, :only => { :primary => true } do
8
8
  filename = "#{application}.remote_dump.#{Time.now.to_i}.sql.gz"
9
9
  file = "/tmp/#{filename}"
10
10
  sqlfile = "#{application}_dump.sql"
11
11
  config = ""
12
12
 
13
- run "cat #{current_path}/app/config/parameters.yml" do |ch, st, data|
13
+ run "cat #{current_path}/#{app_path}/config/parameters.yml" do |ch, st, data|
14
14
  config = load_database_config data, symfony_env_prod
15
15
  end
16
16
 
@@ -25,7 +25,6 @@ namespace :database do
25
25
  end
26
26
  end
27
27
 
28
-
29
28
  FileUtils.mkdir_p("backups")
30
29
  get file, "backups/#{filename}"
31
30
  begin
@@ -41,7 +40,7 @@ namespace :database do
41
40
  filename = "#{application}.local_dump.#{Time.now.to_i}.sql.gz"
42
41
  tmpfile = "backups/#{application}_dump_tmp.sql"
43
42
  file = "backups/#{filename}"
44
- config = load_database_config IO.read('app/config/parameters.yml'), symfony_env_local
43
+ config = load_database_config IO.read("#{app_path}/config/parameters.yml"), symfony_env_local
45
44
  sqlfile = "#{application}_dump.sql"
46
45
 
47
46
  FileUtils::mkdir_p("backups")
@@ -72,9 +71,9 @@ namespace :database do
72
71
 
73
72
  namespace :move do
74
73
  desc "Dumps remote database, downloads it to local, and populates here"
75
- task :to_local do
74
+ task :to_local, :roles => :db, :only => { :primary => true } do
76
75
  filename = "#{application}.remote_dump.latest.sql.gz"
77
- config = load_database_config IO.read('app/config/parameters.yml'), symfony_env_local
76
+ config = load_database_config IO.read("#{app_path}/config/parameters.yml"), symfony_env_local
78
77
  sqlfile = "#{application}_dump.sql"
79
78
 
80
79
  database.dump.remote
@@ -94,7 +93,7 @@ namespace :database do
94
93
  end
95
94
 
96
95
  desc "Dumps local database, loads it to remote, and populates there"
97
- task :to_remote do
96
+ task :to_remote, :roles => :db, :only => { :primary => true } do
98
97
  filename = "#{application}.local_dump.latest.sql.gz"
99
98
  file = "backups/#{filename}"
100
99
  sqlfile = "#{application}_dump.sql"
@@ -4,7 +4,7 @@ namespace :deploy do
4
4
  Sets permissions for writable_dirs folders as described in the Symfony documentation
5
5
  (http://symfony.com/doc/master/book/installation.html#configuration-and-setup)
6
6
  DESC
7
- task :set_permissions, :roles => :app do
7
+ task :set_permissions, :roles => :app, :except => { :no_release => true } do
8
8
  if writable_dirs && permission_method
9
9
  dirs = []
10
10
 
@@ -19,17 +19,17 @@ namespace :deploy do
19
19
  end
20
20
 
21
21
  methods = {
22
- :chmod => "#{try_sudo} chmod +a \"#{webserver_user} allow delete,write,append,file_inherit,directory_inherit\" %s",
23
- :acl => "#{try_sudo} setfacl -dR -m u:#{webserver_user}:rwx %s",
24
- :chown => "#{try_sudo} chown #{webserver_user} %s"
22
+ :chmod => "chmod +a \"#{webserver_user} allow delete,write,append,file_inherit,directory_inherit\" %s",
23
+ :acl => "setfacl -dR -m u:#{webserver_user}:rwx %s",
24
+ :chown => "chown #{webserver_user} %s"
25
25
  }
26
26
 
27
27
  if methods[permission_method]
28
28
  pretty_print "--> Setting permissions"
29
29
 
30
- if use_sudo
31
- run sprintf(methods[permission_method], dirs.join(' '))
32
- else if permission_method == :chown
30
+ if fetch(:use_sudo, false)
31
+ sudo sprintf(methods[permission_method], dirs.join(' '))
32
+ elsif permission_method == :chown
33
33
  puts " You can't use chown method without sudoing"
34
34
  else
35
35
  dirs.each do |dir|
@@ -37,7 +37,7 @@ namespace :deploy do
37
37
  if is_owner && permission_method != :chown
38
38
  run sprintf(methods[permission_method], dir)
39
39
  else
40
- puts " #{dir} is not owned by #{user} or you are using 'chown' method without 'use_sudo'"
40
+ puts " #{dir} is not owned by #{user} or you are using 'chown' method without ':use_sudo'"
41
41
  end
42
42
  end
43
43
  end
@@ -49,7 +49,7 @@ namespace :deploy do
49
49
  end
50
50
 
51
51
  desc "Symlinks static directories and static files that need to remain between deployments"
52
- task :share_childs, :except => { :no_release => true } do
52
+ task :share_childs, :roles => :app, :except => { :no_release => true } do
53
53
  if shared_children
54
54
  pretty_print "--> Creating symlinks for shared directories"
55
55
 
@@ -77,7 +77,7 @@ namespace :deploy do
77
77
  end
78
78
 
79
79
  desc "Updates latest release source path"
80
- task :finalize_update, :except => { :no_release => true } do
80
+ task :finalize_update, :roles => :app, :except => { :no_release => true } do
81
81
  run "chmod -R g+w #{latest_release}" if fetch(:group_writable, true)
82
82
 
83
83
  pretty_print "--> Creating cache directory"
@@ -99,7 +99,7 @@ namespace :deploy do
99
99
  else
100
100
  pretty_print "--> Normalizing asset timestamps"
101
101
 
102
- run "find #{asset_paths} -exec touch -t #{stamp} {} ';' >& /dev/null || true", :env => { "TZ" => "UTC" }
102
+ run "find #{asset_paths} -exec touch -t #{stamp} {} ';' &> /dev/null || true", :env => { "TZ" => "UTC" }
103
103
  puts_ok
104
104
  end
105
105
  end
@@ -109,20 +109,20 @@ namespace :deploy do
109
109
  Deploys and starts a `cold' application. This is useful if you have not \
110
110
  deployed your application before.
111
111
  DESC
112
- task :cold do
112
+ task :cold, :roles => :app, :except => { :no_release => true } do
113
113
  update
114
114
  start
115
115
  end
116
116
 
117
117
  desc "Deploys the application and runs the test suite"
118
- task :testall, :except => { :no_release => true } do
118
+ task :testall, :roles => :app, :except => { :no_release => true } do
119
119
  update_code
120
120
  create_symlink
121
121
  run "cd #{latest_release} && phpunit -c #{app_path} src"
122
122
  end
123
123
 
124
124
  desc "Runs the Symfony2 migrations"
125
- task :migrate do
125
+ task :migrate, :roles => :app, :except => { :no_release => true }, :only => { :primary => true } do
126
126
  if model_manager == "doctrine"
127
127
  symfony.doctrine.migrations.migrate
128
128
  else
@@ -2,7 +2,7 @@ namespace :symfony do
2
2
  namespace :doctrine do
3
3
  namespace :cache do
4
4
  desc "Clears all metadata cache for a entity manager"
5
- task :clear_metadata do
5
+ task :clear_metadata, :roles => :app, :except => { :no_release => true } do
6
6
  pretty_print "--> Clearing Doctrine metadata cache"
7
7
 
8
8
  run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-metadata --env=#{symfony_env_prod}"
@@ -10,7 +10,7 @@ namespace :symfony do
10
10
  end
11
11
 
12
12
  desc "Clears all query cache for a entity manager"
13
- task :clear_query do
13
+ task :clear_query, :roles => :app, :except => { :no_release => true } do
14
14
  pretty_print "--> Clearing Doctrine query cache"
15
15
 
16
16
  run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-query --env=#{symfony_env_prod}"
@@ -18,7 +18,7 @@ namespace :symfony do
18
18
  end
19
19
 
20
20
  desc "Clears result cache for a entity manager"
21
- task :clear_result do
21
+ task :clear_result, :roles => :app, :except => { :no_release => true } do
22
22
  pretty_print "--> Clearing Doctrine result cache"
23
23
 
24
24
  run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-result --env=#{symfony_env_prod}"
@@ -27,40 +27,39 @@ namespace :symfony do
27
27
  end
28
28
 
29
29
  namespace :database do
30
- desc "Creates the configured databases"
31
- task :create, :roles => :db, :only => { :primary => true } do
32
- pretty_print "--> Creating databases"
33
-
34
- run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:database:create --env=#{symfony_env_prod}"
35
- puts_ok
36
- end
37
-
38
- desc "Drops the configured databases"
39
- task :drop, :roles => :db, :only => { :primary => true } do
40
- pretty_print "--> Dropping databases"
30
+ [:create, :drop].each do |action|
31
+ desc "#{action.to_s.capitalize}s the configured databases"
32
+ task action, :roles => :app, :except => { :no_release => true } do
33
+ case action.to_s
34
+ when "create"
35
+ pretty_print "--> Creating databases"
36
+ when "drop"
37
+ pretty_print "--> Dropping databases"
38
+ end
41
39
 
42
- run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:database:drop --env=#{symfony_env_prod}"
43
- puts_ok
40
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:database:#{action.to_s} --env=#{symfony_env_prod}", :once => true
41
+ puts_ok
42
+ end
44
43
  end
45
44
  end
46
45
 
47
46
  namespace :schema do
48
47
  desc "Processes the schema and either create it directly on EntityManager Storage Connection or generate the SQL output"
49
- task :create do
50
- run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:create --env=#{symfony_env_prod}"
48
+ task :create, :roles => :app, :except => { :no_release => true } do
49
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:create --env=#{symfony_env_prod}", :once => true
51
50
  end
52
51
 
53
52
  desc "Drops the complete database schema of EntityManager Storage Connection or generate the corresponding SQL output"
54
- task :drop do
55
- run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:drop --env=#{symfony_env_prod}"
53
+ task :drop, :roles => :app, :except => { :no_release => true } do
54
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:drop --env=#{symfony_env_prod}", :once => true
56
55
  end
57
56
  end
58
57
 
59
58
  namespace :migrations do
60
59
  desc "Executes a migration to a specified version or the latest available version"
61
- task :migrate, :roles => :db, :only => { :primary => true } do
60
+ task :migrate, :roles => :app, :except => { :no_release => true } do
62
61
  currentVersion = nil
63
- run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:status --env=#{symfony_env_prod}" do |ch, stream, out|
62
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:status --env=#{symfony_env_prod}", :once => true do |ch, stream, out|
64
63
  if stream == :out and out =~ /Current Version:[^$]+\(([\w]+)\)/
65
64
  currentVersion = Regexp.last_match(1)
66
65
  end
@@ -76,31 +75,41 @@ namespace :symfony do
76
75
 
77
76
  on_rollback {
78
77
  if !interactive_mode || Capistrano::CLI.ui.agree("Do you really want to migrate #{symfony_env_prod}'s database back to version #{currentVersion}? (y/N)")
79
- run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:migrate #{currentVersion} --env=#{symfony_env_prod} --no-interaction"
78
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:migrate #{currentVersion} --env=#{symfony_env_prod} --no-interaction", :once => true
80
79
  end
81
80
  }
82
81
 
83
82
  if !interactive_mode || Capistrano::CLI.ui.agree("Do you really want to migrate #{symfony_env_prod}'s database? (y/N)")
84
- run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:migrate --env=#{symfony_env_prod} --no-interaction"
83
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:migrate --env=#{symfony_env_prod} --no-interaction", :once => true
85
84
  end
86
85
  end
87
86
 
88
87
  desc "Views the status of a set of migrations"
89
- task :status do
90
- run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:status --env=#{symfony_env_prod}"
88
+ task :status, :roles => :app, :except => { :no_release => true } do
89
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:status --env=#{symfony_env_prod}", :once => true
91
90
  end
92
91
  end
93
92
 
94
93
  namespace :mongodb do
95
- namespace :schema do
96
- desc "Allows you to create databases, collections and indexes for your documents"
97
- task :create do
98
- run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:schema:create --env=#{symfony_env_prod}"
94
+ [:create, :update, :drop].each do |action|
95
+ namespace :schema do
96
+ desc "Allows you to #{action.to_s} databases, collections and indexes for your documents"
97
+ task action, :roles => :app, :except => { :no_release => true } do
98
+ pretty_print "--> Executing MongoDB schema #{action.to_s}"
99
+
100
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:schema:#{action.to_s} --env=#{symfony_env_prod}", :once => true
101
+ puts_ok
102
+ end
99
103
  end
100
104
 
101
- desc "Allows you to drop databases, collections and indexes for your documents"
102
- task :drop do
103
- run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:schema:drop --env=#{symfony_env_prod}"
105
+ namespace :indexes do
106
+ desc "Allows you to #{action.to_s} indexes *only* for your documents"
107
+ task action, :roles => :app do
108
+ pretty_print "--> Executing MongoDB indexes #{action.to_s}"
109
+
110
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:schema:#{action.to_s} --index --env=#{symfony_env_prod}", :once => true
111
+ puts_ok
112
+ end
104
113
  end
105
114
  end
106
115
  end
@@ -108,10 +117,10 @@ namespace :symfony do
108
117
 
109
118
  namespace :init do
110
119
  desc "Mounts ACL tables in the database"
111
- task :acl, :roles => :db, :only => { :primary => true } do
120
+ task :acl, :roles => :app, :except => { :no_release => true } do
112
121
  pretty_print "--> Mounting Doctrine ACL tables"
113
122
 
114
- run "cd #{latest_release} && #{php_bin} #{symfony_console} init:acl --env=#{symfony_env_prod}"
123
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} init:acl --env=#{symfony_env_prod}", :once => true
115
124
  puts_ok
116
125
  end
117
126
  end
@@ -1,26 +1,25 @@
1
1
  namespace :symfony do
2
2
  namespace :propel do
3
3
  namespace :database do
4
- desc "Creates the configured databases"
5
- task :create, :roles => :db, :only => { :primary => true } do
6
- pretty_print "--> Creating databases"
7
-
8
- run "cd #{latest_release} && #{php_bin} #{symfony_console} propel:database:create --env=#{symfony_env_prod}"
9
- puts_ok
10
- end
11
-
12
- desc "Drops the configured databases"
13
- task :drop, :roles => :db, :only => { :primary => true } do
14
- pretty_print "--> Dropping databases"
15
-
16
- run "cd #{latest_release} && #{php_bin} #{symfony_console} propel:database:drop --env=#{symfony_env_prod}"
17
- puts_ok
4
+ [:create, :drop].each do |action|
5
+ desc "#{action.to_s.capitalize}s the configured databases"
6
+ task action, :roles => :app, :except => { :no_release => true } do
7
+ case action.to_s
8
+ when "create"
9
+ pretty_print "--> Creating databases"
10
+ when "drop"
11
+ pretty_print "--> Dropping databases"
12
+ end
13
+
14
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} propel:database:#{action.to_s} --env=#{symfony_env_prod}", :once => true
15
+ puts_ok
16
+ end
18
17
  end
19
18
  end
20
19
 
21
20
  namespace :build do
22
21
  desc "Builds the Model classes"
23
- task :model do
22
+ task :model, :roles => :app, :except => { :no_release => true } do
24
23
  command = "propel:model:build"
25
24
  if /2\.0\.[0-9]+.*/ =~ symfony_version
26
25
  command = "propel:build-model"
@@ -33,7 +32,7 @@ namespace :symfony do
33
32
  end
34
33
 
35
34
  desc "Builds SQL statements"
36
- task :sql do
35
+ task :sql, :roles => :app, :except => { :no_release => true } do
37
36
  command = "propel:sql:build"
38
37
  if /2\.0\.[0-9]+.*/ =~ symfony_version
39
38
  command = "propel:build-sql"
@@ -46,7 +45,7 @@ namespace :symfony do
46
45
  end
47
46
 
48
47
  desc "Inserts SQL statements"
49
- task :sql_load, :roles => :db, :only => { :primary => true } do
48
+ task :sql_load, :roles => :app, :except => { :no_release => true } do
50
49
  command = "propel:sql:insert"
51
50
  if /2\.0\.[0-9]+.*/ =~ symfony_version
52
51
  command = "propel:insert-sql"
@@ -54,12 +53,12 @@ namespace :symfony do
54
53
 
55
54
  pretty_print "--> Inserting Propel SQL"
56
55
 
57
- run "cd #{latest_release} && #{php_bin} #{symfony_console} #{command} --force --env=#{symfony_env_prod}"
56
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} #{command} --force --env=#{symfony_env_prod}", :once => true
58
57
  puts_ok
59
58
  end
60
59
 
61
60
  desc "Builds the Model classes, SQL statements and insert SQL"
62
- task :all_and_load do
61
+ task :all_and_load, :roles => :app, :except => { :no_release => true } do
63
62
  pretty_print "--> Setting up Propel (classes, SQL)"
64
63
 
65
64
  run "cd #{latest_release} && #{php_bin} #{symfony_console} propel:build --insert-sql --env=#{symfony_env_prod}"
@@ -67,13 +66,13 @@ namespace :symfony do
67
66
  end
68
67
 
69
68
  desc "Generates ACLs models"
70
- task :acl do
69
+ task :acl, :roles => :app, :except => { :no_release => true } do
71
70
  run "cd #{latest_release} && #{php_bin} #{symfony_console} propel:acl:init --env=#{symfony_env_prod}"
72
71
  end
73
72
 
74
73
  desc "Inserts propel ACL tables"
75
- task :acl_load, :roles => :db, :only => { :primary => true } do
76
- run "cd #{latest_release} && #{php_bin} #{symfony_console} propel:acl:init --env=#{symfony_env_prod} --force"
74
+ task :acl_load, :roles => :app, :except => { :no_release => true } do
75
+ run "cd #{latest_release} && #{php_bin} #{symfony_console} propel:acl:init --env=#{symfony_env_prod} --force", :once => true
77
76
  end
78
77
  end
79
78
  end
@@ -1,6 +1,6 @@
1
1
  namespace :symfony do
2
2
  desc "Runs custom symfony command"
3
- task :default do
3
+ task :default, :roles => :app, :except => { :no_release => true } do
4
4
  prompt_with_default(:task_arguments, "cache:clear")
5
5
 
6
6
  stream "cd #{latest_release} && #{php_bin} #{symfony_console} #{task_arguments} --env=#{symfony_env_prod}"
@@ -8,12 +8,12 @@ namespace :symfony do
8
8
 
9
9
  namespace :assets do
10
10
  desc "Updates assets version (in config.yml)"
11
- task :update_version, :except => { :no_release => true } do
12
- run "sed -i 's/\\(assets_version: \\)\\(.*\\)$/\\1 #{real_revision}/g' #{latest_release}/app/config/config.yml"
11
+ task :update_version, :roles => :app, :except => { :no_release => true } do
12
+ run "sed -i 's/\\(assets_version: \\)\\(.*\\)$/\\1 #{real_revision}/g' #{latest_release}/#{app_path}/config/config.yml"
13
13
  end
14
14
 
15
15
  desc "Installs bundle's assets"
16
- task :install, :except => { :no_release => true } do
16
+ task :install, :roles => :app, :except => { :no_release => true } do
17
17
  pretty_print "--> Installing bundle's assets"
18
18
 
19
19
  run "cd #{latest_release} && #{php_bin} #{symfony_console} assets:install #{web_path} --env=#{symfony_env_prod}"
@@ -23,7 +23,7 @@ namespace :symfony do
23
23
 
24
24
  namespace :assetic do
25
25
  desc "Dumps all assets to the filesystem"
26
- task :dump, :except => { :no_release => true } do
26
+ task :dump, :roles => :app, :except => { :no_release => true } do
27
27
  pretty_print "--> Dumping all assets to the filesystem"
28
28
 
29
29
  run "cd #{latest_release} && #{php_bin} #{symfony_console} assetic:dump --env=#{symfony_env_prod} --no-debug"
@@ -33,7 +33,7 @@ namespace :symfony do
33
33
 
34
34
  namespace :vendors do
35
35
  desc "Runs the bin/vendors script to install the vendors (fast if already installed)"
36
- task :install, :except => { :no_release => true } do
36
+ task :install, :roles => :app, :except => { :no_release => true } do
37
37
  pretty_print "--> Installing vendors"
38
38
 
39
39
  run "cd #{latest_release} && #{php_bin} #{symfony_vendors} install"
@@ -41,7 +41,7 @@ namespace :symfony do
41
41
  end
42
42
 
43
43
  desc "Runs the bin/vendors script to reinstall the vendors"
44
- task :reinstall, :except => { :no_release => true } do
44
+ task :reinstall, :roles => :app, :except => { :no_release => true } do
45
45
  pretty_print "--> Reinstalling vendors"
46
46
 
47
47
  run "cd #{latest_release} && #{php_bin} #{symfony_vendors} install --reinstall"
@@ -49,7 +49,7 @@ namespace :symfony do
49
49
  end
50
50
 
51
51
  desc "Runs the bin/vendors script to upgrade the vendors"
52
- task :upgrade, :except => { :no_release => true } do
52
+ task :upgrade, :roles => :app, :except => { :no_release => true } do
53
53
  pretty_print "--> Upgrading vendors"
54
54
 
55
55
  run "cd #{latest_release} && #{php_bin} #{symfony_vendors} update"
@@ -59,11 +59,11 @@ namespace :symfony do
59
59
 
60
60
  namespace :bootstrap do
61
61
  desc "Runs the bin/build_bootstrap script"
62
- task :build, :except => { :no_release => true } do
62
+ task :build, :roles => :app, :except => { :no_release => true } do
63
63
  pretty_print "--> Building bootstrap file"
64
64
 
65
65
  if !remote_file_exists?("#{latest_release}/#{build_bootstrap}") && true == use_composer then
66
- build_bootstrap = "vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php"
66
+ set :build_bootstrap, "vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php"
67
67
  run "cd #{latest_release} && test -f #{build_bootstrap} && #{php_bin} #{build_bootstrap} #{app_path} || echo '#{build_bootstrap} not found, skipped'"
68
68
  else
69
69
  run "cd #{latest_release} && test -f #{build_bootstrap} && #{php_bin} #{build_bootstrap} || echo '#{build_bootstrap} not found, skipped'"
@@ -75,15 +75,22 @@ namespace :symfony do
75
75
 
76
76
  namespace :composer do
77
77
  desc "Gets composer and installs it"
78
- task :get, :except => { :no_release => true } do
78
+ task :get, :roles => :app, :except => { :no_release => true } do
79
+ if remote_command_exists?('composer')
80
+ pretty_print "--> Updating Composer in PATH"
81
+
82
+ run "composer self-update"
83
+ else
79
84
  pretty_print "--> Downloading Composer"
80
85
 
81
86
  run "cd #{latest_release} && curl -s http://getcomposer.org/installer | #{php_bin}"
82
- puts_ok
87
+ end
88
+
89
+ puts_ok
83
90
  end
84
91
 
85
92
  desc "Runs composer to install vendors from composer.lock file"
86
- task :install, :except => { :no_release => true } do
93
+ task :install, :roles => :app, :except => { :no_release => true } do
87
94
  if !remote_file_exists?("#{latest_release}/composer.phar")
88
95
  symfony.composer.get
89
96
  end
@@ -95,7 +102,7 @@ namespace :symfony do
95
102
  end
96
103
 
97
104
  desc "Runs composer to update vendors, and composer.lock file"
98
- task :update, :except => { :no_release => true } do
105
+ task :update, :roles => :app, :except => { :no_release => true } do
99
106
  if !remote_file_exists?("#{latest_release}/composer.phar")
100
107
  symfony.composer.get
101
108
  end
@@ -109,7 +116,7 @@ namespace :symfony do
109
116
 
110
117
  namespace :cache do
111
118
  desc "Clears cache"
112
- task :clear, :except => { :no_release => true } do
119
+ task :clear, :roles => :app, :except => { :no_release => true } do
113
120
  pretty_print "--> Clearing cache"
114
121
 
115
122
  run "cd #{latest_release} && #{php_bin} #{symfony_console} cache:clear --env=#{symfony_env_prod}"
@@ -118,7 +125,7 @@ namespace :symfony do
118
125
  end
119
126
 
120
127
  desc "Warms up an empty cache"
121
- task :warmup, :except => { :no_release => true } do
128
+ task :warmup, :roles => :app, :except => { :no_release => true } do
122
129
  pretty_print "--> Warming up cache"
123
130
 
124
131
  run "cd #{latest_release} && #{php_bin} #{symfony_console} cache:warmup --env=#{symfony_env_prod}"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capifony
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 1
9
- - 10
10
- version: 2.1.10
9
+ - 11
10
+ version: 2.1.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Konstantin Kudryashov
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-07-16 00:00:00 Z
19
+ date: 2012-07-20 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: capistrano