Skip to content

Commit

Permalink
Release 0.1.4
Browse files Browse the repository at this point in the history
- Fixed issue with regular fallback if no identity provided
- Exemplar code for CLI and API
- Does not affect CLI usage, but API’s
  • Loading branch information
sethlu committed Dec 27, 2015
1 parent 24f021d commit 0f38ee1
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 15 deletions.
35 changes: 29 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,46 @@ npm install electron-osx-sign -g
electron-osx-sign <app> [optional flags...]
```

Example:

```sh
electron-osx-sign path/to/my.app
```

For details on the optional flags, run `electron-osx-sign --help` or see [usage.txt](https://github.com/sethlu/electron-sign/blob/master/usage.txt).

### Programmatic API
### From the API

```javascript
var sign = require('electron-osx-sign')
sign(app[, opts[, function done (err) { }]])
sign(opts[, function done (err) { }])
```

#### sign(app, opts, callback)
Example:

##### app
```javascript
var sign = require('electron-osx-sign')
sign({
app: 'path/to/my.app'
}, function done (err) {
if (err) {
// Handle the error
return;
}
// Regular callback
})
```

Path to the application
#### sign(opts, callback)

##### opts

**Required**

`app` - *String*

Path to the application package.

**Optional**

`entitlements` - *String*
Expand Down Expand Up @@ -106,7 +129,7 @@ A successful testing should look something like:
```
$ npm test
> electron-sign@0.1.3 test electron-osx-sign
> electron-sign@0.1.4 test electron-osx-sign
> standard && tape test
Calling electron-download before running tests...
Expand Down
6 changes: 4 additions & 2 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ var args = require('minimist')(process.argv.slice(2), {boolean: ['help']})
var usage = fs.readFileSync(__dirname + '/usage.txt').toString()
var sign = require('./')

if (!args._[0] || args.help) {
args.app = args._[0]

if (!args.app || args.help) {
console.log(usage)
process.exit(0)
}

sign(args._[0], args, function done (err) {
sign(args, function done (err) {
if (err) {
console.error('Sign failed.')
if (err.message) console.error(err.message)
Expand Down
10 changes: 4 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,11 @@ function signApplication (opts, callback) {
})
}

module.exports = function sign (app, opts, cb) {
if (!opts) opts = {}
if (!cb) cb = function () {}
opts.app = app
module.exports = function sign (opts, cb) {
if (!opts.app) return cb(new Error('Path to aplication must be specified.'))
if (!fs.existsSync(opts.app)) return cb(new Error('Application not found.'))

if (!cb) cb = function () {}

// Match platform if none is provided
if (!opts.platform) {
var appFrameworksPath = generateAppFrameworksPath(opts)
Expand Down Expand Up @@ -217,7 +215,7 @@ module.exports = function sign (app, opts, cb) {
if (!opts.identity) cb(new Error('No identity found for signing.'))
cb()
})
}
} else cb()
}
], function (err) {
if (err) return cb(err)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "electron-osx-sign",
"version": "0.1.3",
"version": "0.1.4",
"description": "Codesign for Electron-packed apps",
"main": "index.js",
"bin": {
Expand Down

0 comments on commit 0f38ee1

Please sign in to comment.