Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ALiangLiang committed May 18, 2017
0 parents commit 58139a0
Show file tree
Hide file tree
Showing 12 changed files with 710 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# node
node_modules
npm-debug*.log

# this project
config/*
!config/default-0.json5

# system
tmux-*
37 changes: 37 additions & 0 deletions Port.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
class Port {
constructor(port, project) {
this._port = port;
this._project = project;
}

free() {
this._project = void 0;
}

set project(project) {
this._project = project;
}

get project() {
return this._project;
}

get isFree() {
return !this._project;
}

get number() {
return this._port;
}

set project(project) {
// two way assign
if(!project.port) {
this.project = project;
project.port = this;
} else
console.log('Ths project is running on port ' + project.port.number);
}
}

module.exports = Port;
67 changes: 67 additions & 0 deletions Project.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
class Project {
constructor(options) {
this._name = options.name;
this._path = options.path;
this._port = options.port;
this._c9 = options.c9;
this._active = false;
}

killC9() {
const c9 = this._c9;
if (c9 && c9.pid && !c9.killed) {
try {
process.kill(c9.pid);
} catch(err) {
return false;
}
this._port.free();
this._port = void 0;
return true;
} else
return false;
}

get isActive() {
return !!this._port;
}

get name() {
return this._name;
}

set path(path) {
this._path = path;
}

get path() {
return this._path;
}

set port(port) {
// two way assign
if(port.isFree) {
this._port = port;
port.project = this;
} else
console.log('Ths port is not free. Used by project' + port.project.name);
}

get port() {
return this._port;
}

get isActive() {
return !!this._port;
}

set c9(c9) {
this._c9 = c9;
}

get c9() {
return this._c9;
}
}

module.exports = Project;
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Cloud9 Launcher

It's a Nodejs application allows you manage your Cloud9 IDE workflows on your own server without the need of a terminal.

### Install

#### Cloud9 IDE

reference [c9/core](https://github.com/c9/core)

#### Cloud9 Launcher

```sh
git clone https://github.com/ALiangLiang/cloud9-launcher.git
cd cloud9-launcher
cp config/default-0.json5 config/local-0.json5
vim config/local-0.json5 # fill this configure file
npm start
```
Loading

0 comments on commit 58139a0

Please sign in to comment.