penguin/AstroJS

Javascript framework for my blog

commit 16377e0a950c8c55f1f50b07076d824eb2e7342e

author斟酌 鵬兄 <tgckpg@gmail.com>
date2016-05-27T17:39:59Z
subjectmaking botan-start runnable alone
commit 16377e0a950c8c55f1f50b07076d824eb2e7342e
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2016-05-27T17:39:59Z

    making botan-start runnable alone
---
 botan-start.py                | 18 +++++++++---------
 botanjs/compressor/closure.py |  3 ++-
 botanjs/compressor/yui.py     |  3 ++-
 settings.ini                  |  3 +++
 4 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/botan-start.py b/botan-start.py
index bd0c3e7..81708f3 100755
--- a/botan-start.py
+++ b/botan-start.py
@@ -1,25 +1,25 @@
-#!/usr/bin/env python3
+#!env/bin/python
 
-import os, pwd, grp
+import os, sys
 from botanjs.config import Config as config, DEBUG
-
-import shutil
+from subprocess import Popen
+from botanjs.service.webapi import WebAPI
 
 SiteRoot = os.path.abspath( "." )
 
+# Setting the SiteRoot for config
 config["Paths"]["SiteRoot"] = SiteRoot;
 
 # Create the lock folder for celery
-lockDir = SiteRoot + "env/var/run/celery"
+lockDir = os.path.join( SiteRoot, "env", "var", "run" "celery" )
 
 os.makedirs( lockDir, exist_ok=True )
 
-import sys
-from subprocess import Popen
-
 sys.path.append( os.path.abspath( "." ) )
 
-from botanjs.service.webapi import WebAPI
+RUNTIME_ENV = os.path.abspath( os.path.join( "env", "bin" ) )
+if RUNTIME_ENV not in os.environ[ "PATH" ]:
+	os.environ[ "PATH" ] = RUNTIME_ENV + os.pathsep + os.environ[ "PATH" ]
 
 if __name__ == "__main__":
 
diff --git a/botanjs/compressor/closure.py b/botanjs/compressor/closure.py
index a36d87e..74468e7 100755
--- a/botanjs/compressor/closure.py
+++ b/botanjs/compressor/closure.py
@@ -2,8 +2,9 @@
 
 import os
 from tempfile import NamedTemporaryFile
+from botanjs.config import Config as config
 
-COMPILER = "/opt/utils/closure.jar"
+COMPILER = config[ "BotanJS" ][ "ClosureCompiler" ]
 
 if not os.path.isfile( COMPILER ):
 	raise Exception( "Compiler not found" )
diff --git a/botanjs/compressor/yui.py b/botanjs/compressor/yui.py
index 99341d6..b4dd0ff 100755
--- a/botanjs/compressor/yui.py
+++ b/botanjs/compressor/yui.py
@@ -1,8 +1,9 @@
 #!/usr/bin/env python3
 
 import os
+from botanjs.config import Config as config
 
-COMPILER = "/opt/utils/yuicompressor.jar"
+COMPILER = config[ "BotanJS" ][ "YuiCompressor" ]
 
 if not os.path.isfile( COMPILER ):
 	raise Exception( "Compiler not found" )
diff --git a/settings.ini b/settings.ini
index 559e1da..1568871 100644
--- a/settings.ini
+++ b/settings.ini
@@ -11,3 +11,6 @@ SrcDir = ${Paths:Runtime}/botanjs/src
 CeleryBroker = redis://:${REDIS_PASS}@123.123.123.123:1234/9
 
 REDIS_PASS = PASSWORD_FOR_REDIS_DB
+
+ClosureCompiler = /opt/utils/closure.jar
+YuiCompressor = /opt/utils/yuicompressor.jar