Skip to content

Commit

Permalink
Add naked exe support, closes #78
Browse files Browse the repository at this point in the history
  • Loading branch information
fasterthanlime committed Dec 14, 2015
1 parent cd206be commit 1e706e6
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/tasks/install/exe.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ let self = {
log(opts, `found generic installer type: ${type}`)

if (!type) {
throw new Error(`unsupported installer type: ${type}`)
return require(`./naked`)
}

return require(`./${type}`)
Expand Down
42 changes: 42 additions & 0 deletions app/tasks/install/naked.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@


let log = require('../../util/logger')('install/naked')
let rimraf = require('../../promised/rimraf')

let fs = require('fs')
let path = require('path')

function cp (source, target) {
return new Promise(function (resolve, reject) {
var rd = fs.createReadStream(source)
rd.on('error', reject)
var wr = fs.createWriteStream(target)
wr.on('error', reject)
wr.on('finish', resolve)
rd.pipe(wr)
})
}

let self = {
install: async function (opts) {
let archive_path = opts.archive_path
let dest_path = opts.dest_path

let dest_file_path = path.join(dest_path, path.basename(archive_path))
log(opts, `copying ${archive_path} to ${dest_file_path}`)

await cp(archive_path, dest_file_path)
},

uninstall: async function (opts) {
let dest_path = opts.dest_path

log(opts, `nuking ${dest_path}`)

await rimraf(dest_path, {
disableGlob: true // rm -rf + globs sound like the kind of evening I don't like
})
}
}

module.exports = self

0 comments on commit 1e706e6

Please sign in to comment.