loris 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/TODO +5 -2
- data/VERSION +1 -1
- data/lib/directory_finder.rb +22 -0
- data/lib/filters/starts_with_filter.rb +17 -0
- data/lib/jasmine-node/LICENSE +22 -0
- data/lib/jasmine-node/lib/jasmine/index.js +170 -0
- data/lib/jasmine-node/lib/jasmine/jasmine-0.10.2.js +2323 -0
- data/lib/jasmine-node/specs.js +27 -0
- data/lib/loris.rb +37 -1
- data/lib/task_manager.rb +40 -9
- data/lib/tasks/coffeescript/coffeescript_parser.rb +37 -0
- data/lib/tasks/coffeescript/coffeescript_runner.rb +37 -0
- data/lib/tasks/jasmine_node/jasmine_node_parser.rb +25 -0
- data/lib/tasks/jasmine_node/jasmine_node_runner.rb +27 -0
- data/lib/windows_process.rb +0 -1
- data/loris.gemspec +14 -4
- data/loris.tmproj +39 -89
- metadata +57 -17
data/TODO
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
+
* Only run next task if first task completed successfully (e.g. don't run JSL on second round if CS failed on first round)
|
2
|
+
* Update to latest version of JS Test Driver
|
3
|
+
* Update to latest version of Jasmine
|
4
|
+
|
1
5
|
* Keep track of number of tests run/files linted. Let user know if this drops
|
2
6
|
|
3
7
|
* Desktop (AIR?) app with red/green indicator, and clickable filename links
|
4
8
|
* Aptana/VS plugin with red/green indicator and clickable filename links?
|
5
9
|
|
6
10
|
* Tidy Windows related if statements
|
7
|
-
* Tidy JSL filename removing
|
11
|
+
* Tidy JSL + CoffeeScript filename removing
|
8
12
|
|
9
13
|
|
10
14
|
* JSpec not installed? (can require as gem)
|
@@ -12,7 +16,6 @@
|
|
12
16
|
|
13
17
|
* Factories to create tasks
|
14
18
|
|
15
|
-
* Deal with filesystem exceptions
|
16
19
|
* jspec task (just modified files?)
|
17
20
|
* javascript lint task (just modified files?)
|
18
21
|
* separate thread (create new and kill old)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class DirectoryFinder
|
2
|
+
|
3
|
+
def initialize(file, filter)
|
4
|
+
@file = file
|
5
|
+
@filter = filter
|
6
|
+
end
|
7
|
+
|
8
|
+
def find(files)
|
9
|
+
dirs = []
|
10
|
+
|
11
|
+
files.each do |file_name|
|
12
|
+
dir = @file.dirname file_name
|
13
|
+
dirs << dir if @filter.filter(File.basename(dir))
|
14
|
+
end
|
15
|
+
|
16
|
+
return dirs
|
17
|
+
end
|
18
|
+
|
19
|
+
def complete
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'extensions/string'
|
3
|
+
|
4
|
+
class StartsWithFilter
|
5
|
+
|
6
|
+
def initialize(text)
|
7
|
+
@text = text.downcase
|
8
|
+
end
|
9
|
+
|
10
|
+
def filter(file_name)
|
11
|
+
return file_name.downcase.starts_with?(@text)
|
12
|
+
end
|
13
|
+
|
14
|
+
def complete
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2010 Adam Abrons and Misko Hevery http://getangular.com
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
22
|
+
|
@@ -0,0 +1,170 @@
|
|
1
|
+
var fs = require('fs');
|
2
|
+
var sys = require('sys');
|
3
|
+
|
4
|
+
var filename = __dirname + '/jasmine-0.10.2.js';
|
5
|
+
global.window = {
|
6
|
+
setTimeout: setTimeout,
|
7
|
+
clearTimeout: clearTimeout,
|
8
|
+
setInterval: setInterval,
|
9
|
+
clearInterval: clearInterval
|
10
|
+
};
|
11
|
+
var src = fs.readFileSync(filename);
|
12
|
+
var jasmine = process.compile(src + '\njasmine;', filename);
|
13
|
+
delete global.window;
|
14
|
+
|
15
|
+
function noop(){}
|
16
|
+
|
17
|
+
jasmine.executeSpecsInFolder = function(folder, done, isVerbose, showColors){
|
18
|
+
var log = [];
|
19
|
+
var columnCounter = 0;
|
20
|
+
var start = 0;
|
21
|
+
var elapsed = 0;
|
22
|
+
var verbose = isVerbose || false;
|
23
|
+
var colors = showColors || false;
|
24
|
+
var specs = jasmine.getAllSpecFiles(folder);
|
25
|
+
|
26
|
+
var ansi = {
|
27
|
+
green: '\033[32m',
|
28
|
+
red: '\033[31m',
|
29
|
+
yellow: '\033[33m',
|
30
|
+
none: '\033[0m'
|
31
|
+
};
|
32
|
+
|
33
|
+
for (var i = 0, len = specs.length; i < len; ++i){
|
34
|
+
var filename = specs[i];
|
35
|
+
require(filename.replace(/\.js$/, ""));
|
36
|
+
}
|
37
|
+
|
38
|
+
var jasmineEnv = jasmine.getEnv();
|
39
|
+
jasmineEnv.reporter = {
|
40
|
+
log: function(str){
|
41
|
+
},
|
42
|
+
|
43
|
+
reportRunnerStarting: function(runner) {
|
44
|
+
sys.puts('Started');
|
45
|
+
start = Number(new Date);
|
46
|
+
},
|
47
|
+
|
48
|
+
reportSuiteResults: function(suite) {
|
49
|
+
var specResults = suite.results();
|
50
|
+
var path = [];
|
51
|
+
while(suite) {
|
52
|
+
path.unshift(suite.description);
|
53
|
+
suite = suite.parentSuite;
|
54
|
+
}
|
55
|
+
var description = path.join(' ');
|
56
|
+
|
57
|
+
if (verbose)
|
58
|
+
log.push('Spec ' + description);
|
59
|
+
|
60
|
+
specResults.items_.forEach(function(spec){
|
61
|
+
if (spec.failedCount > 0 && spec.description) {
|
62
|
+
if (!verbose)
|
63
|
+
log.push(description);
|
64
|
+
log.push(' it ' + spec.description);
|
65
|
+
spec.items_.forEach(function(result){
|
66
|
+
log.push(' ' + result.trace.stack + '\n');
|
67
|
+
});
|
68
|
+
}
|
69
|
+
});
|
70
|
+
},
|
71
|
+
|
72
|
+
reportSpecResults: function(spec) {
|
73
|
+
var result = spec.results();
|
74
|
+
var msg = '';
|
75
|
+
if (result.passed())
|
76
|
+
{
|
77
|
+
msg = (colors) ? (ansi.green + '.' + ansi.none) : '.';
|
78
|
+
// } else if (result.skipped) { TODO: Research why "result.skipped" returns false when "xit" is called on a spec?
|
79
|
+
// msg = (colors) ? (ansi.yellow + '*' + ansi.none) : '*';
|
80
|
+
} else {
|
81
|
+
msg = (colors) ? (ansi.red + 'F' + ansi.none) : 'F';
|
82
|
+
}
|
83
|
+
sys.print(msg);
|
84
|
+
if (columnCounter++ < 50) return;
|
85
|
+
columnCounter = 0;
|
86
|
+
sys.print('\n');
|
87
|
+
},
|
88
|
+
|
89
|
+
|
90
|
+
reportRunnerResults: function(runner) {
|
91
|
+
elapsed = (Number(new Date) - start) / 1000;
|
92
|
+
sys.puts('\n');
|
93
|
+
log.forEach(function(log){
|
94
|
+
sys.puts(log);
|
95
|
+
});
|
96
|
+
sys.puts('Finished in ' + elapsed + ' seconds');
|
97
|
+
|
98
|
+
var summary = jasmine.printRunnerResults(runner);
|
99
|
+
if(colors)
|
100
|
+
{
|
101
|
+
if(runner.results().failedCount === 0 )
|
102
|
+
sys.puts(ansi.green + summary + ansi.none);
|
103
|
+
else
|
104
|
+
sys.puts(ansi.red + summary + ansi.none);
|
105
|
+
} else {
|
106
|
+
sys.puts(summary);
|
107
|
+
}
|
108
|
+
(done||noop)(runner, log);
|
109
|
+
}
|
110
|
+
};
|
111
|
+
jasmineEnv.execute();
|
112
|
+
};
|
113
|
+
|
114
|
+
jasmine.getAllSpecFiles = function(dir){
|
115
|
+
var files = fs.readdirSync(dir);
|
116
|
+
var specs = [];
|
117
|
+
|
118
|
+
for (var i = 0, len = files.length; i < len; ++i){
|
119
|
+
var filename = dir + '/' + files[i];
|
120
|
+
if (fs.statSync(filename).isFile() && filename.match(/\.js$/)){
|
121
|
+
specs.push(filename);
|
122
|
+
}else if (fs.statSync(filename).isDirectory()){
|
123
|
+
var subfiles = this.getAllSpecFiles(filename);
|
124
|
+
subfiles.forEach(function(result){
|
125
|
+
specs.push(result);
|
126
|
+
});
|
127
|
+
}
|
128
|
+
}
|
129
|
+
return specs;
|
130
|
+
};
|
131
|
+
|
132
|
+
jasmine.printRunnerResults = function(runner){
|
133
|
+
var results = runner.results();
|
134
|
+
var suites = runner.suites();
|
135
|
+
var msg = '';
|
136
|
+
msg += suites.length + ' test' + ((suites.length === 1) ? '' : 's') + ', ';
|
137
|
+
msg += results.totalCount + ' assertion' + ((results.totalCount === 1) ? '' : 's') + ', ';
|
138
|
+
msg += results.failedCount + ' failure' + ((results.failedCount === 1) ? '' : 's') + '\n';
|
139
|
+
return msg;
|
140
|
+
};
|
141
|
+
|
142
|
+
function now(){
|
143
|
+
return new Date().getTime();
|
144
|
+
}
|
145
|
+
|
146
|
+
jasmine.asyncSpecWait = function(){
|
147
|
+
var wait = jasmine.asyncSpecWait;
|
148
|
+
wait.start = now();
|
149
|
+
wait.done = false;
|
150
|
+
(function innerWait(){
|
151
|
+
waits(10);
|
152
|
+
runs(function() {
|
153
|
+
if (wait.start + wait.timeout < now()) {
|
154
|
+
expect('timeout waiting for spec').toBeNull();
|
155
|
+
} else if (wait.done) {
|
156
|
+
wait.done = false;
|
157
|
+
} else {
|
158
|
+
innerWait();
|
159
|
+
}
|
160
|
+
});
|
161
|
+
})();
|
162
|
+
};
|
163
|
+
jasmine.asyncSpecWait.timeout = 4 * 1000;
|
164
|
+
jasmine.asyncSpecDone = function(){
|
165
|
+
jasmine.asyncSpecWait.done = true;
|
166
|
+
};
|
167
|
+
|
168
|
+
for ( var key in jasmine) {
|
169
|
+
exports[key] = jasmine[key];
|
170
|
+
}
|