added update script

master
Gregory Scheerlinck 8 years ago
parent a43524f30e
commit 34bac71520

@ -14,35 +14,34 @@ With colors (this depends on your own configuration) and showing off language su
npm install -g arch-wiki-man npm install -g arch-wiki-man
``` ```
Or you can also install it [through the AUR](https://aur.archlinux.org/packages/arch-wiki-man/). For example, using yaourt: Or install it [through the AUR](https://aur.archlinux.org/packages/arch-wiki-man/). For example, using yaourt:
``` ```
yaourt -S arch-wiki-man yaourt -S arch-wiki-man
``` ```
# Updating through npm # Update with `awman-update`
## npm Updates are pushed automatically every two days to `https://github.com/greg-js/arch-wiki-md-repo`, a dependency for this project.
Just reinstall the package: Fetch all changes with the `awman-update` script:
``` ```
npm install -g arch-wiki-man awman-update
``` ```
Updates are pushed automatically every two days to `https://github.com/greg-js/arch-wiki-md-repo`, a dependency for this project. Whenever the install command is run, arch-wiki-man will fetch the changes from arch-wiki-md-repo, giving you access to the latest changes. Even when there are no new changes since the last update, running `awman-update` will actually reinstall the underlying repo, so you can use it in case something somehow goes wrong.
## yaourt # Update by reinstalling the package
Just reinstall the package (see paragraph above for explanation): `awman-update` is faster and more convenient, but you can also get the latest changes simply by reinstalling this global package:
``` ```
yaourt -S arch-wiki-man npm install -g arch-wiki-man # for npm users
yaourt -S arch-wiki-man # for AUR users (yaourt is just an example, use any helper you want)
``` ```
Of course you don't *have* to use yaourt for reinstalling the package, this is just an example. Use any helper you want or compile the AUR package yourself.
# Usage & Examples # Usage & Examples
## Basic ## Basic

@ -0,0 +1,26 @@
#!/usr/bin/env node
'use strict';
var npmi = require('npmi');
var path = require('path');
var options = {
name: 'arch-wiki-md-repo',
path: path.resolve(__dirname + '/..'),
forceInstall: true
};
npmi(options, function(err, result) {
if (err) {
if (err.code === npmi.LOAD_ERR) {
console.log('npm load error');
}
else if (err.code === npmi.INSTALL_ERR) {
console.log('npm install error');
}
return console.log(err.message);
}
console.log(options.name + ' has been successfully updated or reinstalled.');
});

@ -4,11 +4,11 @@
"description": "The Arch Wiki as linux man pages", "description": "The Arch Wiki as linux man pages",
"main": "index.js", "main": "index.js",
"bin": { "bin": {
"awman": "bin/find.js" "awman": "bin/find.js",
"awman-update": "bin/update.js"
}, },
"scripts": { "scripts": {
"test": "./node_modules/mocha/bin/mocha ./test", "test": "./node_modules/mocha/bin/mocha ./test"
"update": "npm update arch-wiki-md-repo"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -28,6 +28,7 @@
"chalk": "^1.1.1", "chalk": "^1.1.1",
"inquirer": "^0.12.0", "inquirer": "^0.12.0",
"markdown2troff": "^0.1.0", "markdown2troff": "^0.1.0",
"npmi": "^2.0.1",
"sanitize-filename": "^1.5.3", "sanitize-filename": "^1.5.3",
"tmp": "0.0.28", "tmp": "0.0.28",
"yargs": "^3.32.0" "yargs": "^3.32.0"

Loading…
Cancel
Save