capifony 2.2.8 → 2.2.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,17 @@
1
+ ### 2.2.9 / May 6, 2013
2
+
3
+ * Change setfacl call to match Symfony2 permission granting instructions
4
+ * Fixed default deploy.rb (refs #354)
5
+ * Add 'symfony_debug' setting to toggle --no-debug on console commands
6
+ * Add test for #362
7
+ * Use capistrano-maintenance 0.0.3
8
+ * Added custom assets:install path
9
+ * update specs
10
+ * Dump Assetic files to latest release directory
11
+ * add unit test for doctrine_clear_use_flush_option
12
+ * remove inline condition
13
+ * add use of flush option in doctrine:clear_* task
14
+
1
15
  ### 2.2.8 / March 5, 2013
2
16
 
3
17
  * Remove the ability to copy of Composer
@@ -5,7 +5,7 @@ require 'fileutils'
5
5
 
6
6
  symfony_version = nil
7
7
  symfony_app_path = 'app'
8
- capifony_version = '2.2.8'
8
+ capifony_version = '2.2.9'
9
9
 
10
10
  OptionParser.new do |opts|
11
11
  opts.banner = "Usage: #{File.basename($0)} [path]"
@@ -78,8 +78,7 @@ if symfony_version == 2
78
78
  # Or: `propel`
79
79
 
80
80
  role :web, domain # Your HTTP server, Apache/etc
81
- role :app, domain # This may be the same as your `Web` server
82
- role :db, domain, :primary => true # This is where Symfony2 migrations will run
81
+ role :app, domain, :primary => true # This may be the same as your `Web` server
83
82
 
84
83
  set :keep_releases, 3
85
84
 
@@ -106,8 +105,7 @@ set :scm, :git
106
105
  # Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `perforce`, or `none`
107
106
 
108
107
  role :web, domain # Your HTTP server, Apache/etc
109
- role :app, domain # This may be the same as your `Web` server
110
- role :db, domain, :primary => true # This is where symfony migrations will run
108
+ role :app, domain, :primary => true # This may be the same as your `Web` server
111
109
 
112
110
  set :keep_releases, 3'
113
111
  }
@@ -29,6 +29,9 @@ module Capifony
29
29
 
30
30
  # Symfony console bin
31
31
  set :symfony_console, app_path + "/console"
32
+
33
+ # Symfony debug flag for console commands
34
+ set :symfony_debug, false
32
35
 
33
36
  # Symfony log path
34
37
  set :log_path, app_path + "/logs"
@@ -78,6 +81,7 @@ module Capifony
78
81
  set :assets_install, true
79
82
  set :assets_symlinks, false
80
83
  set :assets_relative, false
84
+ set :assets_install_path, web_path
81
85
 
82
86
  # Whether to update `assets_version` in `config.yml`
83
87
  set :update_assets_version, false
@@ -114,6 +118,9 @@ module Capifony
114
118
 
115
119
  # Doctrine custom entity manager
116
120
  set :doctrine_em, false
121
+
122
+ # Use --flush option in doctrine:clear_* task
123
+ set :doctrine_clear_use_flush_option, false
117
124
 
118
125
  # Symfony2 version
119
126
  set(:symfony_version) { guess_symfony_version }
@@ -145,6 +152,16 @@ module Capifony
145
152
  def remote_command_exists?(command)
146
153
  'true' == capture("if [ -x \"$(which #{command})\" ]; then echo 'true'; fi").strip
147
154
  end
155
+
156
+ def console_options
157
+ console_options = "--env=#{symfony_env_prod}"
158
+
159
+ if !symfony_debug
160
+ console_options += " --no-debug"
161
+ end
162
+
163
+ return console_options
164
+ end
148
165
 
149
166
  STDOUT.sync
150
167
  $error = false
@@ -24,7 +24,7 @@ namespace :deploy do
24
24
  "chmod +a \"#{webserver_user} allow delete,write,append,file_inherit,directory_inherit\" %s"
25
25
  ],
26
26
  :acl => [
27
- "setfacl -R -m u:#{user}:rwx -m u:#{webserver_user}:rwx %s",
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
30
  :chown => ["chown #{webserver_user} %s"]
@@ -5,7 +5,13 @@ namespace :symfony do
5
5
  task :clear_metadata, :roles => :app, :except => { :no_release => true } do
6
6
  capifony_pretty_print "--> Clearing Doctrine metadata cache"
7
7
 
8
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-metadata --env=#{symfony_env_prod}#{doctrine_em_flag}'"
8
+ if doctrine_clear_use_flush_option
9
+ flush_option = " --flush"
10
+ else
11
+ flush_option = ""
12
+ end
13
+
14
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-metadata #{console_options}#{doctrine_em_flag}#{flush_option}'"
9
15
  capifony_puts_ok
10
16
  end
11
17
 
@@ -13,7 +19,13 @@ namespace :symfony do
13
19
  task :clear_query, :roles => :app, :except => { :no_release => true } do
14
20
  capifony_pretty_print "--> Clearing Doctrine query cache"
15
21
 
16
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-query --env=#{symfony_env_prod}#{doctrine_em_flag}'"
22
+ if doctrine_clear_use_flush_option
23
+ flush_option = " --flush"
24
+ else
25
+ flush_option = ""
26
+ end
27
+
28
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-query #{console_options}#{doctrine_em_flag}#{flush_option}'"
17
29
  capifony_puts_ok
18
30
  end
19
31
 
@@ -21,7 +33,13 @@ namespace :symfony do
21
33
  task :clear_result, :roles => :app, :except => { :no_release => true } do
22
34
  capifony_pretty_print "--> Clearing Doctrine result cache"
23
35
 
24
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-result --env=#{symfony_env_prod}#{doctrine_em_flag}'"
36
+ if doctrine_clear_use_flush_option
37
+ flush_option = " --flush"
38
+ else
39
+ flush_option = ""
40
+ end
41
+
42
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-result #{console_options}#{doctrine_em_flag}#{flush_option}'"
25
43
  capifony_puts_ok
26
44
  end
27
45
  end
@@ -32,7 +50,7 @@ namespace :symfony do
32
50
  capifony_pretty_print "--> Dropping databases"
33
51
 
34
52
  if !interactive_mode || Capistrano::CLI.ui.agree("Do you really want to drop #{symfony_env_prod}'s database? (y/N)")
35
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:database:drop --force --env=#{symfony_env_prod}'", :once => true
53
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:database:drop --force #{console_options}'", :once => true
36
54
  end
37
55
  capifony_puts_ok
38
56
  end
@@ -41,7 +59,7 @@ namespace :symfony do
41
59
  task :create, :roles => :app, :except => { :no_release => true } do
42
60
  capifony_pretty_print "--> Creating databases"
43
61
 
44
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:database:create --env=#{symfony_env_prod}'", :once => true
62
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:database:create #{console_options}'", :once => true
45
63
  capifony_puts_ok
46
64
  end
47
65
  end
@@ -51,7 +69,7 @@ namespace :symfony do
51
69
  task :create, :roles => :app, :except => { :no_release => true } do
52
70
  capifony_pretty_print "--> Creating schema"
53
71
 
54
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:create --env=#{symfony_env_prod}#{doctrine_em_flag}'", :once => true
72
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:create #{console_options}#{doctrine_em_flag}'", :once => true
55
73
  capifony_puts_ok
56
74
  end
57
75
 
@@ -60,7 +78,7 @@ namespace :symfony do
60
78
  capifony_pretty_print "--> Droping schema"
61
79
 
62
80
  if !interactive_mode || Capistrano::CLI.ui.agree("Do you really want to drop #{symfony_env_prod}'s database schema? (y/N)")
63
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:drop --force --env=#{symfony_env_prod}#{doctrine_em_flag}'", :once => true
81
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:drop --force #{console_options}#{doctrine_em_flag}'", :once => true
64
82
  end
65
83
  capifony_puts_ok
66
84
  end
@@ -69,21 +87,21 @@ namespace :symfony do
69
87
  task :update, :roles => :app, :except => { :no_release => true } do
70
88
  capifony_pretty_print "--> Updating schema"
71
89
 
72
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:update --force --env=#{symfony_env_prod}#{doctrine_em_flag}'", :once => true
90
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:update --force #{console_options}#{doctrine_em_flag}'", :once => true
73
91
  capifony_puts_ok
74
92
  end
75
93
  end
76
94
 
77
95
  desc "Load data fixtures"
78
96
  task :load_fixtures, :roles => :app, :except => { :no_release => true } do
79
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:fixtures:load --env=#{symfony_env_prod}#{doctrine_em_flag}'", :once => true
97
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:fixtures:load #{console_options}#{doctrine_em_flag}'", :once => true
80
98
  end
81
99
 
82
100
  namespace :migrations do
83
101
  desc "Executes a migration to a specified version or the latest available version"
84
102
  task :migrate, :roles => :app, :only => { :primary => true }, :except => { :no_release => true } do
85
103
  currentVersion = nil
86
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} --no-ansi doctrine:migrations:status --env=#{symfony_env_prod}#{doctrine_em_flag}'", :once => true do |ch, stream, out|
104
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} --no-ansi doctrine:migrations:status #{console_options}#{doctrine_em_flag}'", :once => true do |ch, stream, out|
87
105
  if stream == :out and out =~ /Current Version:.+\(([\w]+)\)/
