Skip to content

Commit a39f8db

Browse files
committed
1.0.0
- sub directories would cause deploy to fail, now recursively find the strings and add them manually - delete should delete the current working directories deployment if not specified - Deployment.del removes the instance metadata from the database using the correct query params - refactors CLI to be a class - moves from easy-table to turtler - fixes login and logout functionality was mixed on cli - by default the open command will open the current directory if it is deployed - by default the log command will open the current directory if it is deployed - logs no longer have a - preceding each line - logs trim white space instead of adding an empty line - delete API actually works now, instead of continuously hanging - removes; mkdirp, easy-table, async - adds tryitout for docs page generation - config is now stored in /.deployrc - getCredentials and cacheCredentials are no longer blocking calls, they will happen async - all error responses from the server will contain an error object - not-found (application not deployed) and page-could-not-load (proxy errors) pages are now moved into a static directory - main landing page is rendered with tryitout
1 parent dd870a1 commit a39f8db

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+9006
-6690
lines changed

.eslintrc

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
{
22
"extends": "eslint:recommended",
33
"env": {
4-
"node": true,
5-
"es6": true
4+
"es6": true,
5+
"node": true
6+
},
7+
"parserOptions": {
8+
"ecmaVersion": "2017"
69
},
710
"rules": {
11+
"no-inner-declarations": 0,
812
"strict": 0,
913
"semi": [
1014
"error",
1115
"always"
16+
],
17+
"no-octal": 0,
18+
"indent": [
19+
"error",
20+
2
1221
]
1322
}
1423
}

.tryitout

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
module.exports = {
2+
title: 'deploy.sh',
3+
nav: {
4+
Source: 'https://github.com/gabrielcsapo/deploy.sh',
5+
Docs: './code/index.html'
6+
},
7+
body: `
8+
<div>
9+
<div class="main">
10+
<div>
11+
<div id="example-area">
12+
<img class="logo" src="./logo.png"/>
13+
<br/>
14+
<blockquote> an open source continuous deployment service; deploying to the ☁️ shouldn't be 🚀🔬 </blockquote>
15+
<pre id="install"></pre>
16+
</div>
17+
18+
<div class="platforms">
19+
<div class="platform">
20+
<h3 id="docker">Docker</h3>
21+
<div class="code"><span>$ my-app/</span> ls<br><b>Dockerfile</b> server.go<br><span>$ my-app/</span> deploy</div>
22+
</div>
23+
<div class="platform">
24+
<h3 id="node">Node.js</h3>
25+
<div class="code"><span>$ my-api/</span> ls<br><b>package.json</b> index.js<br><span>$ my-api/</span> deploy</div>
26+
</div>
27+
<div class="platform">
28+
<h3 id="static">Static Websites</h3>
29+
<div class="code"><span>$ my-site/</span> ls<br><b>index.html</b> logo.png<br><span>$ my-site/</span> deploy</div>
30+
</div>
31+
</div>
32+
</div>
33+
</div>
34+
</div>
35+
`,
36+
template: 'landing',
37+
options: {
38+
width: '100%'
39+
},
40+
output: './docs',
41+
footer: `
42+
<div class="text-black">Made with ☕️ by <a href="https://www.gabrielcsapo.com">@gabrielcsapo</a></div>
43+
`,
44+
externals: [,
45+
"./docs/main.css",
46+
"./docs/main.js"
47+
]
48+
};

CHANGELOG.md

+21
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
# 1.0.0 (01/27/2018)
2+
3+
- sub directories would cause deploy to fail, now recursively find the strings and add them manually
4+
- delete should delete the current working directories deployment if not specified
5+
- Deployment.del removes the instance metadata from the database using the correct query params
6+
- refactors CLI to be a class
7+
- moves from easy-table to turtler
8+
- fixes login and logout functionality was mixed on cli
9+
- by default the open command will open the current directory if it is deployed
10+
- by default the log command will open the current directory if it is deployed
11+
- logs no longer have a `-` preceding each line
12+
- logs trim white space instead of adding an empty line
13+
- delete API actually works now, instead of continuously hanging
14+
- removes; mkdirp, easy-table, async
15+
- adds tryitout for docs page generation
16+
- config is now stored in `${homedir}/.deployrc`
17+
- getCredentials and cacheCredentials are no longer blocking calls, they will happen async
18+
- all error responses from the server will contain an error object
19+
- not-found (application not deployed) and page-could-not-load (proxy errors) pages are now moved into a static directory
20+
- main landing page is rendered with tryitout
21+
122
# 0.2.1 (08/15/2017)
223

