Skip to content
This repository was archived by the owner on May 19, 2020. It is now read-only.

Commit 20ee430

Browse files
committed
Formatting
1 parent b456f16 commit 20ee430

File tree

1 file changed

+50
-53
lines changed

1 file changed

+50
-53
lines changed

coffee.wsf

Lines changed: 50 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,71 +2,68 @@
22
<!-- https://github.com/jashkenas/coffee-script/raw/master/extras/coffee-script.js -->
33
<script src="coffee-script.js" language="JScript" />
44
<script language="JScript">
5-
(function () {
6-
5+
(function() {
6+
77
var args = [];
8-
for(var i = 0; i < WScript.Arguments.Length; i++) {
8+
for (var i = 0; i < WScript.Arguments.Length; i++) {
99
args.push(WScript.Arguments.Item(i));
1010
}
1111

12-
//http://ss64.com/vb/filesystemobject.html
12+
// FileSystemObject: http://msdn.microsoft.com/en-us/library/bkx696eh.aspx
1313
var fso = new ActiveXObject("Scripting.FileSystemObject");
1414

15-
var isfolder = (args[0] && fso.folderexists(args[0]));
16-
15+
var isfolder = (args[0] && fso.folderExists(args[0]));
16+
1717
if (isfolder) {
18-
f = fso.getfolder(args[0]);
19-
e = new Enumerator(f.files);
20-
for( ; !e.atEnd(); e.moveNext() ) {
21-
if (e.item().path.toLowerCase().lastIndexOf('.coffee') != -1) {
22-
convert(e.item(),args[1]);
23-
}
24-
}
18+
f = fso.getFolder(args[0]);
19+
e = new Enumerator(f.files);
20+
for (; !e.atEnd(); e.moveNext()) {
21+
if (e.item().path.toLowerCase().lastIndexOf('.coffee') != -1) {
22+
convert(e.item(), args[1]);
23+
}
24+
}
2525
}
2626
else {
27-
convert(args[0],args[1])
28-
}
29-
27+
convert(args[0], args[1])
28+
}
29+
3030
})();
3131

3232

33-
function convert(input,output) {
34-
35-
var fso = new ActiveXObject("Scripting.FileSystemObject");
36-
37-
if (!input) {
38-
input = WScript.StdIn;
39-
}
40-
41-
42-
if (output) {
43-
if (fso.folderexists(output)) {
44-
output = output + '\\' + fso.getfile(input).name.replace('\.coffee','.js')
33+
function convert(input, output) {
34+
35+
var fso = new ActiveXObject("Scripting.FileSystemObject");
36+
37+
if (!input) {
38+
input = WScript.StdIn;
39+
}
40+
41+
if (output) {
42+
if (fso.folderExists(output)) {
43+
output = output + '\\' + fso.getFile(input).name.replace('\.coffee', '.js')
44+
}
45+
output = fso.CreateTextFile(output);
46+
}
47+
else {
48+
output = WScript.StdOut;
49+
}
50+
51+
input = fso.OpenTextFile(input);
52+
53+
// Read all input data into string
54+
var chunks = [];
55+
while (!input.AtEndOfStream)
56+
chunks.push(input.ReadAll());
57+
var coffee = chunks.join('');
58+
59+
try {
60+
var js = CoffeeScript.compile(coffee);
61+
output.Write(js);
62+
}
63+
catch (err) {
64+
WScript.StdErr.WriteLine(err.message);
65+
WScript.Quit(1);
4566
}
46-
output = fso.CreateTextFile(output);
47-
}
48-
else {
49-
output = WScript.StdOut;
50-
}
51-
52-
input = fso.OpenTextFile(input);
53-
54-
// Read all input data into string
55-
var chunks = [];
56-
while (!input.AtEndOfStream)
57-
chunks.push(input.ReadAll());
58-
var coffee = chunks.join('');
59-
60-
try {
61-
var js = CoffeeScript.compile(coffee);
62-
output.Write(js);
63-
}
64-
catch (err) {
65-
WScript.StdErr.WriteLine(err.message);
66-
WScript.Quit(1);
67-
}
68-
69-
}
70-
67+
}
7168
</script>
7269
</job>

0 commit comments

Comments
 (0)