-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcommands.py
59 lines (49 loc) · 2.54 KB
/
commands.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Here you can create play commands that are specific to the module, and extend existing commands
import os, os.path
import sys
import subprocess
MODULE = 'scalagen'
# Commands that are specific to your module
COMMANDS = ['scalagen:generate', 'scalagen:g', 'scalagen:jquery', 'scalagen:j']
def execute(**kargs):
command = kargs.get("command")
app = kargs.get("app")
args = kargs.get("args")
env = kargs.get("env")
if command in ("scalagen:generate", "scalagen:g"):
print "~ Generating code"
print "~ "
java_cmd = app.java_cmd([], None, "play.modules.scalagen.Generator", args)
try:
subprocess.call(java_cmd, env=os.environ)
except OSError:
print "Could not execute the java executable, please make sure the JAVA_HOME environment variable is set properly (the java executable should reside at JAVA_HOME/bin/java). "
sys.exit(-1)
print
if command in ("scalagen:jquery", "scalagen:j"):
app.override('app/views/main.scala.html', 'app/views/main.scala.html')
app.override('public/stylesheets/jqgrid.css', 'public/stylesheets/jqgrid.css')
app.override('public/stylesheets/main.css', 'public/stylesheets/main.css')
app.override('public/javascripts/jquery-1.5.2.min.js', 'public/javascripts/jquery-1.5.2.min.js')
app.override('public/javascripts/jquery-ui-1.8.1.custom.min.js', 'public/javascripts/jquery-ui-1.8.1.custom.min.js')
app.override('public/javascripts/jquery.custom.format.js', 'public/javascripts/jquery.custom.format.js')
app.override('public/javascripts/jquery.jqGrid.min.js', 'public/javascripts/jquery.jqGrid.min.js')
app.override('public/javascripts/jquery.layout.js', 'public/javascripts/jquery.layout.js')
app.override('public/javascripts/i18n/grid.locale-en.js', 'public/javascripts/i18n/grid.locale-en.js')
app.override('public/images/ui-icons_217bc0_256x240.png', 'public/images/ui-icons_217bc0_256x240.png')
app.override('public/images/ui-icons_469bdd_256x240.png', 'public/images/ui-icons_469bdd_256x240.png')
print "~~~~~ Copied JQuery files"
# This will be executed before any command (new, run...)
def before(**kargs):
command = kargs.get("command")
app = kargs.get("app")
args = kargs.get("args")
env = kargs.get("env")
# This will be executed after any command (new, run...)
def after(**kargs):
command = kargs.get("command")
app = kargs.get("app")
args = kargs.get("args")
env = kargs.get("env")
if command == "new":
pass