88
106
  currentVersion = Regexp.last_match(1)
89
107
  end
@@ -99,18 +117,18 @@ namespace :symfony do
99
117
 
100
118
  on_rollback {
101
119
  if !interactive_mode || Capistrano::CLI.ui.agree("Do you really want to migrate #{symfony_env_prod}'s database back to version #{currentVersion}? (y/N)")
102
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:migrate #{currentVersion} --env=#{symfony_env_prod} --no-interaction#{doctrine_em_flag}'", :once => true
120
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:migrate #{currentVersion} #{console_options} --no-interaction#{doctrine_em_flag}'", :once => true
103
121
  end
104
122
  }
105
123
 
106
124
  if !interactive_mode || Capistrano::CLI.ui.agree("Do you really want to migrate #{symfony_env_prod}'s database? (y/N)")
107
- run "#{try_sudo} sh -c ' cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:migrate --env=#{symfony_env_prod} --no-interaction#{doctrine_em_flag}'", :once => true
125
+ run "#{try_sudo} sh -c ' cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:migrate #{console_options} --no-interaction#{doctrine_em_flag}'", :once => true
108
126
  end
109
127
  end
110
128
 
111
129
  desc "Views the status of a set of migrations"
112
130
  task :status, :roles => :app, :except => { :no_release => true } do
113
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:status --env=#{symfony_env_prod}#{doctrine_em_flag}'", :once => true
131
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:status #{console_options}#{doctrine_em_flag}'", :once => true
114
132
  end
115
133
  end
116
134
 
@@ -121,7 +139,7 @@ namespace :symfony do
121
139
  task action, :roles => :app, :except => { :no_release => true } do
122
140
  capifony_pretty_print "--> Executing MongoDB schema #{action.to_s}"
123
141
 
124
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:schema:#{action.to_s} --env=#{symfony_env_prod}'", :once => true
142
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:schema:#{action.to_s} #{console_options}'", :once => true
125
143
  capifony_puts_ok
126
144
  end
127
145
  end
@@ -132,7 +150,7 @@ namespace :symfony do
132
150
  task action, :roles => :app do
133
151
  capifony_pretty_print "--> Executing MongoDB indexes #{action.to_s}"
134
152
 
135
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:schema:#{action.to_s} --index --env=#{symfony_env_prod}'", :once => true
153
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:mongodb:schema:#{action.to_s} --index #{console_options}'", :once => true
136
154
  capifony_puts_ok
137
155
  end
138
156
  end
@@ -145,7 +163,7 @@ namespace :symfony do
145
163
  task :acl, :roles => :app, :except => { :no_release => true } do
146
164
  capifony_pretty_print "--> Mounting Doctrine ACL tables"
147
165
 
148
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} init:acl --env=#{symfony_env_prod}'", :once => true
166
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} init:acl #{console_options}'", :once => true
149
167
  capifony_puts_ok
150
168
  end
151
169
  end
@@ -11,7 +11,7 @@ namespace :symfony do
11
11
  capifony_pretty_print "--> Dropping databases"
12
12
  end
13
13
 
14
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} propel:database:#{action.to_s} --env=#{symfony_env_prod}'", :once => true
14
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} propel:database:#{action.to_s} #{console_options}'", :once => true
15
15
  capifony_puts_ok
16
16
  end
17
17
  end
@@ -27,7 +27,7 @@ namespace :symfony do
27
27
 
28
28
  capifony_pretty_print "--> Generating Propel classes"
29
29
 
30
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} #{command} --env=#{symfony_env_prod}'"
30
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} #{command} #{console_options}'"
31
31
  capifony_puts_ok
