add basic tests, remove unused folder, make linux out dir behave like other OSes

This commit is contained in:
Max Ogden 2015-06-27 19:48:35 -05:00
parent 5cc8a4b688
commit 86edff69d8
8 changed files with 62 additions and 7 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
downloaded/*.zip
node_modules
.DS_Store
.DS_Store
test/dist

View File

@ -1 +0,0 @@
downloaded atom shell zips get cached here

View File

@ -7,7 +7,7 @@ var common = require('./common')
module.exports = {
createApp: function createApp (opts, templateApp, cb) {
var finalDir = opts.out || path.join(process.cwd(), opts.name + '-linux')
var finalDir = path.join(opts.out || process.cwd(), opts.name + '-linux')
var userAppDir = path.join(finalDir, 'resources', 'default_app')
var originalBinary = path.join(finalDir, 'electron')
var finalBinary = path.join(finalDir, opts.name)

2
mac.js
View File

@ -108,7 +108,7 @@ function buildMacApp (opts, cb, newApp) {
} else {
deploy()
}
function deploy (err) {
if (err) return cb(err)
mv(newApp, finalPath, function moved (err) {

View File

@ -29,9 +29,13 @@
"rimraf": "^2.3.2"
},
"devDependencies": {
"standard": "^3.3.2"
"standard": "^3.3.2",
"tape": "^4.0.0"
},
"scripts": {
"test": "standard"
"test": "standard && node test/test.js"
},
"standard": {
"ignore": ["test/dist"]
}
}

View File

@ -88,7 +88,7 @@ Allowed values: *linux, win32, darwin*
Allowed values: *ia32, x64*
`version` - *String*
Semver, see https://github.com/atom/electron/releases
Electron version (without the 'v'). See https://github.com/atom/electron/releases
**Optional**
`out` - *String*

45
test/test.js Normal file
View File

@ -0,0 +1,45 @@
var test = require('tape')
var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var packager = require('../index.js')
var distdir = __dirname + '/dist'
rimraf.sync(distdir)
mkdirp.sync(distdir)
var opts = {
dir: __dirname + '/testapp',
name: 'Test',
version: '0.28.2',
out: distdir
}
test('package for windows', function (t) {
opts.platform = 'win32'
opts.arch = 'ia32'
packager(opts, function done (err, appPath) {
t.notOk(err, 'no err')
t.end()
})
})
test('package for linux', function (t) {
opts.platform = 'linux'
opts.arch = 'x64'
packager(opts, function done (err, appPath) {
t.notOk(err, 'no err')
t.end()
})
})
test('package for darwin', function (t) {
opts.platform = 'darwin'
opts.arch = 'x64'
packager(opts, function done (err, appPath) {
t.notOk(err, 'no err')
t.end()
})
})

6
test/testapp/app.js Normal file
View File

@ -0,0 +1,6 @@
var app = require('app')
app.on('ready', function () {
console.log('pizza')
app.exit()
})