1.0.0 • Published 2 years ago
simple-installer-tool v1.0.0
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 coto manage execution flow
License
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, seeinstallProgramfor detailsprefix :string- (optional) used for installation process, prepends part of command toname, seeinstallProgramfor detailspostfix :string- (optional) used for installation process, appends part of command toname, seeinstallProgramfor detailsupdate :generator function- (optional) if program is already installed it runs user code for an updatetempFolder :string- (optional) overwritesSimpleInstaller.tempFolderinstallMessage :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 runsrunUpdateIfExistsisInstalled :function- uses crossplatform version ofwhichverifying thatinfo.nameexists in your pathrunUpdateIfExists :generator function- ifinfo.updateexists, it will run it.thisis referring toinfoobjectchooseInstallProcess :generator function- ifinfo.linkwasn't specified it runsinstallProgram, else it runsdownloadAndInstalldownloadAndInstall :generator function- downloadsinfo.linkand runsinstallPrograminstallProgram :function- concatenatesinfo.prefix,info.nameandinfo.postfixand 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.
1.0.0
2 years ago