Another Boo
Posted on October 14, 2007
Here is another script I wrote, I’m not sure if it will be usefull but I will try to work with it on and see the results. I think disk I/O takes most of the wait time (total ~1.6sec). Some kind of memory drive would be usefull for this kind of use.
import System.IO
import System.Windows.Forms
class Watcher():
fsw as FileSystemWatcher
f as Form
l as Label
active = false
def constructor(fspath as string):
f = Form()
l = Label()
fsw = FileSystemWatcher()
fsw.Path = fspath
fsw.IncludeSubdirectories = true
fsw.NotifyFilter = NotifyFilters.LastWrite
fsw.Changed += ChangedCallBack
fsw.EnableRaisingEvents = true
def Enable():
fsw.EnableRaisingEvents = true
def Disable():
fsw.EnableRaisingEvents = false
def ChangedCallBack(source, e as FileSystemEventArgs):
print "File: ${e.FullPath} ${e.ChangeType}"
BuildProject()
def BuildProject():
if not active:
active = true
cmd = System.IO.Path.Combine(System.Environment.CurrentDirectory, "tools//nant//nant.exe")
print "Calling ${cmd}"
r = shell(cmd, "-buildfile:Uniboard.build test")
if r =~ /BUILD\sFAILED/:
caption = /Failures:.*/.Match(r).Value.Trim()
text = /(?s)Failures:.*?BUILD\s\w+/.Match(r).Value
ShowForm(caption, text)
active = false
else:
print "Build is Active"
def ShowForm(caption as string, text as string):
//f.Text = caption
//f.TopMost = true
//f.AutoSize = true
//l.AutoSize = true
//l.Text = text
//f.Controls.Add(l)
//f.Click += def(sender, e as System.EventArgs):
// f.Close()
//f.KeyDown += def(sender, e as KeyEventArgs):
// f.Close()
//f.Load += def():
// f.Activate()
// f.ShowDialog()
MessageBox.Show(text, caption, MessageBoxButtons.OK)
w = Watcher(System.Environment.CurrentDirectory)
print "Starting"
while(true):
prompt("")
w.Disable()
w.BuildProject()
w.Enable()
Filed Under Uncategorized |
Leave a Comment
If you would like to make a comment, please fill out the form below.