Skip to content

Commit

Permalink
Squash code style modifications.
Browse files Browse the repository at this point in the history
  • Loading branch information
richtera committed Jan 5, 2013
1 parent b349d3b commit 9083e21
Show file tree
Hide file tree
Showing 2,338 changed files with 271,717 additions and 209,227 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ conf/*.json
*.sock
*.gz
*.sass-cache
.idea
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

11 changes: 0 additions & 11 deletions .idea/calipso.iml

This file was deleted.

13 changes: 0 additions & 13 deletions .idea/codeStyleSettings.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/cssxfire.xml

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/encodings.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/jsLibraryMappings.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/libraries/sass_stdlib.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/misc.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/modules.xml

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/scopes/scope_settings.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/vcs.xml

This file was deleted.

1,267 changes: 0 additions & 1,267 deletions .idea/workspace.xml

This file was deleted.

216 changes: 216 additions & 0 deletions JasmineAdapter-1.1.2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
/**
* @fileoverview Jasmine JsTestDriver Adapter.
* @author [email protected] (Misko Hevery)
* @author [email protected] (Olmo Maldonado)
*/
(function () {


var Env = function (onTestDone, onComplete) {
jasmine.Env.call(this);

this.specFilter = function (spec) {
if (!this.exclusive) {
return true;
}
var blocks = spec.queue.blocks, l = blocks.length;
for (var i = 0; i < l; i++) {
if (blocks[i].func.exclusive >= this.exclusive) {
return true;
}
}
return false;
};

this.reporter = new Reporter(onTestDone, onComplete);
};
jasmine.util.inherit(Env, jasmine.Env);

// Here we store:
// 0: everyone runs
// 1: run everything under ddescribe
// 2: run only iits (ignore ddescribe)
Env.prototype.exclusive = 0;


Env.prototype.execute = function () {
collectMode = false;
playback();
jasmine.Env.prototype.execute.call(this);
};


var Reporter = function (onTestDone, onComplete) {
this.onTestDone = onTestDone;
this.onComplete = onComplete;
this.reset();
};
jasmine.util.inherit(Reporter, jasmine.Reporter);


Reporter.formatStack = function (stack) {
var line, lines = (stack || '').split(/\r?\n/), l = lines.length, frames = [];
for (var i = 0; i < l; i++) {
line = lines[i];
if (line.match(/\/jasmine[\.-]/)) {
continue;
}
frames.push(line.replace(/https?:\/\/\w+(:\d+)?\/test\//, '').replace(/^\s*/, ' '));
}
return frames.join('\n');
};


Reporter.prototype.reset = function () {
this.specLog = jstestdriver.console.log_ = [];
};


Reporter.prototype.log = function (str) {
this.specLog.push(str);
};


Reporter.prototype.reportSpecStarting = function () {
this.reset();
this.start = +new Date();
};


Reporter.prototype.reportSpecResults = function (spec) {
var elapsed = +new Date() - this.start, results = spec.results();

if (results.skipped) {
return;
}

var item, state = 'passed', items = results.getItems(), l = items.length, messages = [];
for (var i = 0; i < l; i++) {
item = items[i];
if (item.passed()) {
continue;
}
state = (item.message.indexOf('AssertionError:') != -1) ? 'error' : 'failed';
messages.push({
message:item + '',
name:item.trace.name,
stack:Reporter.formatStack(item.trace.stack)
});
}

this.onTestDone(new jstestdriver.TestResult(
spec.suite.getFullName(),
spec.description,
state,
jstestdriver.angular.toJson(messages),
this.specLog.join('\n'),
elapsed
));
};


Reporter.prototype.reportRunnerResults = function () {
this.onComplete();
};


var collectMode = true, intercepted = {};

describe = intercept('describe');
beforeEach = intercept('beforeEach');
afterEach = intercept('afterEach');

var JASMINE_TYPE = 'jasmine test case';
TestCase('Jasmine Adapter Tests', null, JASMINE_TYPE);

jstestdriver.pluginRegistrar.register({

name:'jasmine',

getTestRunsConfigurationFor:function (testCaseInfos, expressions, testRunsConfiguration) {
for (var i = 0; i < testCaseInfos.length; i++) {
if (testCaseInfos[i].getType() == JASMINE_TYPE) {
testRunsConfiguration.push(new jstestdriver.TestRunConfiguration(testCaseInfos[i], []));
}
}
return false; // allow other TestCases to be collected.
},

runTestConfiguration:function (config, onTestDone, onComplete) {
if (config.getTestCaseInfo().getType() != JASMINE_TYPE) {
return false;
}
(jasmine.currentEnv_ = new Env(onTestDone, onComplete)).execute();
return true;
},

onTestsFinish:function () {
jasmine.currentEnv_ = null;
collectMode = true;
}

});

function intercept(method) {
var bucket = intercepted[method] = [], method = window[method];
return function (desc, fn) {
if (collectMode) {
bucket.push(function () {
method(desc, fn);
});
}
else {
method(desc, fn);
}
};
}

function playback() {
for (var method in intercepted) {
var bucket = intercepted[method];
for (var i = 0, l = bucket.length; i < l; i++) {
bucket[i]();
}
}
}

})();

var ddescribe = function (name, fn) {
var env = jasmine.getEnv();
if (!env.exclusive) {
env.exclusive = 1;
} // run ddescribe only
describe(name, function () {
var oldIt = it;
it = function (name, fn) {
fn.exclusive = 1; // run anything under ddescribe
env.it(name, fn);
};

try {
fn.call(this);
} finally {
it = oldIt;
}
;
});
};

var iit = function (name, fn) {
var env = jasmine.getEnv();
env.exclusive = fn.exclusive = 2; // run only iits
env.it(name, fn);
};

// Patch Jasmine for proper stack traces
jasmine.Spec.prototype.fail = function (e) {
var result = new jasmine.ExpectationResult({
passed:false,
message:e ? jasmine.util.formatException(e) : 'Exception'
});
if (e) {
result.trace = e;
}
this.results_.addResult(result);
};
28 changes: 22 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,24 @@ MongoDB, ensure that you have the right compilers installed (for OSX,
XCode4 will work, for Ubuntu, the build-essential and libssl-dev
packages) and then use NPM:

```sh
npm install calipso -g
calipso site /var/www/MySite
cd /var/www/MySite
calipso server
```

#### Using node v0.5.3 and later

Since node v0.5.3 has removed <code>require.paths</code>, in order to
<code>require(‘lib/calipso’)</code>, you must include the following to
your file:

var rootpath = process.cwd() + '/',
path = require('path'),
calipso = require(path.join(rootpath, 'lib/calipso'));

```javascript
var rootpath = process.cwd() + '/',
path = require('path'),
calipso = require(path.join(rootpath, 'lib/calipso'));
```
That also goes for including anything that is based on the root path of the project directory.

### Development Steps
Expand All @@ -57,16 +60,18 @@ your file:

#### Commands That Run Anywhere

```sh
calipso : Show this help file.
calipso site <name|folder> : Create site in folder.

```

#### Commands That Run In Site Folder

The most important of these at the moment is ‘modules check’ (this will
ensure that all modules have all of their dependencies installed via
npm), and should be run on site install.

```sh
calipso install : Re-run site install.

calipso cluster --port=3000 : Run as cluster.
Expand All @@ -82,6 +87,7 @@ npm), and should be run on site install.
calipso themes list : List installed themes.
calipso themes uninstall *theme : Remove theme (delete from disk)
calipso themes download *url : Download (url: http://, gh: cliftonc/calipso-site-theme, repo: calipso-site).
```

### Contributors

Expand All @@ -105,4 +111,14 @@ npm), and should be run on site install.
[Martin Moen]: https://github.com/botto
[dale tan]: https://github.com/dtan
[Nate Hunzaker]: https://github.com/nhunzaker
[Andreas Richter]: https://github.com/richtera
[Andreas Richter]: https://github.com/richtera

#MIT License

Copyright (c)

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 SOFTWAR
Loading

0 comments on commit 9083e21

Please sign in to comment.