Skip to content

Commit

Permalink
Opts app-copyright (NSHumanReadableCopyright on OS X)
Browse files Browse the repository at this point in the history
  • Loading branch information
sethlu committed Feb 16, 2016
1 parent 92a63a9 commit f417079
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mac.js
Original file line number Diff line number Diff line change
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
32 changes: 32 additions & 0 deletions test/mac.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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)

This comment has been minimized.

Copy link
@malept

malept Feb 17, 2016

"copyright string"

Also, something similar needs to go in readme.md.

This comment has been minimized.

Copy link
@sethlu

sethlu Feb 17, 2016

Author Owner

I'll have it fixed soon.

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 f417079

Please sign in to comment.