32
32
  end
33
33
 
@@ -40,7 +40,7 @@ namespace :symfony do
40
40
 
41
41
  capifony_pretty_print "--> Generating Propel SQL"
42
42
 
43
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} #{command} --env=#{symfony_env_prod}'"
43
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} #{command} #{console_options}'"
44
44
  capifony_puts_ok
45
45
  end
46
46
 
@@ -53,7 +53,7 @@ namespace :symfony do
53
53
 
54
54
  capifony_pretty_print "--> Inserting Propel SQL"
55
55
 
56
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} #{command} --force --env=#{symfony_env_prod}'", :once => true
56
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} #{command} --force #{console_options}'", :once => true
57
57
  capifony_puts_ok
58
58
  end
59
59
 
@@ -61,18 +61,18 @@ namespace :symfony do
61
61
  task :all_and_load, :roles => :app, :except => { :no_release => true } do
62
62
  capifony_pretty_print "--> Setting up Propel (classes, SQL)"
63
63
 
64
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} propel:build --insert-sql --env=#{symfony_env_prod}'"
64
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} propel:build --insert-sql #{console_options}'"
65
65
  capifony_puts_ok
66
66
  end
67
67
 
68
68
  desc "Generates ACLs models"
69
69
  task :acl, :roles => :app, :except => { :no_release => true } do
70
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} propel:acl:init --env=#{symfony_env_prod}'"
70
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} propel:acl:init #{console_options}'"
71
71
  end
72
72
 
73
73
  desc "Inserts propel ACL tables"
74
74
  task :acl_load, :roles => :app, :except => { :no_release => true } do
75
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} propel:acl:init --env=#{symfony_env_prod} --force'", :once => true
75
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} propel:acl:init #{console_options} --force'", :once => true
76
76
  end
77
77
  end
78
78
  end
@@ -3,7 +3,7 @@ namespace :symfony do
3
3
  task :default, :roles => :app, :except => { :no_release => true } do
4
4
  prompt_with_default(:task_arguments, "cache:clear")
5
5
 
6
- stream "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} #{task_arguments} --env=#{symfony_env_prod}'"
6
+ stream "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} #{task_arguments} #{console_options}'"
7
7
  end
8
8
 
9
9
 
@@ -46,7 +46,7 @@ namespace :symfony do
46
46
  install_options += " --relative"
47
47
  end
48
48
 
49
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} assets:install #{web_path}#{install_options} --env=#{symfony_env_prod}'"
49
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} assets:install #{assets_install_path}#{install_options} #{console_options}'"
50
50
  capifony_puts_ok
51
51
  end
52
52
  end
@@ -56,7 +56,7 @@ namespace :symfony do
56
56
  task :dump, :roles => :app, :except => { :no_release => true } do
57
57
  capifony_pretty_print "--> Dumping all assets to the filesystem"
58
58
 
59
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} assetic:dump --env=#{symfony_env_prod} --no-debug'"
59
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} assetic:dump #{console_options} #{latest_release}/#{web_path}'"
60
60
  capifony_puts_ok
61
61
  end
62
62
  end
@@ -169,7 +169,7 @@ namespace :symfony do
169
169
  capifony_pretty_print "--> Warming up cache"
170
170
  end
171
171
 
172
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} cache:#{action.to_s} --env=#{symfony_env_prod}'"
172
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} cache:#{action.to_s} #{console_options}'"
173
173
  run "#{try_sudo} chmod -R g+w #{latest_release}/#{cache_path}"
174
174
  capifony_puts_ok
175
175
  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.2.8
4
+ version: 2.2.9
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-03-05 00:00:00.000000000 Z
13
+ date: 2013-06-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: capistrano
@@ -73,7 +73,7 @@ dependencies:
73
73
  requirements:
74
74
  - - '='
75
75
  - !ruby/object:Gem::Version
76
- version: 0.0.2
76
+ version: 0.0.3
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
@@ -81,7 +81,7 @@ dependencies:
81
81
  requirements:
82
82
  - - '='
83
83
  - !ruby/object:Gem::Version
84
- version: 0.0.2
84
+ version: 0.0.3
85
85
  description: ! ' Capistrano is an open source tool for running scripts on multiple
86
86
  servers. It’s primary use is for easily deploying applications. While it was built
87
87
  specifically for deploying Rails apps, it’s pretty simple to customize it to deploy