Build process checking for coffeescript

This commit is contained in:
Kovid Goyal 2012-01-05 20:08:48 +05:30
parent 300e9e1f99
commit c9601ae83b
3 changed files with 32 additions and 7 deletions

View File

@ -63,11 +63,14 @@ class Check(Command):
for f in x[-1]: for f in x[-1]:
y = self.j(x[0], f) y = self.j(x[0], f)
mtime = os.stat(y).st_mtime mtime = os.stat(y).st_mtime
if (f.endswith('.py') and f not in ('ptempfile.py', 'feedparser.py', if cache.get(y, 0) == mtime:
continue
if (f.endswith('.py') and f not in ('feedparser.py',
'pyparsing.py', 'markdown.py') and 'pyparsing.py', 'markdown.py') and
'genshi' not in y and cache.get(y, 0) != mtime and
'prs500/driver.py' not in y): 'prs500/driver.py' not in y):
yield y, mtime yield y, mtime
if f.endswith('.coffee'):
yield y, mtime
for x in os.walk(self.j(self.d(self.SRC), 'recipes')): for x in os.walk(self.j(self.d(self.SRC), 'recipes')):
for f in x[-1]: for f in x[-1]:
@ -84,9 +87,20 @@ class Check(Command):
builtins = list(set_builtins(self.BUILTINS)) builtins = list(set_builtins(self.BUILTINS))
for f, mtime in self.get_files(cache): for f, mtime in self.get_files(cache):
self.info('\tChecking', f) self.info('\tChecking', f)
errors = False
ext = os.path.splitext(f)[1]
if ext in {'.py', '.recipe'}:
w = check_for_python_errors(open(f, 'rb').read(), f) w = check_for_python_errors(open(f, 'rb').read(), f)
if w: if w:
errors = True
self.report_errors(w) self.report_errors(w)
else:
try:
subprocess.check_call(['coffee', '-c', '-p', f],
stdout=open(os.devnull, 'wb'))
except:
errors = True
if errors:
cPickle.dump(cache, open(self.CACHE, 'wb'), -1) cPickle.dump(cache, open(self.CACHE, 'wb'), -1)
subprocess.call(['gvim', '-f', f]) subprocess.call(['gvim', '-f', f])
raise SystemExit(1) raise SystemExit(1)

View File

@ -133,7 +133,15 @@ find_offset_for_point = (x, y, node, cdoc) ->
class CanonicalFragmentIdentifier class CanonicalFragmentIdentifier
# This class is a namespace to expose CFI functions via the window.cfi # This class is a namespace to expose CFI functions via the window.cfi
# object # object. The three most important functions are:
#
# is_compatible(): Throws an error if the browser is not compatible with
# this script
#
# at(x, y): which maps a point to a CFI, if possible
#
# scroll_to(cfi): which scrolls the browser to a point corresponding to the
# given cfi, and returns the x and y co-ordinates of the point.
constructor: () -> # {{{ constructor: () -> # {{{
this.CREATE_RANGE_ERR = "Your browser does not support the createRange function. Update it to a newer version." this.CREATE_RANGE_ERR = "Your browser does not support the createRange function. Update it to a newer version."

View File

@ -5,7 +5,10 @@
<script type="text/javascript" src="cfi.coffee"></script> <script type="text/javascript" src="cfi.coffee"></script>
<script type="text/javascript" src="cfi-test.coffee"></script> <script type="text/javascript" src="cfi-test.coffee"></script>
<style type="text/css"> <style type="text/css">
body { font-family: sans-serif } body {
font-family: sans-serif;
background-color: white;
}
h2 { h2 {
border-top: solid 2px black; border-top: solid 2px black;