Skip to content

Commit

Permalink
semicolons
Browse files Browse the repository at this point in the history
  • Loading branch information
basti1302 committed Jun 28, 2014
1 parent c69712a commit df897be
Show file tree
Hide file tree
Showing 27 changed files with 1,506 additions and 1,506 deletions.
3 changes: 2 additions & 1 deletion .jshintrc
@@ -1,5 +1,5 @@
{
"asi": true,
"asi": false,
"bitwise": true,
"boss": true,
"camelcase": true,
Expand All @@ -11,6 +11,7 @@
"immed": true,
"indent": 2,
"latedef": false,
"laxcomma": true,
"maxcomplexity": 6,
"maxdepth": 4,
"maxlen": 80,
Expand Down
85 changes: 42 additions & 43 deletions Gruntfile.js
@@ -1,13 +1,12 @@
'use strict';

var request = require('request')

var testServerRootUri = 'http://127.0.0.1:2808'
var testServerStatusUri = testServerRootUri + '/status'
var testServerKillUri = testServerRootUri + '/quit'
var mochaPhantomJsTestRunner = testServerRootUri +
, testServerRootUri = 'http://127.0.0.1:2808'
, testServerStatusUri = testServerRootUri + '/status'
, testServerKillUri = testServerRootUri + '/quit'
, mochaPhantomJsTestRunner = testServerRootUri +
'/static/browser/test/index.html'
var serverWasAlreadyRunning = false
, serverWasAlreadyRunning = false;

/* jshint -W106 */
module.exports = function(grunt) {
Expand Down Expand Up @@ -116,82 +115,82 @@ module.exports = function(grunt) {
files: ['<%= jshint.files %>'],
tasks: ['default']
},
})
});

grunt.loadNpmTasks('grunt-contrib-clean')
grunt.loadNpmTasks('grunt-contrib-jshint')
grunt.loadNpmTasks('grunt-mocha-test')
grunt.loadNpmTasks('grunt-browserify')
grunt.loadNpmTasks('grunt-contrib-uglify')
grunt.loadNpmTasks('grunt-mocha-phantomjs')
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-mocha-phantomjs');
grunt.loadNpmTasks('grunt-contrib-watch');

grunt.registerTask('start-test-server', 'Start the test server.',
function() {
var done = this.async()
var done = this.async();

function pingTestServer(callback) {
request.get(testServerRootUri, function(error, response) {
if (error) {
callback(error)
callback(error);
} else if (response.statusCode === 200) {
callback()
callback();
} else {
callback(new Error('HTTP status code was not 200 (as expected), ' +
'but ' + response.statusCode))
'but ' + response.statusCode));
}
})
});
}

grunt.log.writeln('Starting test server from grunt.')
grunt.log.writeln('Starting test server from grunt.');
pingTestServer(function(error) {
// Only start a test server instance if none is running. Rationale:
// If an instance is running via supervisor while watching changed files,
// we do not need to (and can not due to port conflicts) start a second
// instance.
if (error) {
if (error.message !== 'connect ECONNREFUSED') {
grunt.log.writeln('(Message from ping was: ' + error.message + ')')
grunt.log.writeln('(Message from ping was: ' + error.message + ')');
}
grunt.log.writeln('It seems the test server is currently not ' +
'running, will start a new instance to run mocha-phantomjs tests.')
require('./bin/start-test-server')
done()
'running, will start a new instance to run mocha-phantomjs tests.');
require('./bin/start-test-server');
done();
} else {
serverWasAlreadyRunning = true
grunt.log.writeln('Test server is already running.')
done()
serverWasAlreadyRunning = true;
grunt.log.writeln('Test server is already running.');
done();
}
})
})
});
});

grunt.registerTask('stop-test-server', 'Stops the test server.',
function() {
var done = this.async()
var done = this.async();
if (serverWasAlreadyRunning) {
grunt.log.writeln('Server was already running when Grunt build started,' +
' thus it will not be shut down now from Grunt.')
return done()
' thus it will not be shut down now from Grunt.');
return done();
} else {
grunt.log.writeln('Stopping test server from grunt.')
grunt.log.writeln('Stopping test server from grunt.');
}
request.get(testServerKillUri, function(error, response) {
if (error) {
if (error.message !== 'connect ECONNREFUSED') {
grunt.log.writeln('(Message from stop request was: ' + error.message +
')')
')');
}
grunt.log.writeln('It seems the test server is not running at all, ' +
'doing nothing')
return done()
'doing nothing');
return done();
} else {
grunt.log.writeln('Poison pill request has been send to test server, ' +
'test server should have been shut down.')
grunt.log.writeln('')
return done()
'test server should have been shut down.');
grunt.log.writeln('');
return done();
}
})
})
});
});

grunt.registerTask('default', [
'jshint',
Expand All @@ -202,6 +201,6 @@ module.exports = function(grunt) {
'start-test-server',
'mocha_phantomjs',
'stop-test-server'
])
}
]);
};
/* jshint +W106 */
4 changes: 2 additions & 2 deletions bin/start-test-server.js
@@ -1,5 +1,5 @@
#!/usr/bin/env node

var testServer = require('../server/app')
testServer.start()
var testServer = require('../server/app');
testServer.start();

30 changes: 15 additions & 15 deletions browser/example/github-example.js
@@ -1,20 +1,20 @@
'use strict';

(function() {
var rootUri = 'https://api.github.com/'
var rootUri = 'https://api.github.com/';

var api = traverson.json.from(rootUri)
var api = traverson.json.from(rootUri);

function executeAllRequests() {
['#commit_comment_response'].forEach(function(div) {
$(div).html('<img src="assets/spinner.gif"/>')
})
executeCommitCommentRequest()
$(div).html('<img src="assets/spinner.gif"/>');
});
executeCommitCommentRequest();
}

// find a commit comment
function executeCommitCommentRequest() {
$('#commit_comment_response').html('<img src="assets/spinner.gif"/>')
$('#commit_comment_response').html('<img src="assets/spinner.gif"/>');

api.newRequest()
.follow('repository_url', 'commits_url', 'comments_url')
Expand All @@ -24,20 +24,20 @@
sha: '5c82c74583ee67eae727466179dd66c91592dd4a'
}).getResource(function(err, resource) {
if (err) {
$('#commit_comment_response').html(JSON.stringify(err))
return
$('#commit_comment_response').html(JSON.stringify(err));
return;
}
$('#commit_comment_response').html(JSON.stringify(resource, null, 2))
})
$('#commit_comment_response').html(JSON.stringify(resource, null, 2));
});
}

$(document).ready(function () {
$('#btn-all').on('click', executeAllRequests)
$('#btn-commit-comment').on('click', executeCommitCommentRequest)
$('#btn-all').on('click', executeAllRequests);
$('#btn-commit-comment').on('click', executeCommitCommentRequest);
$('#general').html(
'var rootUri = \'https://api.github.com/\'<br/>' +
'var api = traverson.json.from(rootUri)<br/>'
)
);

// find a commit comment
$('#commit_comment_request').html(
Expand All @@ -50,6 +50,6 @@
')}.getResource(function(err, resource) {<br/>' +
'&nbsp;&nbsp;// do something with the resource...<br/>' +
'})<br/>'
)
})
);
});
})();

0 comments on commit df897be

Please sign in to comment.