-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c5e1f5a
Showing
10 changed files
with
176 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = tab | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"node": true, | ||
"esnext": true, | ||
"bitwise": true, | ||
"camelcase": true, | ||
"curly": true, | ||
"eqeqeq": true, | ||
"immed": true, | ||
"indent": 4, | ||
"newcap": true, | ||
"noarg": true, | ||
"quotmark": "single", | ||
"regexp": true, | ||
"undef": true, | ||
"unused": true, | ||
"strict": true, | ||
"trailing": true, | ||
"smarttabs": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
language: objective-c | ||
install: brew install node | ||
script: | ||
- npm install | ||
- npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
var bundleId = require('./index'); | ||
var input = process.argv[2]; | ||
|
||
if (!input || process.argv.indexOf('-h') !== -1 || process.argv.indexOf('--help') !== -1) { | ||
return console.log('Usage\n bundle-id <bundle name>\n\nExample\n bundle-id Safari\n => com.apple.Safari\n\nReturns the bundle identifier from a bundle name'); | ||
} | ||
|
||
if (process.argv.indexOf('-v') !== -1 || process.argv.indexOf('--version') !== -1) { | ||
return console.log(require('./package').version); | ||
} | ||
|
||
bundleId(input, function (err, id) { | ||
if (err) { | ||
throw err; | ||
} | ||
|
||
console.log(id); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict'; | ||
var execFile = require('child_process').execFile; | ||
|
||
module.exports = function (bundleName, cb) { | ||
var script = 'get id of application "' + bundleName + '"'; | ||
|
||
execFile('osascript', ['-e', script], function (err, stdout) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
|
||
cb(err, stdout.trim()); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"name": "bundle-id", | ||
"version": "0.0.0", | ||
"description": "Get bundle identifier from a bundle name (OS X): Safari => com.apple.Safari", | ||
"license": "MIT", | ||
"bin": { | ||
"bundle-id": "cli.js" | ||
}, | ||
"repository": "sindresorhus/bundle-id", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "http://sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"os": [ | ||
"darwin" | ||
], | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"cli.js" | ||
], | ||
"keywords": [ | ||
"osx", | ||
"mac", | ||
"plist", | ||
"applescript", | ||
"bundle", | ||
"bundleid", | ||
"bundlename", | ||
"id", | ||
"identifier", | ||
"CFBundleName", | ||
"CFBundleIdentifier", | ||
"uti", | ||
"cli", | ||
"bin" | ||
], | ||
"devDependencies": { | ||
"mocha": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# bundle-id [![Build Status](https://travis-ci.org/sindresorhus/bundle-id.png?branch=master)](http://travis-ci.org/sindresorhus/bundle-id) | ||
|
||
> Get [bundle identifier](https://developer.apple.com/library/Mac/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/plist/info/CFBundleIdentifier) from a [bundle name](https://developer.apple.com/library/Mac/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/plist/info/CFBundleName) (OS X): `Safari` => `com.apple.Safari` | ||
See [bundle-name](https://github.com/sindresorhus/bundle-name) for the reverse. | ||
|
||
|
||
## Install | ||
|
||
``` | ||
npm install --save bundle-id | ||
``` | ||
|
||
|
||
## Example | ||
|
||
```js | ||
var bundleId = require('bundle-id'); | ||
|
||
bundleId('Safari', function (err, id) { | ||
console.log(id); | ||
//=> com.apple.Safari | ||
}); | ||
``` | ||
|
||
|
||
## CLI | ||
|
||
You can also use it as a CLI app by installing it globally: | ||
|
||
``` | ||
npm install --global bundle-id | ||
``` | ||
|
||
### Usage | ||
|
||
``` | ||
bundle-id Safari | ||
``` | ||
|
||
Which will output `com.apple.Safari`. | ||
|
||
|
||
## License | ||
|
||
MIT © [Sindre Sorhus](http://sindresorhus.com) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict'; | ||
var assert = require('assert'); | ||
var bundleId = require('./index'); | ||
|
||
it('should get bundle id from bundle name', function (cb) { | ||
bundleId('Safari', function (err, id) { | ||
console.log('Bundle id:', id); | ||
assert.equal(id, 'com.apple.Safari'); | ||
cb(); | ||
}); | ||
}); |