This repository has been archived by the owner on Oct 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Give the ability to update the currently installed plugins.
- Loading branch information
Blaine Schmeisser
committed
Jul 31, 2016
1 parent
3dda1b1
commit 139a3b4
Showing
12 changed files
with
175 additions
and
44 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
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
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
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,4 @@ | ||
module.exports = (path) => { | ||
delete require.cache[path] | ||
return require(path) | ||
} |
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,38 @@ | ||
const exec = require('child_process').execFile | ||
const which = require('which') | ||
|
||
const git = (args, options) => { | ||
return new Promise((resolve, reject) => { | ||
which('git', (err, resolvedPath) => { | ||
if (err) return reject('GIT was not found on your system') | ||
exec(resolvedPath, args, options || {}, (err) => { | ||
err && reject(err) || resolve() | ||
}) | ||
}) | ||
}) | ||
} | ||
|
||
const pull = (packagePath) => { | ||
return git(['pull'], { cwd: packagePath }).catch((err) => { | ||
if (err.message.match(/ENOENT/i)) { | ||
throw new Error('Package "' + name + '" is not cloneed') | ||
} else { | ||
throw err | ||
} | ||
}) | ||
} | ||
|
||
const clone = (name, packagePath) => { | ||
const packageUrl = '[email protected]:' + name + '.git' | ||
return git(['clone', packageUrl, packagePath]).catch((err) => { | ||
if (err.message.match(/already exists/i)) { | ||
return // futher promises will resolve | ||
} else if (err.message.match(/Repository not found/i)) { | ||
throw new Error('Package "' + name + '" does not exist on github') | ||
} else { | ||
throw err | ||
} | ||
}) | ||
} | ||
|
||
module.exports = { clone, pull, git } |
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
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
Oops, something went wrong.