diff --git a/.jshintrc b/.jshintrc
index f7c2060c..e75832d8 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -5,7 +5,14 @@
"-Promise",
"jQuery",
"Visibility",
- "$"
+ "$",
+ "Travis",
+ "_cio",
+ "_gaq",
+ "Log",
+ "moment",
+ "Pusher",
+ "md5"
],
"browser": true,
"boss": true,
diff --git a/app/adapters/application.js b/app/adapters/application.js
index aa721541..77427849 100644
--- a/app/adapters/application.js
+++ b/app/adapters/application.js
@@ -1,8 +1,8 @@
import DS from 'ember-data';
import config from 'travis/config/environment';
-var Adapter;
+import Ember from 'ember';
-Adapter = DS.ActiveModelAdapter.extend({
+export default DS.ActiveModelAdapter.extend({
auth: Ember.inject.service(),
host: config.apiEndpoint,
coalesceFindRequests: true,
@@ -11,11 +11,13 @@ Adapter = DS.ActiveModelAdapter.extend({
var base, hash, token;
hash = this._super(...arguments);
- hash.headers || (hash.headers = {});
+ hash.headers = hash.headers || {};
hash.headers['accept'] = 'application/json; version=2';
if (token = this.get('auth').token()) {
- (base = hash.headers)['Authorization'] || (base['Authorization'] = "token " + token);
+ if(!hash.headers['Authorization']) {
+ hash.headers['Authorization'] = "token " + token;
+ }
}
return hash;
@@ -37,5 +39,3 @@ Adapter = DS.ActiveModelAdapter.extend({
return this._super(...arguments);
}
});
-
-export default Adapter;
diff --git a/app/app.js b/app/app.js
index 3380119c..e4aed0e2 100644
--- a/app/app.js
+++ b/app/app.js
@@ -32,12 +32,12 @@ var App = Ember.Application.extend(Ember.Evented, {
$('body').toggleClass('maximized');
element = $('');
$('#top .profile').append(element);
- Em.run.later((function() {
+ Ember.run.later((function() {
return element.remove();
}), 10);
element = $('');
$('#repo').append(element);
- return Em.run.later((function() {
+ return Ember.run.later((function() {
return element.remove();
}), 10);
},
diff --git a/app/components/add-ssh-key.js b/app/components/add-ssh-key.js
index 5740f966..648ed32d 100644
--- a/app/components/add-ssh-key.js
+++ b/app/components/add-ssh-key.js
@@ -1,4 +1,4 @@
-var AddSshKeyComponent;
+import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['form--sshkey'],
@@ -7,17 +7,18 @@ export default Ember.Component.extend({
isSaving: false,
didInsertElement() {
- id = this.get('repo.id');
- model = this.get('store').recordForId('ssh_key', id);
+ var id = this.get('repo.id');
+ var model = this.get('store').recordForId('ssh_key', id);
+
if (model) {
this.get('store').dematerializeRecord(model._internalModel);
- typeMap = this.get('store').typeMapFor(model.constructor);
- idToRecord = typeMap.idToRecord;
+ var typeMap = this.get('store').typeMapFor(model.constructor);
+ var idToRecord = typeMap.idToRecord;
delete idToRecord[id];
}
- model = this.get('store').createRecord('ssh_key', {
- id: id
- });
+
+ model = this.get('store').createRecord('ssh_key', { id: id });
+
return this.set('model', model);
},
@@ -42,8 +43,8 @@ export default Ember.Component.extend({
}.observes('value'),
addErrorsFromResponse(errArr) {
- var error;
- error = errArr[0].detail;
+ var error = errArr[0].detail;
+
if (error.code === 'not_a_private_key') {
return this.set('valueError', 'This key is not a private key.');
} else if (error.code === 'key_with_a_passphrase') {
@@ -54,6 +55,7 @@ export default Ember.Component.extend({
actions: {
save() {
var ssh_key;
+
this.set('valueError', false);
if (this.get('isSaving')) {
return;
@@ -68,7 +70,7 @@ export default Ember.Component.extend({
this.set('isSaving', false);
this.reset();
return this.sendAction('sshKeyAdded', ssh_key);
- }, () => {
+ }, (error) => {
this.set('isSaving', false);
if (error.errors) {
return this.addErrorsFromResponse(error.errors);
diff --git a/app/components/jobs-item.js b/app/components/jobs-item.js
index e2046e99..03527b25 100644
--- a/app/components/jobs-item.js
+++ b/app/components/jobs-item.js
@@ -1,6 +1,6 @@
import Ember from 'ember';
import { colorForState } from 'travis/utils/helpers';
-import { languageConfigKeys } from 'travis/utils/keys-map';;
+import { languageConfigKeys } from 'travis/utils/keys-map';
export default Ember.Component.extend({
tagName: 'li',
diff --git a/app/components/log-content.js b/app/components/log-content.js
index 97cb14a1..afda0566 100644
--- a/app/components/log-content.js
+++ b/app/components/log-content.js
@@ -9,12 +9,12 @@ Log.DEBUG = false;
Log.LIMIT = 10000;
Log.Scroll = function(options) {
- options || (options = {});
+ options = options || {};
this.beforeScroll = options.beforeScroll;
return this;
};
-Log.Scroll.prototype = $.extend(new Log.Listener, {
+Log.Scroll.prototype = $.extend(new Log.Listener(), {
insert: function(log, data, pos) {
if (this.numbers) {
this.tryScroll();
@@ -39,7 +39,7 @@ Log.Limit = function(max_lines, limitedLogCallback) {
return this;
};
-Log.Limit.prototype = Log.extend(new Log.Listener, {
+Log.Limit.prototype = Log.extend(new Log.Listener(), {
count: 0,
insert: function(log, node, pos) {
if (node.type === 'paragraph' && !node.hidden) {
diff --git a/app/controllers/current-user.js b/app/controllers/current-user.js
index 0ae514a2..ae063eb5 100644
--- a/app/controllers/current-user.js
+++ b/app/controllers/current-user.js
@@ -1,4 +1,4 @@
-var Controller;
+import Ember from 'ember';
export default Ember.Controller.extend({
sync() {
@@ -8,6 +8,7 @@ export default Ember.Controller.extend({
model: Ember.computed.alias('auth.currentUser'),
syncingDidChange: function() {
+ var user;
if ((user = this.get('model')) && user.get('isSyncing') && !user.get('syncedAt')) {
return Ember.run.scheduleOnce('routerTransitions', this, function() {
return this.container.lookup('router:main').send('renderFirstSync');
diff --git a/app/controllers/top.js b/app/controllers/top.js
index d061f752..27cc673d 100644
--- a/app/controllers/top.js
+++ b/app/controllers/top.js
@@ -52,7 +52,7 @@ export default Ember.Controller.extend({
} else {
seenBroadcasts = [];
}
- $.ajax(apiEndpoint + "/v3/broadcasts", options).then(() => {
+ $.ajax(apiEndpoint + "/v3/broadcasts", options).then((response) => {
var receivedBroadcasts;
if (response.broadcasts.length) {
receivedBroadcasts = response.broadcasts.filter(function(broadcast) {
diff --git a/app/helpers/filter-input.js b/app/helpers/filter-input.js
index 05202627..faf4be68 100644
--- a/app/helpers/filter-input.js
+++ b/app/helpers/filter-input.js
@@ -1,7 +1,6 @@
import Ember from 'ember';
-var TextField;
-TextField = Ember.TextField.extend({
+var TextField = Ember.TextField.extend({
keyUp(event) {
return this.sendAction('action', this.get('_value'), event);
},
@@ -18,4 +17,4 @@ export default function(params, hash, options, env) {
delete hash.on;
hash.onEvent = onEvent || 'enter';
return env.helpers.view.helperFunction.call(this, [TextField], hash, options, env);
-};
+}
diff --git a/app/helpers/format-commit.js b/app/helpers/format-commit.js
index 1faa8014..7e55b84f 100644
--- a/app/helpers/format-commit.js
+++ b/app/helpers/format-commit.js
@@ -1,4 +1,5 @@
import { safe, formatCommit as formatCommitHelper } from 'travis/utils/helpers';
+import Ember from 'ember';
export default Ember.Helper.helper(function(params) {
var commit;
diff --git a/app/helpers/format-config.js b/app/helpers/format-config.js
index ade8be98..3ace4c59 100644
--- a/app/helpers/format-config.js
+++ b/app/helpers/format-config.js
@@ -2,4 +2,4 @@ import { safe, formatConfig as formatConfigHelper } from 'travis/utils/helpers';
export default function(config, options) {
return safe(formatConfigHelper(config));
-};
+}
diff --git a/app/helpers/github-commit-link.js b/app/helpers/github-commit-link.js
index 569255c6..f159ec7a 100644
--- a/app/helpers/github-commit-link.js
+++ b/app/helpers/github-commit-link.js
@@ -1,5 +1,6 @@
import { formatCommit, safe } from 'travis/utils/helpers';
import { githubCommit as githubCommitUrl } from 'travis/utils/urls';
+import Ember from 'ember';
export default Ember.Helper.helper(function(params) {
var commitSha, sha, slug, url;
diff --git a/app/initializers/stylesheets-manager.js b/app/initializers/stylesheets-manager.js
index e79add9c..1428554e 100644
--- a/app/initializers/stylesheets-manager.js
+++ b/app/initializers/stylesheets-manager.js
@@ -1,4 +1,5 @@
-// Generated by CoffeeScript 1.10.0
+import Ember from 'ember';
+
var StylesheetsManagerInitializer, initialize, stylesheetsManager;
stylesheetsManager = Ember.Object.create({
diff --git a/app/mixins/github-url-properties.js b/app/mixins/github-url-properties.js
index 97b7a544..58f67444 100644
--- a/app/mixins/github-url-properties.js
+++ b/app/mixins/github-url-properties.js
@@ -1,4 +1,5 @@
import { githubCommit, githubPullRequest } from 'travis/utils/urls';
+import Ember from 'ember';
export default Ember.Mixin.create({
urlGithubCommit: function() {
diff --git a/app/mixins/polling.js b/app/mixins/polling.js
index f502fe07..0213671e 100644
--- a/app/mixins/polling.js
+++ b/app/mixins/polling.js
@@ -51,7 +51,7 @@ export default Ember.Mixin.create({
if (!Ember.isArray(pollModels)) {
pollModels = [pollModels];
}
- pollModels.forEach(() => {
+ pollModels.forEach( (property) => {
this.pollModel(property);
this.addObserver(property, this, 'pollModelDidChange');
return Ember.addBeforeObserver(this, property, this, 'pollModelWillChange');
@@ -68,7 +68,7 @@ export default Ember.Mixin.create({
if (!Ember.isArray(pollModels)) {
pollModels = [pollModels];
}
- pollModels.forEach(() => {
+ pollModels.forEach( (property) => {
this.stopPollingModel(property);
this.removeObserver(property, this, 'pollModelDidChange');
return Ember.removeBeforeObserver(this, property, this, 'pollModelWillChange');
diff --git a/app/models/account.js b/app/models/account.js
index f947a301..dafd1883 100644
--- a/app/models/account.js
+++ b/app/models/account.js
@@ -1,4 +1,5 @@
import Ember from 'ember';
+import DS from 'ember-data';
import Model from 'travis/models/model';
export default Model.extend({
diff --git a/app/models/branch.js b/app/models/branch.js
index d33357fe..3e9840c9 100644
--- a/app/models/branch.js
+++ b/app/models/branch.js
@@ -1,5 +1,6 @@
import Ember from 'ember';
import Model from 'travis/models/model';
+import DS from 'ember-data';
export default Model.extend({
name: DS.attr('string'),
diff --git a/app/models/broadcast.js b/app/models/broadcast.js
index ee195cd1..f9b8aaa2 100644
--- a/app/models/broadcast.js
+++ b/app/models/broadcast.js
@@ -1,9 +1,10 @@
import Ember from 'ember';
+import DS from 'ember-data';
import Model from 'travis/models/model';
-var indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+var indexOf = [].indexOf;
-export default Model.extend({
+var Broadcast = Model.extend({
message: DS.attr(),
toObject() {
@@ -36,3 +37,5 @@ Broadcast.reopenClass({
return Ember.A(seenBroadcasts || []);
}.property()
});
+
+export default Broadcast;
diff --git a/app/models/build.js b/app/models/build.js
index 64e91f2a..07f20bf2 100644
--- a/app/models/build.js
+++ b/app/models/build.js
@@ -3,6 +3,7 @@ import configKeysMap from 'travis/utils/keys-map';
import Ember from 'ember';
import Model from 'travis/models/model';
import DurationCalculations from 'travis/utils/duration-calculations';
+import DS from 'ember-data';
export default Model.extend(DurationCalculations, {
ajax: Ember.inject.service(),
diff --git a/app/models/commit.js b/app/models/commit.js
index e1bb2c89..d0609318 100644
--- a/app/models/commit.js
+++ b/app/models/commit.js
@@ -2,6 +2,7 @@ import Ember from 'ember';
import Model from 'travis/models/model';
import Build from 'travis/models/build';
import { gravatarImage } from 'travis/utils/urls';
+import DS from 'ember-data';
export default Model.extend({
sha: DS.attr(),
diff --git a/app/models/env-var.js b/app/models/env-var.js
index f8d8d175..624a16de 100644
--- a/app/models/env-var.js
+++ b/app/models/env-var.js
@@ -1,5 +1,6 @@
import Ember from 'ember';
import Model from 'travis/models/model';
+import DS from 'ember-data';
export default Model.extend({
name: DS.attr(),
diff --git a/app/models/hook.js b/app/models/hook.js
index 5c8075a1..2b2c3ed6 100644
--- a/app/models/hook.js
+++ b/app/models/hook.js
@@ -1,6 +1,7 @@
import Ember from 'ember';
import Model from 'travis/models/model';
import config from 'travis/config/environment';
+import DS from 'ember-data';
export default Model.extend({
name: DS.attr(),
diff --git a/app/models/job.js b/app/models/job.js
index 77a8514f..e4b48585 100644
--- a/app/models/job.js
+++ b/app/models/job.js
@@ -4,6 +4,7 @@ import Ember from 'ember';
import Model from 'travis/models/model';
import Log from 'travis/models/log';
import DurationCalculations from 'travis/utils/duration-calculations';
+import DS from 'ember-data';
export default Model.extend(DurationCalculations, {
ajax: Ember.inject.service(),
diff --git a/app/models/log.js b/app/models/log.js
index 067b8f6b..f0875206 100644
--- a/app/models/log.js
+++ b/app/models/log.js
@@ -12,7 +12,7 @@ var Request = Ember.Object.extend({
return this.get('ajax').ajax("/jobs/" + this.id + "/log?cors_hax=true", 'GET', {
dataType: 'text',
headers: this.HEADERS,
- success: () => {
+ success: (body, status, xhr) => {
return Ember.run(this, function() {
return this.handle(body, status, xhr);
});
@@ -51,7 +51,7 @@ var Request = Ember.Object.extend({
}
});
-var Log = Ember.Object.extend({
+var LogModel = Ember.Object.extend({
version: 0,
isLoaded: false,
length: 0,
@@ -180,4 +180,4 @@ var Log = Ember.Object.extend({
}
});
-export default Log;
+export default LogModel;
diff --git a/app/models/repo.js b/app/models/repo.js
index a4083be3..89ead250 100644
--- a/app/models/repo.js
+++ b/app/models/repo.js
@@ -3,6 +3,9 @@ import Model from 'travis/models/model';
import { durationFrom as durationFromHelper } from 'travis/utils/helpers';
import Build from 'travis/models/build';
import Config from 'travis/config/environment';
+import DS from 'ember-data';
+import Ember from 'ember';
+
var Repo;
if (Config.useV3API) {
@@ -153,7 +156,7 @@ Repo.reopen({
stats: function() {
if (this.get('slug')) {
- return this.get('_stats') || $.get("https://api.github.com/repos/" + this.get('slug'), () => {
+ return this.get('_stats') || $.get("https://api.github.com/repos/" + this.get('slug'), (data) => {
this.set('_stats', data);
return this.notifyPropertyChange('stats');
}) && {};
diff --git a/app/models/request.js b/app/models/request.js
index 858e1635..29c58941 100644
--- a/app/models/request.js
+++ b/app/models/request.js
@@ -1,5 +1,6 @@
import Ember from 'ember';
import Model from 'travis/models/model';
+import DS from 'ember-data';
export default Model.extend({
created_at: DS.attr(),
diff --git a/app/models/ssh-key.js b/app/models/ssh-key.js
index bd01047d..5be840f4 100644
--- a/app/models/ssh-key.js
+++ b/app/models/ssh-key.js
@@ -1,4 +1,5 @@
import Ember from 'ember';
+import DS from 'ember-data';
import Model from 'travis/models/model';
export default Model.extend({
diff --git a/app/models/user.js b/app/models/user.js
index 74cc7859..0b8a4fd7 100644
--- a/app/models/user.js
+++ b/app/models/user.js
@@ -1,6 +1,7 @@
import Ember from 'ember';
import Model from 'travis/models/model';
import config from 'travis/config/environment';
+import DS from 'ember-data';
export default Model.extend({
ajax: Ember.inject.service(),
@@ -42,11 +43,9 @@ export default Model.extend({
permissions = Ember.ArrayProxy.create({
content: []
});
- this.get('_rawPermissions').then((function(_this) {
- return function(data) {
- return permissions.set('content', data.permissions);
- };
- })(this));
+ this.get('_rawPermissions').then((data) => {
+ return permissions.set('content', data.permissions);
+ });
return permissions;
}.property(),
@@ -55,7 +54,7 @@ export default Model.extend({
permissions = Ember.ArrayProxy.create({
content: []
});
- this.get('_rawPermissions').then(() => {
+ this.get('_rawPermissions').then((data) => {
return permissions.set('content', data.admin);
});
return permissions;
@@ -66,7 +65,7 @@ export default Model.extend({
permissions = Ember.ArrayProxy.create({
content: []
});
- this.get('_rawPermissions').then(() => {
+ this.get('_rawPermissions').then((data) => {
return permissions.set('content', data.pull);
});
return permissions;
@@ -77,14 +76,14 @@ export default Model.extend({
permissions = Ember.ArrayProxy.create({
content: []
});
- this.get('_rawPermissions').then(() => {
+ this.get('_rawPermissions').then((data) => {
return permissions.set('content', data.push);
});
return permissions;
}.property(),
pushPermissionsPromise: function() {
- return this.get('_rawPermissions').then(() => {
+ return this.get('_rawPermissions').then((data) => {
return data.pull;
});
}.property(),
@@ -110,7 +109,7 @@ export default Model.extend({
},
poll() {
- return this.get('ajax').get('/users', () => {
+ return this.get('ajax').get('/users', (data) => {
var self;
if (data.user.is_syncing) {
self = this;
diff --git a/app/routes/accounts.js b/app/routes/accounts.js
index 6412e2ac..0049e5bc 100644
--- a/app/routes/accounts.js
+++ b/app/routes/accounts.js
@@ -22,13 +22,5 @@ export default TravisRoute.extend({
outlet: 'left',
into: 'profile'
});
- },
-
- organizations() {
- return model.filterBy('type', 'organization');
- },
-
- user() {
- return model.filterBy('type', 'user')[0];
}
});
diff --git a/app/routes/application.js b/app/routes/application.js
index 2d0be412..4633a779 100644
--- a/app/routes/application.js
+++ b/app/routes/application.js
@@ -24,7 +24,7 @@ export default TravisRoute.extend(BuildFaviconMixin, {
this.get('stylesheetsManager').disable('dashboard');
if (!config.pro) {
repos = this.get('store').peekAll('repo');
- repos.forEach(() => {
+ repos.forEach((repo) => {
return this.subscribeToRepo(repo);
});
return repos.addArrayObserver(this, {
@@ -39,7 +39,7 @@ export default TravisRoute.extend(BuildFaviconMixin, {
reposDidChange(array, start, removedCount, addedCount) {
var addedRepos;
addedRepos = array.slice(start, start + addedCount);
- return addedRepos.forEach(() => {
+ return addedRepos.forEach((repo) => {
return this.subscribeToRepo(repo);
});
},
diff --git a/app/routes/first-sync.js b/app/routes/first-sync.js
index a2e1b455..830a6e29 100644
--- a/app/routes/first-sync.js
+++ b/app/routes/first-sync.js
@@ -1,4 +1,5 @@
import SimpleLayoutRoute from 'travis/routes/simple-layout';
+import Ember from 'ember';
export default SimpleLayoutRoute.extend({
activate() {
diff --git a/app/routes/home.js b/app/routes/home.js
index baa9d6fa..406eed42 100644
--- a/app/routes/home.js
+++ b/app/routes/home.js
@@ -1,6 +1,7 @@
import BasicRoute from 'travis/routes/basic';
import config from 'travis/config/environment';
import limit from 'travis/utils/computed-limit';
+import Ember from 'ember';
export default BasicRoute.extend({
init: function() {
@@ -23,7 +24,7 @@ export default BasicRoute.extend({
},
loadMoreRepos() {
- return this.store.findAll('build').then(() => {
+ return this.store.findAll('build').then( (builds) => {
var repoIds, repos;
repoIds = builds.mapBy('data.repo').uniq();
repos = this.get('repos.repos');
diff --git a/app/routes/job.js b/app/routes/job.js
index 08e0f2bd..fa944ea2 100644
--- a/app/routes/job.js
+++ b/app/routes/job.js
@@ -25,7 +25,7 @@ export default TravisRoute.extend({
buildController = this.controllerFor('build');
model.get('repo');
if (buildPromise = model.get('build')) {
- buildPromise.then(() => {
+ buildPromise.then( (build) => {
build = this.store.recordForId('build', build.get('id'));
return buildController.set('build', build);
});
diff --git a/app/routes/repo.js b/app/routes/repo.js
index 0057b069..eb638147 100644
--- a/app/routes/repo.js
+++ b/app/routes/repo.js
@@ -26,7 +26,10 @@ export default TravisRoute.extend({
serialize(repo) {
var name, owner, ref, slug;
slug = repo.get ? repo.get('slug') : repo.slug;
- ref = slug.split('/'), owner = ref[0], name = ref[1];
+ ref = slug.split('/');
+ owner = ref[0];
+ name = ref[1];
+
return {
owner: owner,
name: name
diff --git a/app/routes/settings.js b/app/routes/settings.js
index 248ceaa1..52e9e4e1 100644
--- a/app/routes/settings.js
+++ b/app/routes/settings.js
@@ -1,5 +1,6 @@
import TravisRoute from 'travis/routes/basic';
import config from 'travis/config/environment';
+import Ember from 'ember';
export default TravisRoute.extend({
ajax: Ember.inject.service(),
@@ -36,7 +37,7 @@ export default TravisRoute.extend({
fetchSshKey() {
var repo;
repo = this.modelFor('repo');
- return this.get('ajax').get("/repos/" + (repo.get('id')) + "/key", () => {
+ return this.get('ajax').get("/repos/" + (repo.get('id')) + "/key", (data) => {
return Ember.Object.create({
fingerprint: data.fingerprint
});
diff --git a/app/services/ajax.js b/app/services/ajax.js
index 7d647ce1..3f9f8e34 100644
--- a/app/services/ajax.js
+++ b/app/services/ajax.js
@@ -1,4 +1,4 @@
-import Ember from 'ember';;
+import Ember from 'ember';
import config from 'travis/config/environment';
var default_options;
@@ -61,8 +61,10 @@ export default Ember.Service.extend({
options = options || {};
token = Ember.get(this, 'auth').token();
if (token && (this.needsAuth(method, url) || options.forceAuth)) {
- options.headers || (options.headers = {});
- (base = options.headers)['Authorization'] || (base['Authorization'] = "token " + token);
+ options.headers = options.headers || {};
+ if(!options.headers['Authorization']) {
+ options.headers['Authorization'] = "token " + token;
+ }
}
options.url = url = "" + endpoint + url;
options.type = method;
@@ -97,30 +99,7 @@ export default Ember.Service.extend({
};
options = $.extend(options, default_options);
- if (typeof testMode !== "undefined" && testMode !== null) {
- console.log('Running ajax with', options.url);
- return new Ember.RSVP.Promise(function(resolve, reject) {
- var oldError, oldSuccess;
- oldSuccess = options.success;
- options.success = function(json, status, xhr) {
- Ember.run(this, function() {
- return oldSuccess.call(this, json, status, xhr);
- });
- return Ember.run(null, resolve, json);
- };
- oldError = options.error;
- options.error = function(jqXHR) {
- if (jqXHR) {
- jqXHR.then = null;
- }
- return Ember.run(this, function() {
- oldError.call(this, jqXHR);
- return reject(jqXHR);
- });
- };
- return $.ajax(options);
- });
- }
+
if (options.data && (method === "GET" || method === "HEAD")) {
params = jQuery.param(options.data);
delimeter = url.indexOf('?') === -1 ? '?' : '&';
@@ -158,7 +137,6 @@ export default Ember.Service.extend({
if (xhr.readyState === 4) {
contentType = xhr.getResponseHeader('Content-Type');
data = (function() {
- var error1;
if (contentType && contentType.match(/application\/json/)) {
try {
return jQuery.parseJSON(xhr.responseText);
diff --git a/app/services/auth.js b/app/services/auth.js
index fdd48900..634a2dd6 100644
--- a/app/services/auth.js
+++ b/app/services/auth.js
@@ -1,4 +1,5 @@
import config from 'travis/config/environment';
+import Ember from 'ember';
export default Ember.Service.extend({
store: Ember.inject.service(),
@@ -9,7 +10,7 @@ export default Ember.Service.extend({
receivingEnd: location.protocol + "//" + location.host,
init: function() {
- return window.addEventListener('message', () => {
+ return window.addEventListener('message', (e) => {
return this.receiveMessage(e);
});
},
@@ -52,9 +53,13 @@ export default Ember.Service.extend({
},
autoSignIn(data) {
- data || (data = this.userDataFrom(this.get('sessionStorage')) || this.userDataFrom(this.get('storage')));
+ if(!data) {
+ data = this.userDataFrom(this.get('sessionStorage')) ||
+ this.userDataFrom(this.get('storage'));
+ }
+
if (data) {
- return this.setData(data);
+ this.setData(data);
}
},
@@ -200,7 +205,7 @@ export default Ember.Service.extend({
},
sendToApp(name) {
- var error, error1, router;
+ var error, router;
// TODO: this is an ugly solution, we need to do one of 2 things:
// * find a way to check if we can already send an event to remove try/catch
@@ -214,7 +219,7 @@ export default Ember.Service.extend({
return router.send(name);
} catch (error1) {
error = error1;
- if (!(error.message = ~/Can't trigger action/)) {
+ if (!(error.message.match(/Can't trigger action/))) {
throw error;
}
}
diff --git a/app/services/flashes.js b/app/services/flashes.js
index 4a159e07..91a7f379 100644
--- a/app/services/flashes.js
+++ b/app/services/flashes.js
@@ -28,6 +28,10 @@ export default Ember.Service.extend({
loadFlashes(msgs) {
var i, len, msg, results, type;
+ var callback = function() {
+ return this.get('flashes.content').removeObject(msg);
+ };
+
results = [];
for (i = 0, len = msgs.length; i < len; i++) {
msg = msgs[i];
@@ -37,9 +41,7 @@ export default Ember.Service.extend({
message: msg[type]
};
this.get('flashes').unshiftObject(msg);
- results.push(Ember.run.later(this, (function() {
- return this.get('flashes.content').removeObject(msg);
- }), 15000));
+ results.push(Ember.run.later(this, callback, 15000));
}
return results;
},
diff --git a/app/services/polling.js b/app/services/polling.js
index 941036ee..77c42436 100644
--- a/app/services/polling.js
+++ b/app/services/polling.js
@@ -61,7 +61,7 @@ export default Ember.Service.extend({
return model.reload();
});
- return this.get('sources').forEach( () => {
+ return this.get('sources').forEach( (source) => {
if (Ember.get(source, 'isDestroyed')) {
return this.get('sources').removeObject(source);
} else {
diff --git a/app/services/session-storage.js b/app/services/session-storage.js
index 9db75cd4..e70cc32e 100644
--- a/app/services/session-storage.js
+++ b/app/services/session-storage.js
@@ -4,7 +4,7 @@ import Storage from 'travis/utils/hash-storage';
export default StorageService.extend({
init: function() {
- var err, error, storage;
+ var err, storage;
storage = null;
try {
// firefox will not throw error on access for sessionStorage var,
diff --git a/app/services/storage.js b/app/services/storage.js
index 3fe52eeb..74a8a98b 100644
--- a/app/services/storage.js
+++ b/app/services/storage.js
@@ -3,7 +3,7 @@ import Storage from 'travis/utils/hash-storage';
export default Ember.Service.extend({
init: function() {
- var err, error, storage;
+ var err, storage;
storage = null;
try {
storage = window.localStorage || (function() {
diff --git a/app/services/store.js b/app/services/store.js
index acad91d4..eb44c531 100644
--- a/app/services/store.js
+++ b/app/services/store.js
@@ -1,5 +1,6 @@
import DS from 'ember-data';
import Config from 'travis/config/environment';
+import Ember from 'ember';
export default DS.Store.extend({
auth: Ember.inject.service(),
@@ -21,7 +22,9 @@ export default DS.Store.extend({
canHandleEvent(event, data) {
var callback, name, ref, ref1, type;
- ref = event.split(':'), name = ref[0], type = ref[1];
+ ref = event.split(':');
+ name = ref[0];
+ type = ref[1];
ref1 = this.get('pusherEventHandlerGuards');
for (name in ref1) {
callback = ref1[name];
@@ -34,7 +37,10 @@ export default DS.Store.extend({
receivePusherEvent(event, data) {
var build, commit, job, name, ref, ref1, ref2, type;
- ref = event.split(':'), name = ref[0], type = ref[1];
+ ref = event.split(':');
+ name = ref[0];
+ type = ref[1];
+
if (!this.canHandleEvent(event, data)) {
return;
}
diff --git a/app/utils/keys-map.js b/app/utils/keys-map.js
index 0e488198..b41f0707 100644
--- a/app/utils/keys-map.js
+++ b/app/utils/keys-map.js
@@ -1,3 +1,5 @@
+import Ember from 'ember';
+
var configKeys, configKeysMap, languageConfigKeys;
languageConfigKeys = {
diff --git a/app/utils/lines-selector.js b/app/utils/lines-selector.js
index 06d82aba..0465e48b 100644
--- a/app/utils/lines-selector.js
+++ b/app/utils/lines-selector.js
@@ -57,7 +57,7 @@ export default (function() {
LinesSelector.prototype.highlightLines = function(tries) {
var elements, lines;
- tries || (tries = 0);
+ tries = tries || 0;
this.removeAllHighlights();
if (lines = this.getSelectedLines()) {
elements = this.element.find('p:visible').slice(lines.first - 1, lines.last);
diff --git a/app/utils/pusher.js b/app/utils/pusher.js
index 1d43dcb2..79abb419 100644
--- a/app/utils/pusher.js
+++ b/app/utils/pusher.js
@@ -1,4 +1,5 @@
import ENV from 'travis/config/environment';
+import Ember from 'ember';
var TravisPusher = function(config, ajaxService) {
this.init(config, ajaxService);
@@ -165,7 +166,7 @@ if (ENV.pro) {
Pusher.authorizers.bulk_ajax = function(socketId, _callback) {
var channels, name, names;
channels = Travis.pusher.pusher.channels;
- channels.callbacks || (channels.callbacks = []);
+ channels.callbacks = channels.callbacks || [];
name = this.channel.name;
names = Object.keys(channels.channels);
channels.callbacks.push(function(auths) {
diff --git a/app/utils/tailing.js b/app/utils/tailing.js
index 31092349..8b749088 100644
--- a/app/utils/tailing.js
+++ b/app/utils/tailing.js
@@ -6,12 +6,10 @@ export default (function() {
this.tail_selector = tail_selector;
this.log_selector = log_selector;
this.position = this.window.scrollTop();
- this.window.scroll((function(_this) {
- return function() {
- return Ember.run.throttle(_this, _this.onScroll, [], 200, false);
- };
- })(this));
- this;
+ this.window.scroll(() => {
+ return Ember.run.throttle(this, this.onScroll, [], 200, false);
+ });
+ return this;
}
Tailing.prototype.options = {
diff --git a/app/utils/to-top.js b/app/utils/to-top.js
index af636618..36cfe5e1 100644
--- a/app/utils/to-top.js
+++ b/app/utils/to-top.js
@@ -12,12 +12,10 @@ export default (function() {
this.element_selector = element_selector;
this.container_selector = container_selector;
this.position = this.window.scrollTop();
- this.window.scroll((function(_this) {
- return function() {
- return Ember.run.throttle(_this, _this.onScroll, [], 200, false);
- };
- })(this));
- this;
+ this.window.scroll(() => {
+ return Ember.run.throttle(this, this.onScroll, [], 200, false);
+ });
+ return this;
}
ToTop.prototype.element = function() {
diff --git a/app/views/application.js b/app/views/application.js
index 2ea44153..f706832f 100644
--- a/app/views/application.js
+++ b/app/views/application.js
@@ -1,4 +1,5 @@
import BasicView from 'travis/views/basic';
+import Ember from 'ember';
export default BasicView.extend({
popup: Ember.inject.service(),
diff --git a/app/views/repo-show-tabs.js b/app/views/repo-show-tabs.js
index fa6c0d48..d670f07f 100644
--- a/app/views/repo-show-tabs.js
+++ b/app/views/repo-show-tabs.js
@@ -18,7 +18,7 @@ export default Ember.View.extend({
}.property('tab'),
classBranches: function() {
- this.get('tab') === 'branches' ? 'active' : null;
+ return this.get('tab') === 'branches' ? 'active' : null;
}.property('tab'),
classBuild: function() {
diff --git a/app/views/repo.js b/app/views/repo.js
index 481bf35d..102c711c 100644
--- a/app/views/repo.js
+++ b/app/views/repo.js
@@ -3,6 +3,7 @@ import StatusImagesView from 'travis/views/status-images';
import BasicView from 'travis/views/basic';
import config from 'travis/config/environment';
import Polling from 'travis/mixins/polling';
+import Ember from 'ember';
export default BasicView.extend(Polling, {
popup: Ember.inject.service(),
diff --git a/tests/.jshintrc b/tests/.jshintrc
index c5379a55..fc1b8922 100644
--- a/tests/.jshintrc
+++ b/tests/.jshintrc
@@ -46,7 +46,8 @@
"currentPath",
"currentRouteName",
"jQuery",
- "Visibility"
+ "Visibility",
+ "Travis"
],
"node": false,
"browser": false,
diff --git a/tests/unit/components/build-repo-actions-test.js b/tests/unit/components/build-repo-actions-test.js
index 39efe5ff..17054150 100644
--- a/tests/unit/components/build-repo-actions-test.js
+++ b/tests/unit/components/build-repo-actions-test.js
@@ -1,5 +1,5 @@
-// Generated by CoffeeScript 1.10.0
import { test, moduleForComponent } from 'ember-qunit';
+import Ember from 'ember';
moduleForComponent('build-repo-actions', 'BuildRepoActionsComponent', {});
test('it shows cancel button if canCancel is true', function() {
diff --git a/tests/unit/components/jobs-item-test.js b/tests/unit/components/jobs-item-test.js
index ced37799..5af424db 100644
--- a/tests/unit/components/jobs-item-test.js
+++ b/tests/unit/components/jobs-item-test.js
@@ -1,5 +1,5 @@
-// Generated by CoffeeScript 1.10.0
import { test, moduleForComponent } from 'ember-qunit';
+import Ember from 'ember';
moduleForComponent('jobs-item', 'JobsItemComponent', {
needs: ['helper:format-duration', 'helper:pretty-date', 'component:status-icon']
});