Skip to content

Commit

Permalink
Opts app-copyright (NSHumanReadableCopyright on OS X)
Browse files Browse the repository at this point in the history
Fix: maxogden#163
  • Loading branch information
sethlu committed Feb 17, 2016
1 parent 92a63a9 commit 50eb49a
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mac.js
Expand Up @@ -58,6 +58,7 @@ module.exports = {
var appVersion = opts['app-version']
var buildVersion = opts['build-version']
var appCategoryType = opts['app-category-type']
var humanReadableCopyright = opts['app-copyright']

appPlist.CFBundleDisplayName = opts.name
appPlist.CFBundleIdentifier = appBundleIdentifier
Expand Down Expand Up @@ -96,6 +97,10 @@ module.exports = {
appPlist.LSApplicationCategoryType = appCategoryType
}

if (humanReadableCopyright) {
appPlist.NSHumanReadableCopyright = humanReadableCopyright
}

fs.writeFileSync(appPlistFilename, plist.build(appPlist))
fs.writeFileSync(helperPlistFilename, plist.build(helperPlist))
fs.writeFileSync(helperEHPlistFilename, plist.build(helperEHPlist))
Expand Down
4 changes: 4 additions & 0 deletions readme.md
Expand Up @@ -137,6 +137,10 @@ packager(opts, function done (err, appPath) { })

Valid values are listed in [Apple's documentation](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8).

`app-copyright` - *String*

The copyrights string to use in the app plist, will be displayed in the application About box (OS X only).

`app-version` - *String*

The release version of the application. Maps to the `ProductVersion` metadata property on Windows, and `CFBundleShortVersionString` on OS X.
Expand Down
32 changes: 32 additions & 0 deletions test/mac.js
Expand Up @@ -215,6 +215,34 @@ function createAppHelpersBundleTest (baseOpts, helperBundleId, appBundleId) {
}
}

function createAppHumanReadableCopyrightTest (baseOpts, humanReadableCopyright) {
return function (t) {
t.timeoutAfter(config.timeout)

var plistPath
var opts = Object.create(baseOpts)
opts['app-copyright'] = humanReadableCopyright

waterfall([
function (cb) {
packager(opts, cb)
}, function (paths, cb) {
plistPath = path.join(paths[0], opts.name + '.app', 'Contents', 'Info.plist')
fs.stat(plistPath, cb)
}, function (stats, cb) {
t.true(stats.isFile(), 'The expected Info.plist file should exist')
fs.readFile(plistPath, 'utf8', cb)
}, function (file, cb) {
var obj = plist.parse(file)
t.equal(obj.NSHumanReadableCopyright, opts['app-copyright'], 'NSHumanReadableCopyright should reflect opts["app-copyright"]')
cb()
}
], function (err) {
t.end(err)
})
}
}

// Share testing script with platform darwin and mas
module.exports = function (baseOpts) {
util.setup()
Expand Down Expand Up @@ -348,4 +376,8 @@ module.exports = function (baseOpts) {
util.setup()
test('app helpers bundle helper-bundle-id & app-bundle-id fallback test', createAppHelpersBundleTest(baseOpts))
util.teardown()

util.setup()
test('app humanReadableCopyright test', createAppHumanReadableCopyrightTest(baseOpts, 'Copyright © 2003–2015 Organization. All rights reserved.'))
util.teardown()
}
1 change: 1 addition & 0 deletions usage.txt
Expand Up @@ -13,6 +13,7 @@ all equivalent to --platform=all --arch=all
app-bundle-id bundle identifier to use in the app plist (darwin/mas platform only)
app-category-type the application category type (darwin/mas platform only)
For example, `app-category-type=public.app-category.developer-tools` will set the application category to 'Developer Tools'.
app-copyright copyrights string to use in the app plist (darwin/mas platform only)
app-version release version to set for the app
asar packages the source code within your app into an archive
asar-unpack unpacks the files to app.asar.unpacked directory whose filenames regex .match this string
Expand Down

0 comments on commit 50eb49a

Please sign in to comment.