-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update deps and linting, Drop Node < 10
- Loading branch information
1 parent
1cab3de
commit cab6f37
Showing
17 changed files
with
1,419 additions
and
243 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,11 @@ | ||
module.exports = { | ||
parserOptions: { | ||
ecmaVersion: 6, | ||
sourceType: 'script', | ||
}, | ||
env: { | ||
node: true, | ||
es6: true, | ||
}, | ||
extends: 'eslint:recommended', | ||
}; |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
yarn-error.log |
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,3 @@ | ||
module.exports = { | ||
singleQuote: true, | ||
}; |
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 |
---|---|---|
@@ -1,8 +1,4 @@ | ||
language: node_js | ||
node_js: | ||
- "0.10" | ||
- "0.12" | ||
- "4" | ||
- "10" | ||
- "node" | ||
|
||
sudo: false |
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 |
---|---|---|
@@ -1,25 +1,38 @@ | ||
<h3>Heroku!</h3> | ||
<div ng-show="userIsCreator"> | ||
<a ng-hide="userConfig.accounts.length" | ||
href="/ext/heroku/oauth?redirect=/[[ project.name ]]/config" | ||
class="btn btn-success">Add a Heroku Account</a> | ||
<a | ||
ng-hide="userConfig.accounts.length" | ||
href="/ext/heroku/oauth?redirect=/[[ project.name ]]/config" | ||
class="btn btn-success" | ||
>Add a Heroku Account</a | ||
> | ||
<div ng-show="userConfig.accounts.length"> | ||
<div class="accounts"> | ||
<h4>Linked Accounts</h4> | ||
<select ng-model="account" | ||
ng-options="account.email for account in userConfig.accounts track by account.id"></select> | ||
<a href="/ext/heroku/oauth?redirect=/[[ project.name ]]/config" | ||
class="btn btn-success">Add a Heroku Account</a> | ||
<select | ||
ng-model="account" | ||
ng-options="account.email for account in userConfig.accounts track by account.id" | ||
></select> | ||
<a | ||
href="/ext/heroku/oauth?redirect=/[[ project.name ]]/config" | ||
class="btn btn-success" | ||
>Add a Heroku Account</a | ||
> | ||
</div> | ||
<div class="apps"> | ||
<h4>Apps</h4> | ||
Deploy to: <select ng-model="config.app" ng-options="app.name for app in account.cache track by app.id"></select> | ||
<button ng-click="getApps()" class="btn"><i class="icon-refresh"></i> Refresh Apps List</button> | ||
Deploy to: | ||
<select | ||
ng-model="config.app" | ||
ng-options="app.name for app in account.cache track by app.id" | ||
></select> | ||
<button ng-click="getApps()" class="btn"> | ||
<i class="icon-refresh"></i> Refresh Apps List | ||
</button> | ||
</div> | ||
<button ng-click="save()" class="btn btn-primary">Save</button> | ||
</div> | ||
</div> | ||
<p ng-hide="userIsCreator"> | ||
Only the creator can setup this project for heroku | ||
deployment. | ||
Only the creator can setup this project for heroku deployment. | ||
</p> |
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 |
---|---|---|
@@ -1,53 +1,61 @@ | ||
'use strict'; | ||
/* eslint-disable no-undef */ | ||
|
||
app.controller('HerokuController', ['$scope', '$element', function ($scope, $element) { | ||
$scope.saving = false; | ||
app.controller('HerokuController', [ | ||
'$scope', | ||
'$element', | ||
function ($scope) { | ||
$scope.saving = false; | ||
|
||
$scope.$watch('userConfigs.heroku', function (value) { | ||
if (!value) return; | ||
$scope.$watch('userConfigs.heroku', function (value) { | ||
if (!value) return; | ||
|
||
$scope.userConfig = value; | ||
$scope.userConfig = value; | ||
|
||
if (!$scope.account && value.accounts && value.accounts.length > 0) { | ||
$scope.account = value.accounts[0]; | ||
} | ||
}); | ||
if (!$scope.account && value.accounts && value.accounts.length > 0) { | ||
$scope.account = value.accounts[0]; | ||
} | ||
}); | ||
|
||
$scope.$watch('configs[branch.name].heroku.config', function (value) { | ||
$scope.config = value; | ||
$scope.$watch('configs[branch.name].heroku.config', function (value) { | ||
$scope.config = value; | ||
|
||
if (value && value.app && $scope.userConfig.accounts) { | ||
for (var i = 0; i < $scope.userConfig.accounts.length; i++) { | ||
if ($scope.userConfig.accounts[i].id === value.app.account) { | ||
$scope.account = $scope.userConfig.accounts[i]; | ||
break; | ||
if (value && value.app && $scope.userConfig.accounts) { | ||
for (var i = 0; i < $scope.userConfig.accounts.length; i++) { | ||
if ($scope.userConfig.accounts[i].id === value.app.account) { | ||
$scope.account = $scope.userConfig.accounts[i]; | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
}); | ||
|
||
$scope.save = function () { | ||
$scope.saving = true; | ||
$scope.save = function () { | ||
$scope.saving = true; | ||
|
||
$scope.pluginConfig('heroku', $scope.config, function () { | ||
$scope.saving = false; | ||
}); | ||
}; | ||
|
||
$scope.getApps = function () { | ||
if (!$scope.account) { | ||
return console.warn('tried to getApps but no account'); | ||
} | ||
|
||
$.ajax('/ext/heroku/apps/' + $scope.account.id, { | ||
type: 'GET', | ||
success: function (body, req) { | ||
$scope.account.cache = body; | ||
$scope.success('Got accounts list for ' + $scope.account.email, true); | ||
}, | ||
error: function () { | ||
$scope.error('Failed to get accounts list for ' + $scope.account.email, true); | ||
$scope.pluginConfig('heroku', $scope.config, function () { | ||
$scope.saving = false; | ||
}); | ||
}; | ||
|
||
$scope.getApps = function () { | ||
if (!$scope.account) { | ||
return console.warn('tried to getApps but no account'); | ||
} | ||
}); | ||
}; | ||
}]); | ||
|
||
$.ajax('/ext/heroku/apps/' + $scope.account.id, { | ||
type: 'GET', | ||
success: function (body) { | ||
$scope.account.cache = body; | ||
$scope.success('Got accounts list for ' + $scope.account.email, true); | ||
}, | ||
error: function () { | ||
$scope.error( | ||
'Failed to get accounts list for ' + $scope.account.email, | ||
true | ||
); | ||
}, | ||
}); | ||
}; | ||
}, | ||
]); |
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
#plugin-heroku { | ||
select { | ||
margin-bottom: 0; | ||
|
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
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 |
---|---|---|
@@ -1,20 +1,28 @@ | ||
'use strict'; | ||
/* eslint-disable no-undef */ | ||
|
||
app.controller('HerokuUserController', ['$scope', '$element', function ($scope, $element) { | ||
$scope.$watch('user.jobplugins.heroku', function (value) { | ||
$scope.config = value; | ||
}); | ||
|
||
$scope.remove = function (account) { | ||
$.ajax('/ext/heroku/account/' + account.id, { | ||
type: 'DELETE', | ||
success: function () { | ||
$scope.config.accounts.splice($scope.config.accounts.indexOf(account), 1); | ||
$scope.success('Removed account', true); | ||
}, | ||
error: function () { | ||
$scope.error('Failed to remove account', true); | ||
} | ||
app.controller('HerokuUserController', [ | ||
'$scope', | ||
'$element', | ||
function ($scope) { | ||
$scope.$watch('user.jobplugins.heroku', function (value) { | ||
$scope.config = value; | ||
}); | ||
}; | ||
}]); | ||
|
||
$scope.remove = function (account) { | ||
$.ajax('/ext/heroku/account/' + account.id, { | ||
type: 'DELETE', | ||
success: function () { | ||
$scope.config.accounts.splice( | ||
$scope.config.accounts.indexOf(account), | ||
1 | ||
); | ||
$scope.success('Removed account', true); | ||
}, | ||
error: function () { | ||
$scope.error('Failed to remove account', true); | ||
}, | ||
}); | ||
}; | ||
}, | ||
]); |
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 |
---|---|---|
@@ -1,8 +1,7 @@ | ||
|
||
#job-heroku { | ||
textarea { | ||
width: 100%; | ||
height: 200px; | ||
font-size: 10px; | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,40 +1,45 @@ | ||
|
||
var superagent = require('superagent') | ||
, API = "https://api.heroku.com" | ||
const superagent = require('superagent'); | ||
const API = 'https://api.heroku.com'; | ||
|
||
module.exports = { | ||
getApps: getApps, | ||
addKey: addKey | ||
} | ||
addKey: addKey, | ||
}; | ||
|
||
function getApps(aid, token, done) { | ||
superagent.get(API + '/apps') | ||
superagent | ||
.get(API + '/apps') | ||
.set('Accept', 'application/vnd.heroku+json; version=3') | ||
.set('Authorization', 'Bearer ' + token) | ||
.end(function (res) { | ||
if (res.status !== 200) return done(new Error('Status: ' + res.status + '; ' + res.text)) | ||
done(null, res.body.map(function (app) { | ||
return { | ||
id: app.id, | ||
name: app.name, | ||
account: aid, | ||
git_url: app.git_url, | ||
web_url: app.web_url, | ||
updated_at: app.updated_at | ||
} | ||
})) | ||
}) | ||
if (res.status !== 200) | ||
return done(new Error('Status: ' + res.status + '; ' + res.text)); | ||
done( | ||
null, | ||
res.body.map(function (app) { | ||
return { | ||
id: app.id, | ||
name: app.name, | ||
account: aid, | ||
git_url: app.git_url, | ||
web_url: app.web_url, | ||
updated_at: app.updated_at, | ||
}; | ||
}) | ||
); | ||
}); | ||
} | ||
|
||
function addKey(token, key, done) { | ||
superagent.post(API + '/user/keys') | ||
superagent | ||
.post(API + '/user/keys') | ||
.set('Accept', 'application/vnd.heroku+json; version=3') | ||
.set('Authorization', 'Bearer ' + token) | ||
.set('Content-type', 'text/ssh-authkey') | ||
.send(key) | ||
.end(function (res) { | ||
if (res.status !== 200) return done(new Error('Status: ' + res.status + '; ' + res.text)) | ||
done() | ||
}) | ||
if (res.status !== 200) | ||
return done(new Error('Status: ' + res.status + '; ' + res.text)); | ||
done(); | ||
}); | ||
} | ||
|
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 |
---|---|---|
|
@@ -7,7 +7,8 @@ | |
"test": "test" | ||
}, | ||
"scripts": { | ||
"test": "make test" | ||
"test": "npm run lint", | ||
"lint": "eslint ." | ||
}, | ||
"repository": { | ||
"type": "git", | ||
|
@@ -22,8 +23,6 @@ | |
], | ||
"author": "Jared Forsyth <[email protected]>", | ||
"license": "MIT", | ||
"gitHead": "0c7459f2fa57385c0b6bc71e98ef01be99fad226", | ||
"readmeFilename": "Readme.md", | ||
"strider": { | ||
"id": "heroku", | ||
"type": "job", | ||
|
@@ -39,14 +38,13 @@ | |
} | ||
}, | ||
"dependencies": { | ||
"ssh-keypair": "~1.0.0", | ||
"strider-git": "~0.1.0", | ||
"superagent": "~0.15.5", | ||
"passport-heroku": "0.0.2", | ||
"step": "0.0.5" | ||
"passport-heroku": "1.0.0", | ||
"ssh-keypair": "^2.0.0", | ||
"step": "^1.0.0", | ||
"strider-git": "^1.0.3", | ||
"superagent": "^5.2.2" | ||
}, | ||
"devDependencies": { | ||
"jshint": "~2.3.0", | ||
"mocha": "~1.14.0" | ||
"eslint": "^7.0.0" | ||
} | ||
} |
Oops, something went wrong.