simple-installer-tool
v1.0.0
Published
Download and/or install programs in similar manner to chocolatey or similar installation managers.
Downloads
15
Maintainers
Readme
Simple installer
Download and/or install programs in similar manner to chocolatey or similar installation managers.
- crossplatform (tested on windows and debian)
- downloads files (optional) and runs commands
- skips already installed programs
- could be used as a simple task runner
- could work as a downloader
- simple and because of that flexible and expendable api
- tested with 100% coverage
- uses harmony mode for generators and
npm co
to manage execution flow
License
- http://unlicense.org/
Tests:
To launch tests you have to run npm install
then npm test
or if you prefer grunt test
.
If you want to contribute make sure to run grunt githooks
first thing after clone.
It will create pre-commit hook and run tests and jshint before you commit.
Please use git flow - create a feature branch for your feature and send a pull request to dev.
API:
SimpleInstaller exports a constructor, which takes and object with following properties:
link :string
- (optional) url to installer/executable or any other resourcename :string
- used for progress reporting and for installation process, seeinstallProgram
for detailsprefix :string
- (optional) used for installation process, prepends part of command toname
, seeinstallProgram
for detailspostfix :string
- (optional) used for installation process, appends part of command toname
, seeinstallProgram
for detailsupdate :generator function
- (optional) if program is already installed it runs user code for an updatetempFolder :string
- (optional) overwritesSimpleInstaller.tempFolder
installMessage :string
- (optional) used for progress reporting, overwrites default string'installing ' + info.name
Constructor has following static properties:
tempFolder :string
- defaults to "temp", all downloads will be placed here
Constructor has following prototype methods:
run :generator function
- first it runsisInstalled
, if result is successful it runschooseInstallProcess
, otherwise it runsrunUpdateIfExists
isInstalled :function
- uses crossplatform version ofwhich
verifying thatinfo.name
exists in your pathrunUpdateIfExists :generator function
- ifinfo.update
exists, it will run it.this
is referring toinfo
objectchooseInstallProcess :generator function
- ifinfo.link
wasn't specified it runsinstallProgram
, else it runsdownloadAndInstall
downloadAndInstall :generator function
- downloadsinfo.link
and runsinstallProgram
installProgram :function
- concatenatesinfo.prefix
,info.name
andinfo.postfix
and runs results as a command line
Examples:
//following will install git on windows using git.inf if git.exe doesn't exist in your path
var co = require('co');
var SimpleInstaller = require('simple-installer');
co(function* () {
yield new SimpleInstaller({
link: 'http://github.com/msysgit/msysgit/releases/download/' +
'Git-1.9.4-preview20140929/Git-1.9.4-preview20140929.exe',
name: 'git.exe',
postfix: ' /DIR="c:\\Git" /VERYSILENT /NORESTART /NOCANCEL /SP- /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS /NOICONS ' +
'/COMPONENTS="icons,ext\\reg\\shellhere,assoc,assoc_sh" /LOADINF="git.inf"'
}).run();
});
//same example for debian
var co = require('co');
var SimpleInstaller = require('simple-installer');
co(function* () {
yield new SimpleInstaller({
prefix: 'apt-get install ',
name: 'git'
}).run();
});
For advanced usage (batch install, update, ...) check example
folder.