@@ -1,19 +1,12 @@ | |||||
div.status_bar_outer { | div.status_bar_outer { | ||||
background-color: rgba(0,0,0,0.2); | |||||
background-color: rgba(0,0,0,0.1); | |||||
border: 1px solid rgba(0,0,0,0.4); | border: 1px solid rgba(0,0,0,0.4); | ||||
height: 21px; | height: 21px; | ||||
width: 240px; | width: 240px; | ||||
} | } | ||||
div.status_bar_inner { | div.status_bar_inner { | ||||
background: #a9e4f7; /* Old browsers */ | |||||
background: -moz-linear-gradient(left, #a9e4f7 0%, #0fb4e7 100%); /* FF3.6+ */ | |||||
background: -webkit-gradient(linear, left top, right top, color-stop(0%,#a9e4f7), color-stop(100%,#0fb4e7)); /* Chrome,Safari4+ */ | |||||
background: -webkit-linear-gradient(left, #a9e4f7 0%,#0fb4e7 100%); /* Chrome10+,Safari5.1+ */ | |||||
background: -o-linear-gradient(left, #a9e4f7 0%,#0fb4e7 100%); /* Opera11.10+ */ | |||||
background: -ms-linear-gradient(left, #a9e4f7 0%,#0fb4e7 100%); /* IE10+ */ | |||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a9e4f7', endColorstr='#0fb4e7',GradientType=1 ); /* IE6-9 */ | |||||
background: linear-gradient(left, #a9e4f7 0%,#0fb4e7 100%); /* W3C */ | |||||
background: #aaf; /* Old browsers */ | |||||
height: 21px; | height: 21px; | ||||
width: 0%; | width: 0%; | ||||
} | } |
@@ -5,7 +5,7 @@ parent=parent[n];}} | |||||
wn.provide('wn.settings');wn.provide('wn.ui');wn.xmlhttp={request:function(){if(window.XMLHttpRequest) | wn.provide('wn.settings');wn.provide('wn.ui');wn.xmlhttp={request:function(){if(window.XMLHttpRequest) | ||||
return new XMLHttpRequest();else if(window.ActiveXObject) | return new XMLHttpRequest();else if(window.ActiveXObject) | ||||
return new ActiveXObject("MsXml2.XmlHttp");},complete:function(req,callback,url){if(req.status==200||req.status==304){callback(req.responseText);}else{alert(url+' request error: '+req.statusText+' ('+req.status+')');}},get:function(url,callback,args,async){if(async===null)async=true;var req=wn.xmlhttp.request();req.onreadystatechange=function(){if(req.readyState==4){wn.xmlhttp.complete(req,callback,url)}} | return new ActiveXObject("MsXml2.XmlHttp");},complete:function(req,callback,url){if(req.status==200||req.status==304){callback(req.responseText);}else{alert(url+' request error: '+req.statusText+' ('+req.status+')');}},get:function(url,callback,args,async){if(async===null)async=true;var req=wn.xmlhttp.request();req.onreadystatechange=function(){if(req.readyState==4){wn.xmlhttp.complete(req,callback,url)}} | ||||
var sep=(args.indexOf('?')==-1?'?':'&');var u=args?(url+sep+args):url;req.open('GET',u,async);req.send(null);if(!async){wn.xmlhttp.complete(req,callback,url)}}} | |||||
var sep=((args&&args.indexOf('?'))==-1)?'?':'&';var u=args?(url+sep+args):url;req.open('GET',u,async);req.send(null);if(!async){wn.xmlhttp.complete(req,callback,url)}}} | |||||
wn.versions={is_latest:function(){if(window._version_number==(localStorage?localStorage['_version_number']:null)){return true;} | wn.versions={is_latest:function(){if(window._version_number==(localStorage?localStorage['_version_number']:null)){return true;} | ||||
return false;},get_diff:function(){if(!localStorage)return;wn.xmlhttp.get('index.cgi',function(txt){r=JSON.parse(txt);if(r.exc){alert(r.exc);} | return false;},get_diff:function(){if(!localStorage)return;wn.xmlhttp.get('index.cgi',function(txt){r=JSON.parse(txt);if(r.exc){alert(r.exc);} | ||||
wn.versions.set(r.message);},'cmd=get_diff&version_number='+localStorage['_version_number'],false);},set:function(diff){for(var i=0;i<diff.length;i++){localStorage.removeItem(diff[i]);} | wn.versions.set(r.message);},'cmd=get_diff&version_number='+localStorage['_version_number'],false);},set:function(diff){for(var i=0;i<diff.length;i++){localStorage.removeItem(diff[i]);} | ||||
@@ -27,7 +27,7 @@ wn.xmlhttp = { | |||||
} | } | ||||
// separator can be & or ? | // separator can be & or ? | ||||
// based on if there are already arguments | // based on if there are already arguments | ||||
var sep = (args.indexOf('?')==-1 ? '?' : '&'); | |||||
var sep = ((args && args.indexOf('?'))==-1) ? '?' : '&'; | |||||
// add arguments to url | // add arguments to url | ||||
var u = args ? (url + sep + args) : url; | var u = args ? (url + sep + args) : url; | ||||
@@ -2,7 +2,7 @@ verbose = True | |||||
force_rebuild = False | force_rebuild = False | ||||
no_minify = False | no_minify = False | ||||
def run(path): | |||||
def run(): | |||||
""" | """ | ||||
Run the builder | Run the builder | ||||
""" | """ | ||||
@@ -12,7 +12,7 @@ def run(path): | |||||
from build.project import Project | from build.project import Project | ||||
verbose = True | verbose = True | ||||
Project().build(path) | |||||
Project().build() | |||||
if __name__=='__main__': | if __name__=='__main__': | ||||
run() | run() |
@@ -10,7 +10,7 @@ class Project: | |||||
assets/js/core.min.js | assets/js/core.min.js | ||||
assets/timestamps.json | assets/timestamps.json | ||||
""" | """ | ||||
def __init__(self,): | |||||
def __init__(self): | |||||
""" | """ | ||||
load libraries | load libraries | ||||
""" | """ | ||||
@@ -69,18 +69,18 @@ class Project: | |||||
print "Rendered %s | %.2fkb" % (fpath, os.path.getsize(fpath) / 1024.0) | print "Rendered %s | %.2fkb" % (fpath, os.path.getsize(fpath) / 1024.0) | ||||
def build(self, root_path): | |||||
def build(self): | |||||
""" | """ | ||||
Build all js files, index.html and template.html | Build all js files, index.html and template.html | ||||
""" | """ | ||||
from build.version import VersionControl | from build.version import VersionControl | ||||
self.vc = VersionControl(root_path) | |||||
self.vc = VersionControl() | |||||
self.vc.add_all() | self.vc.add_all() | ||||
# index, template if framework is dirty | # index, template if framework is dirty | ||||
if self.vc.repo.uncommitted(): | if self.vc.repo.uncommitted(): | ||||
self.bundle.bundle(self.vc) | |||||
self.bundle.bundle(self.vc) | |||||
self.render_templates() | self.render_templates() | ||||
# again add all bundles | # again add all bundles | ||||
@@ -1,3 +1,6 @@ | |||||
## DEPRECATED | |||||
class Timestamps: | class Timestamps: | ||||
""" | """ | ||||
Build / manage json timestamp files | Build / manage json timestamp files | ||||
@@ -366,13 +366,8 @@ class Repository: | |||||
def commit(self, version=None): | def commit(self, version=None): | ||||
""" | """ | ||||
rebuild bundles if necessary | |||||
copy uncommitted files to repository, update the log and add the change | copy uncommitted files to repository, update the log and add the change | ||||
""" | """ | ||||
# make bundles | |||||
from bundle import Bundle | |||||
Bundle().bundle(self.vc) | |||||
# get a new version number | # get a new version number | ||||
if not version: version = self.new_version() | if not version: version = self.new_version() | ||||
@@ -270,10 +270,13 @@ class _DocType: | |||||
from webnotes.model.code import get_custom_script | from webnotes.model.code import get_custom_script | ||||
custom = get_custom_script(doc.name, 'Client') or '' | custom = get_custom_script(doc.name, 'Client') or '' | ||||
doc.fields['__client_script'] = \ | |||||
doc.fields['__js'] = \ | |||||
Module(doc.module).get_doc_file('doctype', doc.name, '.js').read() \ | Module(doc.module).get_doc_file('doctype', doc.name, '.js').read() \ | ||||
+ '\n' + custom | + '\n' + custom | ||||
doc.fields['__css'] = \ | |||||
Module(doc.module).get_doc_file('doctype', doc.name, '.css').read() | |||||
self._load_select_options(doclist) | self._load_select_options(doclist) | ||||
self._clear_code(doclist) | self._clear_code(doclist) | ||||
@@ -337,5 +337,6 @@ class JsModuleFile(ModuleFile): | |||||
p = re.compile('\$import\( (?P<name> [^)]*) \)', re.VERBOSE) | p = re.compile('\$import\( (?P<name> [^)]*) \)', re.VERBOSE) | ||||
code = p.sub(self.get_js, code) | code = p.sub(self.get_js, code) | ||||
return code | |||||
return code | |||||
@@ -5,15 +5,22 @@ import os, sys | |||||
from py.build import version | from py.build import version | ||||
version.verbose = True | version.verbose = True | ||||
def print_help(): | |||||
print "wnframework version control utility" | |||||
print "Usage:" | |||||
print "python lib/wnf.py build : scan all folders and commit versions with latest changes" | |||||
print "python lib/wnf.py setup : setup the local system (from master or fresh)" | |||||
print "python lib/wnf.py merge [local|master] : merge from source (master or local)" | |||||
print "python lib/wnf.py log : list last 10 commits" | |||||
def run(): | def run(): | ||||
sys.path.append('lib') | sys.path.append('lib') | ||||
sys.path.append('lib/py') | sys.path.append('lib/py') | ||||
if len(sys.argv)<2: | if len(sys.argv)<2: | ||||
print "wnframework version control utility" | |||||
print "Usage: wnf build|add|commit|diff|merge|setup" | |||||
print_help() | |||||
return | |||||
cmd = sys.argv[1] | cmd = sys.argv[1] | ||||
@@ -24,7 +31,7 @@ def run(): | |||||
vc = version.VersionControl() | vc = version.VersionControl() | ||||
print 'version %s' % vc.repo.get_value('last_version_number') | print 'version %s' % vc.repo.get_value('last_version_number') | ||||
if cmd=='merge': | |||||
elif cmd=='merge': | |||||
vc = version.VersionControl() | vc = version.VersionControl() | ||||
vc.setup_master() | vc.setup_master() | ||||
if sys.argv[2]=='local': | if sys.argv[2]=='local': | ||||
@@ -36,30 +43,45 @@ def run(): | |||||
print "help: parameter (local or master) is the source" | print "help: parameter (local or master) is the source" | ||||
vc.close() | vc.close() | ||||
if cmd=='setup': | |||||
vc = version.VersionControl() | |||||
vc.repo.setup() | |||||
vc.close() | |||||
elif cmd=='setup': | |||||
if not os.path.exists('versions-local.db'): | |||||
if os.path.exists('versions-master.db'): | |||||
import shutil | |||||
shutil.copyfile('versions-master.db', 'versions-local.db') | |||||
print "created versions-local.db from versions-master.db" | |||||
else: | |||||
vc = version.VersionControl() | |||||
vc.repo.setup() | |||||
vc.close() | |||||
print "created fresh versions-local.db" | |||||
else: | |||||
if len(sys.argv)==3 and sys.argv[2]=='master': | |||||
import shutil | |||||
shutil.copyfile('versions-local.db', 'versions-master.db') | |||||
print "created versions-master.db from versions-local.db" | |||||
else: | |||||
print "versions-local.db already exists. Nothing to do." | |||||
if cmd=='clear_startup': | |||||
elif cmd=='clear_startup': | |||||
# experimental | |||||
from webnotes import startup | from webnotes import startup | ||||
startup.clear_info('all') | startup.clear_info('all') | ||||
vc = version.VersionControl() | vc = version.VersionControl() | ||||
print 'version %s' % vc.repo.get_value('last_version_number') | print 'version %s' % vc.repo.get_value('last_version_number') | ||||
if cmd=='log': | |||||
elif cmd=='log': | |||||
vc = version.VersionControl() | vc = version.VersionControl() | ||||
for l in vc.repo.sql("select * from log order by rowid desc limit 10 ", as_dict =1): | for l in vc.repo.sql("select * from log order by rowid desc limit 10 ", as_dict =1): | ||||
print 'file:'+ l['fname'] + ' | version: ' + l['version'] | print 'file:'+ l['fname'] + ' | version: ' + l['version'] | ||||
print 'version %s' % vc.repo.get_value('last_version_number') | print 'version %s' % vc.repo.get_value('last_version_number') | ||||
vc.close() | vc.close() | ||||
if cmd=='files': | |||||
elif cmd=='files': | |||||
vc = version.VersionControl() | vc = version.VersionControl() | ||||
for f in vc.repo.sql("select fname from files where fname like ?", ((sys.argv[2] + '%'),)): | for f in vc.repo.sql("select fname from files where fname like ?", ((sys.argv[2] + '%'),)): | ||||
print f[0] | print f[0] | ||||
vc.close() | vc.close() | ||||
if __name__=='__main__': | if __name__=='__main__': | ||||
run() | run() |