capifony 2.2.6 → 2.2.7

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ### 2.2.7 / February 3, 2013
2
+
3
+ * Implemented :doctrine_em configuration option (#321)
4
+ * Added :doctrine_em symbol with default value of `false`
5
+ * Added `before` hooks for relevant symfony:doctrine commands to assemble --em flag
6
+ * Added flag variable to commands being run
7
+ * Added tests for --em flag in spec file
8
+ * Updated specs for doctrine drop tasks
9
+ * Added confirmation to doctrine drops tasks
10
+ * Fixed symfony:doctrine:database:drop (missed --force argument too).
11
+ * Added confirmation for symfony:doctrine:database:drop and symfony:doctrine:schema:drop.
12
+ * Compatibility to Capistrano 2.14.1
13
+ * Fixed symfony:doctrine:schema:drop - added --force
14
+ * Task symfony:doctrine:schema:drop never actually droped schema because of missing --force parameter.
15
+
1
16
  ### 2.2.6 / January 17, 2013
2
17
 
3
18
  * Clear controllers should only run on the app role
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.6'
8
+ capifony_version = '2.2.7'
9
9
 
10
10
  OptionParser.new do |opts|
11
11
  opts.banner = "Usage: #{File.basename($0)} [path]"
@@ -112,6 +112,9 @@ module Capifony
112
112
  # Model manager: (doctrine, propel)
113
113
  set :model_manager, "doctrine"
114
114
 
115
+ # Doctrine custom entity manager
116
+ set :doctrine_em, false
117
+
115
118
  # Symfony2 version
116
119
  set(:symfony_version) { guess_symfony_version }
117
120
 
@@ -191,6 +194,22 @@ module Capifony
191
194
  end
192
195
  end
193
196
 
197
+ [
198
+ "symfony:doctrine:cache:clear_metadata",
199
+ "symfony:doctrine:cache:clear_query",
200
+ "symfony:doctrine:cache:clear_result",
201
+ "symfony:doctrine:schema:create",
202
+ "symfony:doctrine:schema:drop",
203
+ "symfony:doctrine:schema:update",
204
+ "symfony:doctrine:load_fixtures",
205
+ "symfony:doctrine:migrations:migrate",
206
+ "symfony:doctrine:migrations:status",
207
+ ].each do |action|
208
+ before action do
209
+ set :doctrine_em_flag, doctrine_em ? " --em=#{doctrine_em}" : ""
210
+ end
211
+ end
212
+
194
213
  ["symfony:composer:install", "symfony:composer:update"].each do |action|
195
214
  before action do
196
215
  if copy_vendors
@@ -5,7 +5,7 @@ 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}'"
8
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-metadata --env=#{symfony_env_prod}#{doctrine_em_flag}'"
9
9
  capifony_puts_ok
10
10
  end
11
11
 
@@ -13,7 +13,7 @@ namespace :symfony do
13
13
  task :clear_query, :roles => :app, :except => { :no_release => true } do
14
14
  capifony_pretty_print "--> Clearing Doctrine query cache"
15
15
 
16
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-query --env=#{symfony_env_prod}'"
16
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-query --env=#{symfony_env_prod}#{doctrine_em_flag}'"
17
17
  capifony_puts_ok
18
18
  end
19
19
 
@@ -21,25 +21,28 @@ namespace :symfony do
21
21
  task :clear_result, :roles => :app, :except => { :no_release => true } do
22
22
  capifony_pretty_print "--> Clearing Doctrine result cache"
23
23
 
24
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-result --env=#{symfony_env_prod}'"
24
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-result --env=#{symfony_env_prod}#{doctrine_em_flag}'"
25
25
  capifony_puts_ok
26
26
  end
27
27
  end
28
28
 
29
29
  namespace :database do
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
- capifony_pretty_print "--> Creating databases"
36
- when "drop"
37
- capifony_pretty_print "--> Dropping databases"
38
- end
30
+ desc "Drops the configured databases"
31
+ task :drop, :roles => :app, :except => { :no_release => true } do
32
+ capifony_pretty_print "--> Dropping databases"
39
33
 
40
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:database:#{action.to_s} --env=#{symfony_env_prod}'", :once => true
41
- capifony_puts_ok
34
+ 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
42
36
  end