324
- adds the ability to delete deployment and its assets

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
> ☁️ open source continuous deployment service
44
5-
![Status](https://img.shields.io/badge/release-beta-orange.svg)
65
[![Npm Version](https://img.shields.io/npm/v/deploy.sh.svg)](https://www.npmjs.com/package/deploy.sh)
76
[![Coverage Status](https://lcov-server.gabrielcsapo.com/badge/github%2Ecom/gabrielcsapo/deploy.sh.svg)](https://lcov-server.gabrielcsapo.com/coverage/github%2Ecom/gabrielcsapo/deploy.sh)
87
[![Dependency Status](https://starbuck.gabrielcsapo.com/badge/github/gabrielcsapo/deploy.sh/status.svg)](https://starbuck.gabrielcsapo.com/github/gabrielcsapo/deploy.sh)
@@ -11,6 +10,6 @@
1110
![npm](https://img.shields.io/npm/dt/deploy.sh.svg)
1211
![npm](https://img.shields.io/npm/dm/deploy.sh.svg)
1312

14-
![Static Example](https://github.com/gabrielcsapo/deploy.sh/blob/master/docs/example-static.gif?raw=true)
13+
![Static Example](./docs/example.gif)
1514

1615
To learn more visit [http://www.gabrielcsapo.com/deploy.sh/](http://www.gabrielcsapo.com/deploy.sh/)

TODO.md

-17
This file was deleted.

bin/deploy-delete.js

+6-34
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,11 @@
11
#!/usr/bin/env node
22

3-
const Async = require('async');
4-
const ora = require('ora');
3+
module.exports = async function(cli, spinner) {
4+
spinner.text = `Deleting deployment ${cli.application}`;
55

6-
const program = require('commander');
7-
program
8-
.option('-u, --url [url]', 'The endpoint of the deploy.sh server', 'http://localhost:5000')
9-
.parse(process.argv);
6+
const { token, username } = await cli.getCredentials();
107

11-
const name = program.args[0];
12-
const { deleteDeployment, getCredentials } = require('../lib/helpers/cli')(program.url);
8+
await cli.deleteDeployment({ token, username, name: cli.application });
139

14-
const spinner = ora(`Deleting deployment instance`).start();
15-
16-
Async.waterfall([
17-
function(callback) {
18-
spinner.text = 'Getting deploy keys';
19-
20-
getCredentials()
21-
.then((credentials) => callback(null, credentials))
22-
.catch((ex) => callback(ex, null));
23-
},
24-
function(credentials, callback) {
25-
spinner.text = 'Calling delete API';
26-
27-
const { token, username } = credentials;
28-
29-
deleteDeployment({ token, username, name })
30-
.then(() => callback())
31-
.catch((error) => callback(error));
32-
}
33-
], (ex) => {
34-
if (ex) return spinner.fail(`API call failed 🙈 ${JSON.stringify({
35-
ex
36-
}, null, 4)}`);
37-
38-
spinner.succeed('deployment deleted successfully');
39-
});
10+
spinner.succeed(`Deployment deleted, ${cli.application} successfully`);
11+
};

bin/deploy-deploy.js

+25-55
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,31 @@
11
#!/usr/bin/env node
22

3-
const Async = require('async');
43
const fs = require('fs');
54
const path = require('path');
6-
const ora = require('ora');
7-
8-
const program = require('commander');
9-
program
10-
.option('-u, --url [url]', 'The endpoint of the deploy.sh server', 'http://localhost:5000')
11-
.parse(process.argv);
12-
13-
const { removeBundle, createBundle, uploadBundle, getCredentials } = require('../lib/helpers/cli')(program.url);
14-
15-
const spinner = ora(`Starting deploy process`).start();
16-
17-
Async.waterfall([
18-
function(callback) {
19-
spinner.text = 'Creating application bundle';
20-
21-
createBundle(process.cwd())
22-
.then(() => callback(null))
23-
.catch((ex) => callback(ex, null));
24-
},
25-
function(callback) {
26-
spinner.text = 'Getting deploy keys';
27-
28-
getCredentials()
29-
.then((credentials) => callback(null, credentials))
30-
.catch((ex) => callback(ex, null));
31-
},
32-
function(credentials, callback) {
33-
spinner.start();
34-
spinner.text = 'Uploading application bundle';
35-
36-
const { token, username } = credentials;
37-
const bundle = fs.createReadStream(path.resolve(process.cwd(), 'bundle.tgz'));
38-
39-
uploadBundle({
40-
name: path.basename(process.cwd()),
41-
bundle,
42-
token,
43-
username
44-
})
45-
.then((response) => callback(null, response))
46-
.catch((error) => callback(error, null));
47-
},
48-
function(project, callback) {
49-
spinner.text = 'Cleaning up local files';
50-
51-
removeBundle(process.cwd())
52-
.then(() => callback(null, project))
53-
.catch((error) => callback(error, null));
54-
}
55-
], (ex, deployment) => {
56-
if (ex) return spinner.fail(`Deployment failed 🙈 ${JSON.stringify({
57-
ex
58-
}, null, 4)}`);
5+
6+
module.exports = async function(cli, spinner) {
7+
spinner.text = 'Creating application bundle';
8+
9+
await cli.createBundle(process.cwd());
10+
11+
spinner.text = 'Getting deploy keys';
12+
13+
const { token, username } = await cli.getCredentials();
14+
15+
spinner.text = 'Uploading application bundle';
16+
17+
const bundle = fs.createReadStream(path.resolve(process.cwd(), 'bundle.tgz'));
18+
19+
const { deployment } = await cli.uploadBundle({
20+
name: path.basename(process.cwd()),
21+
bundle,
22+
token,
23+
username
24+
});
25+
26+
spinner.text = 'Cleaning up local files';
27+
28+
await cli.removeBundle(process.cwd());
5929

6030
spinner.succeed(`Upload successfully, http://${deployment.subdomain}.localhost:5000`);
61-
});
31+
};

bin/deploy-list.js

+13-49
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,32 @@
11
#!/usr/bin/env node
22

3-
const Async = require('async');
4-
const ora = require('ora');
53
const moment = require('moment');
64
const Url = require('url');
7-
const Table = require('easy-table');
5+
const Table = require('turtler');
86

9-
const program = require('commander');
10-
program
11-
.option('-u, --url [url]', 'The endpoint of the deploy.sh server', 'http://localhost:5000')
12-
.parse(process.argv);
7+
module.exports = async function(cli, spinner) {
8+
spinner.text = 'Getting deployment list';
139

14-
const { getDeployments, getCredentials } = require('../lib/helpers/cli')(program.url);
15-
16-
const spinner = ora(`Getting deployment list`).start();
17-
18-
Async.waterfall([
19-
function(callback) {
20-
spinner.text = 'Getting deploy keys';
21-
22-
getCredentials()
23-
.then((credentials) => callback(null, credentials))
24-
.catch((ex) => callback(ex, null));
25-
},
26-
function(credentials, callback) {
27-
spinner.text = 'Calling list API';
28-
29-
const { token, username } = credentials;
30-
31-
getDeployments({
32-
token,
33-
username
34-
})
35-
.then((response) => callback(null, response))
36-
.catch((error) => callback(error, null));
37-
}
38-
], (ex, result) => {
39-
if (ex) return spinner.fail(`API call failed 🙈 ${JSON.stringify({
40-
ex
41-
}, null, 4)}`);
10+
const { token, username } = await cli.getCredentials();
11+
const { deployments } = await cli.getDeployments({ token, username });
4212

4313
spinner.stop();
4414

45-
const { deployments } = result;
46-
4715
if(deployments.length > 0) {
48-
var table = new Table();
16+
let data = [["name", "url", "age", "requests", "status"]];
4917

50-
deployments.forEach((r) => {
51-
const config = Url.parse(program.url);
18+
deployments.forEach((r, i) => {
19+
const config = Url.parse(cli.url);
5220
config.host = `${r.subdomain}.${config.host}`;
5321
const url = Url.format(config);
5422

55-
table.cell('name', r.name);
56-
table.cell('url', url);
57-
table.cell('age', moment(r.updated_at).fromNow());
58-
table.cell('requests', r.requests);
59-
table.cell('status', r.status);
60-
table.newRow();
23+
data[i + 1] = [r.name, url, moment(r.updated_at).fromNow(), r.requests.toString(), r.status];
6124
});
62-
table.sort('age|asc');
6325

64-
console.log(table.toString()); // eslint-disable-line
26+
let table = new Table(data);
27+
28+
console.log(table.markdown()); // eslint-disable-line
6529
} else {
6630
console.log('0 deployments found'); // eslint-disable-line
6731
}
68-
});
32+
};

0 commit comments

Comments
 (0)