Browse Source

ready for merge

version-14
Rushabh Mehta 14 years ago
parent
commit
91b7cef159
10 changed files with 55 additions and 38 deletions
  1. +2
    -9
      css/ui/status_bar.css
  2. +1
    -1
      js/core.min.js
  3. +1
    -1
      js/wn/xmlhttp.js
  4. +2
    -2
      py/build/__init__.py
  5. +4
    -4
      py/build/project.py
  6. +3
    -0
      py/build/timestamps.py
  7. +0
    -5
      py/build/version.py
  8. +4
    -1
      py/webnotes/model/doctype.py
  9. +3
    -2
      py/webnotes/modules/__init__.py
  10. +35
    -13
      wnf.py

+ 2
- 9
css/ui/status_bar.css View File

@@ -1,19 +1,12 @@
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);
height: 21px;
width: 240px;
}

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;
width: 0%;
}

+ 1
- 1
js/core.min.js View File

@@ -5,7 +5,7 @@ parent=parent[n];}}
wn.provide('wn.settings');wn.provide('wn.ui');wn.xmlhttp={request:function(){if(window.XMLHttpRequest)
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)}}
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;}
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]);}


+ 1
- 1
js/wn/xmlhttp.js View File

@@ -27,7 +27,7 @@ wn.xmlhttp = {
}
// separator can be & or ?
// based on if there are already arguments
var sep = (args.indexOf('?')==-1 ? '?' : '&');
var sep = ((args && args.indexOf('?'))==-1) ? '?' : '&';
// add arguments to url
var u = args ? (url + sep + args) : url;


+ 2
- 2
py/build/__init__.py View File

@@ -2,7 +2,7 @@ verbose = True
force_rebuild = False
no_minify = False

def run(path):
def run():
"""
Run the builder
"""
@@ -12,7 +12,7 @@ def run(path):
from build.project import Project

verbose = True
Project().build(path)
Project().build()
if __name__=='__main__':
run()

+ 4
- 4
py/build/project.py View File

@@ -10,7 +10,7 @@ class Project:
assets/js/core.min.js
assets/timestamps.json
"""
def __init__(self,):
def __init__(self):
"""
load libraries
"""
@@ -69,18 +69,18 @@ class Project:
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
"""
from build.version import VersionControl
self.vc = VersionControl(root_path)
self.vc = VersionControl()
self.vc.add_all()
# index, template if framework is dirty
if self.vc.repo.uncommitted():
self.bundle.bundle(self.vc)
self.bundle.bundle(self.vc)
self.render_templates()

# again add all bundles


+ 3
- 0
py/build/timestamps.py View File

@@ -1,3 +1,6 @@
## DEPRECATED


class Timestamps:
"""
Build / manage json timestamp files


+ 0
- 5
py/build/version.py View File

@@ -366,13 +366,8 @@ class Repository:
def commit(self, version=None):
"""
rebuild bundles if necessary
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
if not version: version = self.new_version()



+ 4
- 1
py/webnotes/model/doctype.py View File

@@ -270,10 +270,13 @@ class _DocType:
from webnotes.model.code import get_custom_script
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() \
+ '\n' + custom

doc.fields['__css'] = \
Module(doc.module).get_doc_file('doctype', doc.name, '.css').read()
self._load_select_options(doclist)
self._clear_code(doclist)



+ 3
- 2
py/webnotes/modules/__init__.py View File

@@ -337,5 +337,6 @@ class JsModuleFile(ModuleFile):
p = re.compile('\$import\( (?P<name> [^)]*) \)', re.VERBOSE)

code = p.sub(self.get_js, code)
return code
return code

+ 35
- 13
wnf.py View File

@@ -5,15 +5,22 @@ import os, sys
from py.build import version
version.verbose = True


def print_help():
print "wnframework version control utility"
print
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():
sys.path.append('lib')
sys.path.append('lib/py')

if len(sys.argv)<2:
print "wnframework version control utility"
print
print "Usage: wnf build|add|commit|diff|merge|setup"
print_help()
return

cmd = sys.argv[1]

@@ -24,7 +31,7 @@ def run():
vc = version.VersionControl()
print 'version %s' % vc.repo.get_value('last_version_number')
if cmd=='merge':
elif cmd=='merge':
vc = version.VersionControl()
vc.setup_master()
if sys.argv[2]=='local':
@@ -36,30 +43,45 @@ def run():
print "help: parameter (local or master) is the source"
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
startup.clear_info('all')

vc = version.VersionControl()
print 'version %s' % vc.repo.get_value('last_version_number')
if cmd=='log':
elif cmd=='log':
vc = version.VersionControl()
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 'version %s' % vc.repo.get_value('last_version_number')
vc.close()
if cmd=='files':
elif cmd=='files':
vc = version.VersionControl()
for f in vc.repo.sql("select fname from files where fname like ?", ((sys.argv[2] + '%'),)):
print f[0]
vc.close()
if __name__=='__main__':
run()

Loading…
Cancel
Save