37
+ capifony_puts_ok
38
+ end
39
+
40
+ desc "Creates the configured databases"
41
+ task :create, :roles => :app, :except => { :no_release => true } do
42
+ capifony_pretty_print "--> Creating databases"
43
+
44
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:database:create --env=#{symfony_env_prod}'", :once => true
45
+ capifony_puts_ok
43
46
  end
44
47
  end
45
48
 
@@ -48,7 +51,7 @@ namespace :symfony do
48
51
  task :create, :roles => :app, :except => { :no_release => true } do
49
52
  capifony_pretty_print "--> Creating schema"
50
53
 
51
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:create --env=#{symfony_env_prod}'", :once => true
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
52
55
  capifony_puts_ok
53
56
  end
54
57
 
@@ -56,7 +59,9 @@ namespace :symfony do
56
59
  task :drop, :roles => :app, :except => { :no_release => true } do
57
60
  capifony_pretty_print "--> Droping schema"
58
61
 
59
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:drop --env=#{symfony_env_prod}'", :once => true
62
+ 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
64
+ end
60
65
  capifony_puts_ok
61
66
  end
62
67
 
@@ -64,23 +69,21 @@ namespace :symfony do
64
69
  task :update, :roles => :app, :except => { :no_release => true } do
65
70
  capifony_pretty_print "--> Updating schema"
66
71
 
67
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:update --force --env=#{symfony_env_prod}'", :once => true
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
68
73
  capifony_puts_ok
69
74
  end
70
75
  end
71
76
 
72
- namespace :fixtures do
73
- desc "Load data fixtures"
74
- task :load, :roles => :app, :except => { :no_release => true } do
75
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:fixtures:load --env=#{symfony_env_prod}'", :once => true
76
- end
77
+ desc "Load data fixtures"
78
+ 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
77
80
  end
78
81
 
79
82
  namespace :migrations do
80
83
  desc "Executes a migration to a specified version or the latest available version"
81
84
  task :migrate, :roles => :app, :only => { :primary => true }, :except => { :no_release => true } do
82
85
  currentVersion = nil
83
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} --no-ansi doctrine:migrations:status --env=#{symfony_env_prod}'", :once => true do |ch, stream, out|
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|
84
87
  if stream == :out and out =~ /Current Version:.+\(([\w]+)\)/
85
88
  currentVersion = Regexp.last_match(1)
86
89
  end
@@ -96,18 +99,18 @@ namespace :symfony do
96
99
 
97
100
  on_rollback {
98
101
  if !interactive_mode || Capistrano::CLI.ui.agree("Do you really want to migrate #{symfony_env_prod}'s database back to version #{currentVersion}? (y/N)")
99
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:migrate #{currentVersion} --env=#{symfony_env_prod} --no-interaction'", :once => true
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
100
103
  end
101
104
  }
102
105
 
103
106
  if !interactive_mode || Capistrano::CLI.ui.agree("Do you really want to migrate #{symfony_env_prod}'s database? (y/N)")
104
- run "#{try_sudo} sh -c ' cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:migrate --env=#{symfony_env_prod} --no-interaction'", :once => true
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
105
108
  end
106
109
  end
107
110
 
108
111
  desc "Views the status of a set of migrations"
109
112
  task :status, :roles => :app, :except => { :no_release => true } do
110
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:status --env=#{symfony_env_prod}'", :once => true
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
111
114
  end
112
115
  end
113
116
 
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: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 2
9
- - 6
10
- version: 2.2.6
9
+ - 7
10
+ version: 2.2.7
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: 2013-01-16 00:00:00 Z
19
+ date: 2013-02-03 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: capistrano
@@ -24,7 +24,7 @@ dependencies:
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ~>
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  hash: 49
30
30
  segments:
@@ -32,6 +32,14 @@ dependencies:
32
32
  - 13
33
33
  - 5
34
34
  version: 2.13.5
35
+ - - <=
36
+ - !ruby/object:Gem::Version
37
+ hash: 53
38
+ segments:
39
+ - 2
40
+ - 14
41
+ - 1
42
+ version: 2.14.1
35
43
  type: :runtime
36
44
  version_requirements: *id001
37
45
  - !ruby/object:Gem::Dependency