Skip to content
This repository
Browse code

Merge remote-tracking branch 'ruudk/symfony2-configurable-console-com…

…mand' (closes #19)

Conflicts:
	lib/symfony2.rb
  • Loading branch information...
commit 23650e1dd387a199fd3bc8dfb5e58c2fd992883a 2 parents dc9c158 + 11d5f7d
Konstantin Kudryashov authored

Showing 1 changed file with 27 additions and 24 deletions. Show diff stats Hide diff stats

  1. +27 24 lib/symfony2.rb
51 lib/symfony2.rb
@@ -6,6 +6,9 @@
6 6 # Symfony web path
7 7 set :web_path, "web"
8 8
  9 +# Symfony console bin
  10 +set :symfony_console, "console"
  11 +
9 12 # Use AsseticBundle
10 13 set :dump_assetic_assets, false
11 14
@@ -69,7 +72,7 @@
69 72 desc "Migrate Symfony2 Doctrine ORM database."
70 73 task :migrate do
71 74 currentVersion = nil
72   - run "#{php-bin} #{app-path}/console doctrine:migrations:status --env=#{symfony_env_prod}" do |ch, stream, out|
  75 + run "#{php-bin} #{app-path}/#{symfony_console} doctrine:migrations:status --env=#{symfony_env_prod}" do |ch, stream, out|
73 76 if stream == :out and out =~ /Current Version:[^$]+\(([0-9]+)\)/
74 77 currentVersion = Regexp.last_match(1)
75 78 end
@@ -84,14 +87,14 @@
84 87 puts "Current database version #{currentVersion}"
85 88
86 89 on_rollback {
87   - run "#{php-bin} #{app-path}/console doctrine:migrations:migrate #{currentVersion} --env=#{symfony_env_prod}" do |ch, stream, out|
  90 + run "#{php-bin} #{app-path}/#{symfony_console} doctrine:migrations:migrate #{currentVersion} --env=#{symfony_env_prod}" do |ch, stream, out|
88 91 if out =~ /Are you sure you wish to continue/
89 92 ch.send_data("y\r\n")
90 93 end
91 94 end
92 95 }
93 96
94   - run "#{php-bin} #{app-path}/console doctrine:migrations:migrate --env=#{symfony_env_prod}" do |ch, stream, out|
  97 + run "#{php-bin} #{app-path}/#{symfony_console} doctrine:migrations:migrate --env=#{symfony_env_prod}" do |ch, stream, out|
95 98 if out =~ /Are you sure you wish to continue/
96 99 ch.send_data("y\r\n")
97 100 end
@@ -104,32 +107,32 @@
104 107 task :default do
105 108 prompt_with_default(:task_arguments, "cache:clear")
106 109
107   - stream "cd #{latest_release} && #{php_bin} #{app_path}/console #{task_arguments} --env=#{symfony_env_prod}"
  110 + stream "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} #{task_arguments} --env=#{symfony_env_prod}"
108 111 end
109 112
110 113 namespace :assets do
111 114 desc "Install bundle's assets"
112 115 task :install do
113   - run "cd #{latest_release} && #{php_bin} #{app_path}/console assets:install #{web_path} --env=#{symfony_env_prod}"
  116 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} assets:install #{web_path} --env=#{symfony_env_prod}"
114 117 end
115 118 end
116 119
117 120 namespace :assetic do
118 121 desc "Dumps all assets to the filesystem"
119 122 task :dump do
120   - run "cd #{latest_release} && #{php_bin} #{app_path}/console assetic:dump #{web_path} --env=#{symfony_env_prod}"
  123 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} assetic:dump #{web_path} --env=#{symfony_env_prod}"
121 124 end
122 125 end
123 126
124 127 namespace :cache do
125 128 desc "Clears project cache."
126 129 task :clear do
127   - run "cd #{latest_release} && #{php_bin} #{app_path}/console cache:clear --env=#{symfony_env_prod}"
  130 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} cache:clear --env=#{symfony_env_prod}"
128 131 end
129 132
130 133 desc "Warms up an empty cache."
131 134 task :warmup do
132   - run "cd #{latest_release} && #{php_bin} #{app_path}/console cache:warmup --env=#{symfony_env_prod}"
  135 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} cache:warmup --env=#{symfony_env_prod}"
133 136 end
134 137 end
135 138
@@ -137,65 +140,65 @@
137 140 namespace :cache do
138 141 desc "Clear all metadata cache for a entity manager."
139 142 task :clear_metadata do
140   - run "cd #{latest_release} && #{php_bin} #{app_path}/console doctrine:cache:clear-metadata --env=#{symfony_env_prod}"
  143 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:cache:clear-metadata --env=#{symfony_env_prod}"
141 144 end
142 145
143 146 desc "Clear all query cache for a entity manager."
144 147 task :clear_query do
145   - run "cd #{latest_release} && #{php_bin} #{app_path}/console doctrine:cache:clear-query --env=#{symfony_env_prod}"
  148 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:cache:clear-query --env=#{symfony_env_prod}"
