capifony 2.0.1 → 2.0.2

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,7 @@
1
+ == 2.0.2 / April 6, 2011
2
+
3
+ * db migration task refactoring (thanks @schmittjoh)
4
+
1
5
  == 2.0.1 / March 30, 2011
2
6
 
3
7
  * fixed wrong assetic command
File without changes
@@ -68,7 +68,34 @@ namespace :deploy do
68
68
 
69
69
  desc "Migrate Symfony2 Doctrine ORM database."
70
70
  task :migrate do
71
- symfony.doctrine.migrations.migrate
71
+ currentVersion = nil
72
+ run "#{php-bin} #{app-path}/console doctrine:migrations:status" do |ch, stream, out|
73
+ if stream == :out and out =~ /Current Version:[^$]+\(([0-9]+)\)/
74
+ currentVersion = Regexp.last_match(1)
75
+ end
76
+ if stream == :out and out =~ /Current Version:\s*0\s*$/
77
+ currentVersion = 0
78
+ end
79
+ end
80
+
81
+ if currentVersion == nil
82
+ raise "Could not find current database migration version"
83
+ end
84
+ puts "Current database version #{currentVersion}"
85
+
86
+ on_rollback {
87
+ run "#{php-bin} #{app-path}/console doctrine:migrations:migrate #{currentVersion}" do |ch, stream, out|
88
+ if out =~ /Are you sure you wish to continue/
89
+ ch.send_data("y\r\n")
90
+ end
91
+ end
92
+ }
93
+
94
+ run "#{php-bin} #{app-path}/console doctrine:migrations:migrate" do |ch, stream, out|
95
+ if out =~ /Are you sure you wish to continue/
96
+ ch.send_data("y\r\n")
97
+ end
98
+ end
72
99
  end
73
100
  end
74
101
 
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: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 1
10
- version: 2.0.1
9
+ - 2
10
+ version: 2.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Konstantin Kudryashov
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-30 00:00:00 +03:00
18
+ date: 2011-04-06 00:00:00 +03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -47,7 +47,7 @@ files:
47
47
  - lib/capifony.rb
48
48
  - lib/symfony1.rb
49
49
  - lib/symfony2.rb
50
- - README
50
+ - README.md
51
51
  - LICENSE
52
52
  - CHANGELOG
53
53
  has_rdoc: true