Skip to content

Commit

Permalink
Merge pull request #3 from Megapixel99/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Megapixel99 authored Apr 1, 2020
2 parents 9cc759f + 32e3d98 commit aaf506c
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
binarys/
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ and
```bash
$ npm install -g pkg
```
##### Building:
Before pushing any changes, please build the project using:
##### Building/Releasing:
Before releasing any new versions, please build the project binary(s) using:
```bash
$ pkg --out-path $PATH_TO_PROJECT/GAM/binarys PATH_TO_PROJECT/GAM/src/manager.js
```
Expand All @@ -25,4 +25,4 @@ $ pkg --out-path $PATH_TO_PROJECT/GAM/binarys PATH_TO_PROJECT/GAM/src/manager.js
##### To Do:
- Modify build script for Windows and Linux
- Add CLI option to view current alias
- Add CLI option to create backups of SSH keys
- Add CLI option to create backups of SSH keys (In progress)
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ To view a full list of commands and options:
$ gam help
```

****If you have pre-exsisting SSH keys, you may have to recreate them, and copy
the old keys into the new one to use this CLI application.****

## Contributing
Please see `CONTRIBUTING.md`

Expand Down
Binary file removed binarys/manager-linux
Binary file not shown.
Binary file removed binarys/manager-macos
Binary file not shown.
Binary file removed binarys/manager-win.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gam",
"version": "1.0.0",
"version": "1.0.1",
"description": "GAM is a NodeJS application for managing multiple Git accounts (aliases).",
"main": "index.js",
"scripts": {
Expand Down
15 changes: 6 additions & 9 deletions src/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,15 @@ function generateKey(alias, email, passphrase, bits, dir) {
}

function changeEmail(email) {
new Promise(function(resolve, reject) {
return new Promise(function(resolve, reject) {
exec("git config --global user.email " + "\"" + email + "\"", (error, stdout, stderr) => {
if (error) {
reject(error);
}
if (stderr) {
reject(stderr);
}
resolve();
});
}).then(function() {
exec("git config --local user.email " + "\"" + email + "\"", (error2, stdout, stderr2) => {
Expand All @@ -82,20 +83,20 @@ function changeEmail(email) {
if (stderr2) {
reject(stderr2);
}
resolve();
});
});
}

function changeName(name) {
new Promise(function(resolve, reject) {
return new Promise(function(resolve, reject) {
exec("git config --global user.name " + "\"" + name + "\"", (error, stdout, stderr) => {
if (error) {
reject(error);
}
if (stderr) {
reject(stderr);
}
resolve();
});
}).then(function() {
exec("git config --local user.name " + "\"" + name + "\"", (error2, stdout, stderr2) => {
Expand All @@ -105,7 +106,6 @@ function changeName(name) {
if (stderr2) {
reject(stderr2);
}
resolve();
});
})
}
Expand Down Expand Up @@ -258,11 +258,8 @@ async function changeAlias(alias, dir) {
fs.writeFileSync(path.join(dir, "id_rsa"), fs.readFileSync(path.join(dir, "id_rsa_" + alias)))
]
Promise.all(promises).then(async function() {
let new_promises = [
changeEmail(email),
changeName(name)
]
Promise.all(new_promises).then(async function() {
await changeEmail(email).then(async function() {
await changeName(name);
console.log("Successfully changed git alias" + "\n" +
"Current alias: " + alias);
}).catch(function(err) {
Expand Down

0 comments on commit aaf506c

Please sign in to comment.