-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
6,615 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.rvmrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
fs = require 'fs' | ||
util = require 'util' | ||
exec = require('child_process').exec | ||
http = require 'http' | ||
url = require 'url' | ||
|
||
#------------------------------------------------------------------------------- | ||
#--- Helpers | ||
|
||
build = (config) -> | ||
if config.scriptsOrder.length > 0 | ||
files = "" | ||
for file in config.scriptsOrder | ||
files += " #{file}" | ||
command = "coffee --join #{config.outputFile} --compile #{files}" | ||
if config.compress | ||
command += " && uglifyjs --overwrite #{config.outputFile}" | ||
exec command, (error, stdout, stderr) -> | ||
if error? | ||
console.error("#{config.outputFile} don't builted.") | ||
console.error(stdout) | ||
console.error(stderr) | ||
else | ||
console.info("#{config.outputFile} builted successful.") | ||
return | ||
return | ||
|
||
runServer = (config) -> | ||
|
||
server = http.createServer((request, response) -> | ||
|
||
# parse url | ||
url_path = url.parse(request.url).path | ||
|
||
try | ||
# for main page | ||
if url_path == "/" | ||
response.writeHead 200, "Content-Type": "text/html" | ||
return response.end fs.readFileSync(config.index) | ||
# for other files | ||
else | ||
if url_path.match(/.*\.(html|js|css)/g) | ||
if url_path.match(/.*\.html$/g) | ||
response.writeHead 200, "Content-Type": "text/html" | ||
if url_path.match(/.*\.js$/g) | ||
response.writeHead 200, "Content-Type": "text/javascript" | ||
if url_path.match(/.*\.css$/g) | ||
response.writeHead 200, "Content-Type": "text/css" | ||
return response.end fs.readFileSync "./#{url_path}", "utf-8" | ||
else | ||
response.writeHead 200 | ||
return response.end fs.readFileSync "./#{url_path}" | ||
# 404 for error, when try find a file | ||
catch error | ||
response.writeHead 404 | ||
return response.end "" | ||
).listen(config.port, config.host) | ||
|
||
console.log("Server running on #{config.host}:#{config.port}") | ||
|
||
return | ||
|
||
#------------------------------------------------------------------------------- | ||
#--- Buildr configs | ||
|
||
lib = | ||
scriptsOrder: [ | ||
"lib/reporter.coffee" | ||
] | ||
outputFile: "./jasmine-wkreporter.js" | ||
compress: false | ||
|
||
spec = | ||
scriptsOrder: [ | ||
"spec/reporter.spec.coffee" | ||
] | ||
outputFile: "./jasmine-wkreporter.spec.js" | ||
compress: false | ||
|
||
release = | ||
scriptsOrder: [ | ||
"lib/reporter.coffee" | ||
] | ||
outputFile: "./jasmine-wkreporter.min.js" | ||
compress: true | ||
|
||
server = | ||
host: "localhost" | ||
port: 3000 | ||
index: "./specRunner.html" | ||
|
||
#------------------------------------------------------------------------------- | ||
#--- Tasks | ||
|
||
task 'build:lib', 'Build lib for testing', () -> | ||
build lib | ||
return | ||
|
||
task 'build:spec', 'Build spec for testing', () -> | ||
build spec | ||
return | ||
|
||
task 'build:release', 'Build lib for release', () -> | ||
build release | ||
return | ||
|
||
task 'build:all', 'Build lib and spec for testing, and lib for release', () -> | ||
invoke 'build:lib' | ||
invoke 'build:spec' | ||
invoke 'build:release' | ||
return | ||
|
||
task 'server', 'Running development server for Jasmine Runner', () -> | ||
runServer server | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
source 'http://rubygems.org' | ||
|
||
gem "guard" | ||
gem 'guard-shell' | ||
gem 'guard-livereload' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
addressable (2.2.6) | ||
em-websocket (0.3.6) | ||
addressable (>= 2.1.1) | ||
eventmachine (>= 0.12.9) | ||
eventmachine (0.12.10) | ||
ffi (1.0.11) | ||
guard (1.0.0) | ||
ffi (>= 0.5.0) | ||
thor (~> 0.14.6) | ||
guard-livereload (0.4.0) | ||
em-websocket (>= 0.2.0) | ||
guard (>= 0.10.0) | ||
multi_json (~> 1.0.3) | ||
guard-shell (0.2.0) | ||
guard (>= 0.2.0) | ||
multi_json (1.0.4) | ||
thor (0.14.6) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
guard | ||
guard-livereload | ||
guard-shell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
guard 'shell' do | ||
# Cakefile | ||
watch(/^Cakefile$/) { |m| `cake build:all` } | ||
# Library | ||
watch(/^lib\/.*/) { |m| `cake build:lib`} | ||
# Specs | ||
watch(/^spec\/.*/) { |m| `cake build:spec` } | ||
end | ||
|
||
reload_url = 'http://localhost:3000' | ||
|
||
guard 'livereload' do | ||
watch(/^jasmine-wkreporter.js$/) { |m| reload_url } | ||
watch(/^jasmine-wkreporter.spec.js$/) { |m| reload_url } | ||
watch(/^vendor\/.*/) { |m| reload_url } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2008-2011 Pivotal Labs | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Jasmine WebKit Reporter | ||
|
||
Jasmine WebKit Reporter is the simple reporter for Jasmine for showning results | ||
of spec running by Notification API. This is reporter works with Chrome/Chromium | ||
only, because Notification API implemented only in this browser. | ||
|
||
Need permission for use notifications for work this reporter. | ||
|
||
## Installation | ||
|
||
Install this reporter is very simple task. Only enable script after Jasmine in | ||
SpecRunner. | ||
|
||
## Usage | ||
|
||
This is simple example of usage. : | ||
|
||
``` javascript | ||
|
||
(function() { | ||
var jasmineEnv = jasmine.getEnv(); | ||
jasmineEnv.updateInterval = 1000; | ||
|
||
var trivialReporter = new jasmine.TrivialReporter(); | ||
var webkitReporter = new jasmine.WebkitReporter(); // create new reporter instance | ||
|
||
jasmineEnv.addReporter(trivialReporter); | ||
jasmineEnv.addReporter(webkitReporter); // register reporter in jasmineEnv | ||
|
||
jasmineEnv.specFilter = function(spec) { | ||
return trivialReporter.specFilter(spec); | ||
}; | ||
|
||
var currentWindowOnload = window.onload; | ||
|
||
window.onload = function() { | ||
if (currentWindowOnload) { | ||
currentWindowOnload(); | ||
} | ||
execJasmine(); | ||
}; | ||
|
||
function execJasmine() { | ||
jasmineEnv.execute(); | ||
} | ||
|
||
})(); | ||
|
||
When specs are running, will be used TrivialReporter (default for Jasmine), and | ||
WebkitReporter. |
Oops, something went wrong.