This repository has been archived by the owner on Jul 13, 2024. It is now read-only.
forked from playframework/play1
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[playframework#407] Add play evolutions:* commands
- Loading branch information
1 parent
5d8d987
commit 70b04b2
Showing
3 changed files
with
213 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import os, os.path | ||
import shutil | ||
import urllib, urllib2 | ||
import subprocess | ||
import simplejson as json | ||
|
||
from play.utils import * | ||
|
||
COMMANDS = ['evolutions','ev', 'evolutions:apply', 'ev:apply', 'evolutions:markApplied', 'ev:markApplied', 'evolutions:resolve', 'ev:resolve'] | ||
|
||
HELP = { | ||
'evolutions': 'Run the evolution check', | ||
'evolutions:apply': 'Automatically apply pending evolutions', | ||
'evolutions:markApplied': 'Mark pending evolutions as manually applied', | ||
'evolutions:resolve': 'Resolve partially applied evolution' | ||
} | ||
|
||
def execute(**kargs): | ||
|
||
args = kargs.get("args") | ||
play_env = kargs.get("env") | ||
|
||
command = kargs.get("command") | ||
app = kargs.get("app") | ||
args = kargs.get("args") | ||
play_env = kargs.get("env") | ||
|
||
|
||
if command.find(':resolve') > 0: | ||
args.append('-Dmode=resolve') | ||
|
||
if command.find(':apply') > 0: | ||
args.append('-Dmode=apply') | ||
|
||
if command.find(':markApplied') > 0: | ||
args.append('-Dmode=markApplied') | ||
|
||
classpath = app.getClasspath() | ||
|
||
add_options = ['-Dapplication.path=%s' % (app.path), '-Dframework.path=%s' % (play_env['basedir']), '-Dplay.id=%s' % play_env['id'], '-Dplay.version=%s' % play_env['version']] | ||
if args.count('--jpda'): | ||
print "~ Waiting for JPDA client to continue" | ||
add_options.extend(['-Xdebug', '-Xrunjdwp:transport=dt_socket,address=8888,server=y,suspend=y']) | ||
for arg in args: | ||
if arg.startswith("-D"): | ||
add_options.append(arg) | ||
|
||
java_cmd = [app.java_path()] + add_options + ['-classpath', app.cp_args(), 'play.db.Evolutions'] | ||
|
||
subprocess.call(java_cmd, env=os.environ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters