-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.watchr
More file actions
40 lines (40 loc) · 1.1 KB
/
tests.watchr
File metadata and controls
40 lines (40 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require 'uri'
require 'open3'
command = "c:/Program Files (x86)/full phat/Snarl/tools/heysnarl.exe"
output = ""
args = ""
watch('(.*\.scm)$') { |md|
file = "#{md[0]}"
stdin, stdout, stderr = Open3.popen3(
"c:/chicken/bin/csi.exe",
file,
"-b",
"-q",
"-r5rs-syntax",
"-n")
output = stdout.readlines[1..-3]
err = stderr.readlines
if err.length == 0
puts output
else
puts "Out: %s\nErr: %s" % [output, err.join]
end
if output.to_s =~ /\(100%\) tests passed/
icon = "#{ENV["HOME"]}\\icons\\ok-icon.png"
else
icon = "#{ENV["HOME"]}\\icons\\Button-Close-icon.png"
end
args = if not(output) || output.empty?
URI.escape(err[0..1].join).gsub(/%0A/,'\n')
else
URI.escape(output[-1]).gsub(/%0A/,'\n')
end
args = "notify?title=" +
"Watchr: Scheme Tests" +
"&text=" +
args +
"&icon=" +
icon
stdin, stdout, stderr = Open3.popen3(command,args)
puts(stderr.read)
}