forked from rsuniev/play-scalate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommands.py
More file actions
50 lines (41 loc) · 1.92 KB
/
commands.py
File metadata and controls
50 lines (41 loc) · 1.92 KB
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
# Scala
import sys,os,inspect,subprocess
from play.utils import *
MODULE = 'scalate'
COMMANDS = []
def execute(**kargs):
command = kargs.get("command")
app = kargs.get("app")
args = kargs.get("args")
env = kargs.get("env")
# ~~~~~~~~~~~~~~~~~~~~~~ New
def after(**kargs):
command = kargs.get("command")
app = kargs.get("app")
args = kargs.get("args")
env = kargs.get("env")
if command == 'new':
module_dir = inspect.getfile(inspect.currentframe()).replace("commands.py","")
shutil.copyfile(os.path.join(module_dir,'resources/Application.scala'), os.path.join(app.path, 'app/controllers/Application.scala'))
shutil.copyfile(os.path.join(module_dir,'resources/Model.scala'), os.path.join(app.path, 'app/models/Model.scala'))
shutil.copyfile(os.path.join(module_dir,'resources/index.ssp'), os.path.join(app.path, 'app/views/Application/index.ssp'))
shutil.copyfile(os.path.join(module_dir,'resources/default.ssp'), os.path.join(app.path, 'app/views/default.ssp'))
shutil.copyfile(os.path.join(module_dir,'resources/500.scaml'), os.path.join(app.path, 'app/views/errors/500.scaml'))
shutil.copyfile(os.path.join(module_dir,'resources/500.css'), os.path.join(app.path, 'public/stylesheets/500.css'))
f = open(os.path.join(app.path, 'conf/application.conf'),'a')
f.write('\n\n#scalate config\nscalate=ssp\njvm.memory=-Xmx256M -Xms32M')
f.close()
os.remove(os.path.join(app.path, 'app/views/Application/index.html'))
os.remove(os.path.join(app.path, 'app/views/main.html'))
def before(**kargs):
command = kargs.get("command")
app = kargs.get("app")
args = kargs.get("args")
env = kargs.get("env")
if command == 'precompile':
app.check()
java_cmd = app.java_cmd(args)
for arg in java_cmd:
if(arg.find("-Xmx")==0):
return
java_cmd.insert(2, '-Xmx256M')