146 149 end
147 150
148 151 desc "Clear result cache for a entity manager."
149 152 task :clear_result do
150   - run "cd #{latest_release} && #{php_bin} #{app_path}/console doctrine:cache:clear-result --env=#{symfony_env_prod}"
  153 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:cache:clear-result --env=#{symfony_env_prod}"
151 154 end
152 155 end
153 156
154 157 namespace :database do
155 158 desc "Create the configured databases."
156 159 task :create do
157   - run "cd #{latest_release} && #{php_bin} #{app_path}/console doctrine:database:create --env=#{symfony_env_prod}"
  160 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:database:create --env=#{symfony_env_prod}"
158 161 end
159 162
160 163 desc "Drop the configured databases."
161 164 task :drop do
162   - run "cd #{latest_release} && #{php_bin} #{app_path}/console doctrine:database:drop --env=#{symfony_env_prod}"
  165 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:database:drop --env=#{symfony_env_prod}"
163 166 end
164 167 end
165 168
166 169 namespace :generate do
167 170 desc "Generates proxy classes for entity classes."
168 171 task :hydrators do
169   - run "cd #{latest_release} && #{php_bin} #{app_path}/console doctrine:generate:proxies --env=#{symfony_env_prod}"
  172 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:generate:proxies --env=#{symfony_env_prod}"
170 173 end
171 174
172 175 desc "Generate repository classes from your mapping information."
173 176 task :hydrators do
174   - run "cd #{latest_release} && #{php_bin} #{app_path}/console doctrine:generate:repositories --env=#{symfony_env_prod}"
  177 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:generate:repositories --env=#{symfony_env_prod}"
175 178 end
176 179 end
177 180
178 181 namespace :schema do
179 182 desc "Processes the schema and either create it directly on EntityManager Storage Connection or generate the SQL output."
180 183 task :create do
181   - run "cd #{latest_release} && #{php_bin} #{app_path}/console doctrine:schema:create --env=#{symfony_env_prod}"
  184 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:schema:create --env=#{symfony_env_prod}"
182 185 end
183 186
184 187 desc "Drop the complete database schema of EntityManager Storage Connection or generate the corresponding SQL output."
185 188 task :drop do
186   - run "cd #{latest_release} && #{php_bin} #{app_path}/console doctrine:schema:drop --env=#{symfony_env_prod}"
  189 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:schema:drop --env=#{symfony_env_prod}"
187 190 end
188 191 end
189 192
190 193 namespace :migrations do
191 194 desc "Execute a migration to a specified version or the latest available version."
192 195 task :migrate do
193   - run "cd #{latest_release} && #{php_bin} #{app_path}/console doctrine:migrations:migrate --env=#{symfony_env_prod}"
  196 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:migrations:migrate --env=#{symfony_env_prod}"
194 197 end
195 198
196 199 desc "View the status of a set of migrations."
197 200 task :status do
198   - run "cd #{latest_release} && #{php_bin} #{app_path}/console doctrine:migrations:status --env=#{symfony_env_prod}"
  201 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:migrations:status --env=#{symfony_env_prod}"
199 202 end
200 203 end
201 204
@@ -203,29 +206,29 @@
203 206 namespace :generate do
204 207 desc "Generates hydrator classes for document classes."
205 208 task :hydrators do
206   - run "cd #{latest_release} && #{php_bin} #{app_path}/console doctrine:mongodb:generate:hydrators --env=#{symfony_env_prod}"
  209 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:mongodb:generate:hydrators --env=#{symfony_env_prod}"
207 210 end
208 211
209 212 desc "Generates proxy classes for document classes."
210 213 task :hydrators do
211   - run "cd #{latest_release} && #{php_bin} #{app_path}/console doctrine:mongodb:generate:proxies --env=#{symfony_env_prod}"
  214 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:mongodb:generate:proxies --env=#{symfony_env_prod}"
212 215 end
213 216
214 217 desc "Generates repository classes for document classes."
215 218 task :hydrators do
216   - run "cd #{latest_release} && #{php_bin} #{app_path}/console doctrine:mongodb:generate:repositories --env=#{symfony_env_prod}"
  219 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:mongodb:generate:repositories --env=#{symfony_env_prod}"
217 220 end
218 221 end
219 222
220 223 namespace :schema do
221 224 desc "Allows you to create databases, collections and indexes for your documents."
222 225 task :create do
223   - run "cd #{latest_release} && #{php_bin} #{app_path}/console doctrine:mongodb:schema:create --env=#{symfony_env_prod}"
  226 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:mongodb:schema:create --env=#{symfony_env_prod}"
224 227 end
225 228
226 229 desc "Allows you to drop databases, collections and indexes for your documents."
227 230 task :drop do
228   - run "cd #{latest_release} && #{php_bin} #{app_path}/console doctrine:mongodb:schema:drop --env=#{symfony_env_prod}"
  231 + run "cd #{latest_release} && #{php_bin} #{app_path}/#{symfony_console} doctrine:mongodb:schema:drop --env=#{symfony_env_prod}"
229 232 end
230 233 end
231 234 end

0 comments on commit 23650e1

Please sign in to comment.
Something went wrong with that request. Please try again.