Skip to content
This repository was archived by the owner on May 14, 2021. It is now read-only.

Commit cd3b81f

Browse files
committed
support for ignore flag (fix for #10)
1 parent 6906374 commit cd3b81f

File tree

14 files changed

+67
-17
lines changed

14 files changed

+67
-17
lines changed

lib/commands/helpers/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/commands/new.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/commands/update.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/commands/usage/new.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ Add a new app from the specified repository, directory or file
55
Properties:
66

77
phonegap, android-phonegap, ios-phonegap, winphone-phonegap, hydrates, share,
8-
tag, debug, private, android-key, windows-key, ios-key, winphone-key
8+
tag, debug, private, android-key, windows-key, ios-key, winphone-key, ignore
9+
10+
The ignore flag allows you to specify directories or files that should NOT
11+
be uploaded. It supports the glob format (https://git-scm.com/docs/gitignore)
12+
and can be specified multiple times.
913

1014
Options:
1115

lib/commands/usage/update.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ directory or file
66
Properties:
77

88
phonegap, android-phonegap, ios-phonegap, winphone-phonegap, hydrates, share,
9-
tag, debug, private, android-key, windows-key, ios-key, winphone-key
9+
tag, debug, private, android-key, windows-key, ios-key, winphone-key, ignore
10+
11+
The ignore flag allows you to specify directories or files that should NOT
12+
be uploaded. It supports the glob format (https://git-scm.com/docs/gitignore)
13+
and can be specified multiple times.
1014

1115
Options:
1216

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pgb-cli",
3-
"version": "1.0.4-dev",
3+
"version": "1.1.0",
44
"description": "nodeJS CLI to PhoneGap Build",
55
"keywords": [
66
"PhoneGap",
@@ -55,7 +55,7 @@
5555
},
5656
"dependencies": {
5757
"easy-utf8-table": "^0.2.0",
58-
"pgb-api": "^1.0.5",
58+
"pgb-api": "^1.1.1",
5959
"visualwidth": "^0.1.0"
6060
}
6161
}

src/commands/helpers/app.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11
const payload = require('./payload')
2+
const merge = require('../../util/misc').merge
3+
const path = require('path')
4+
const fs = require('fs')
25

36
module.exports.getData = (repoOrFile) => {
47
let data = { keys: {} }
58

9+
if (repoOrFile) {
10+
try {
11+
let file = path.resolve(path.join(repoOrFile, '.pgbrc'))
12+
pgb.opts.variables = merge(JSON.parse(fs.readFileSync(file, 'utf8')), pgb.opts.variables)
13+
pgb.debug(`reading ${file}`)
14+
} catch (e) {
15+
if (e.name === 'SyntaxError') {
16+
throw new Error('invalid json in .pgbrc file')
17+
}
18+
}
19+
}
20+
621
payload.addVariables(
722
data, 'hydrates', 'share', 'tag', 'debug', 'private', 'pull', 'zip', 'android-phonegap:android_phonegap_version',
823
'winphone-phonegap:winphone_phonegap_version', 'ios-phonegap:ios_phonegap_version', 'phonegap:phonegap_version'
@@ -12,5 +27,7 @@ module.exports.getData = (repoOrFile) => {
1227
data.keys, 'android-key:android', 'windows-key:windows', 'ios-key:ios', 'winphone-key:winphone'
1328
)
1429

30+
data.ignore = pgb.opts.variables.ignore || []
31+
1532
return data
1633
}

src/commands/new.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ module.exports = () => {
88
has.args(1)
99

1010
let progress = BindProgress()
11+
let repoOrFile = pgb.opts.commands[1]
1112

12-
return pgb.api.addApp(pgb.opts.commands[1], appHelper.getData())
13+
return pgb.api.addApp(repoOrFile, appHelper.getData(repoOrFile))
1314
.then(app => {
1415
pgb.print(`app ${pgb.colours.bold(app.id)} added`)
1516
return wait(app).then((app) => pgb.print({ bare: app.id, json: app }))

src/commands/update.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ module.exports = () => {
1010
let id = has.id(pgb.opts.commands[1])
1111

1212
let progress = BindProgress()
13+
let repoOrFile = pgb.opts.commands[2]
1314

14-
return pgb.api.updateApp(id, pgb.opts.commands[2], appHelper.getData())
15+
return pgb.api.updateApp(id, repoOrFile, appHelper.getData(repoOrFile))
1516
.then((app) => {
1617
pgb.print(`app ${pgb.colours.bold(app.id)} updated`)
1718
return wait(app).then((app) =>

src/commands/usage/new.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ Add a new app from the specified repository, directory or file
55
Properties:
66

77
phonegap, android-phonegap, ios-phonegap, winphone-phonegap, hydrates, share,
8-
tag, debug, private, android-key, windows-key, ios-key, winphone-key
8+
tag, debug, private, android-key, windows-key, ios-key, winphone-key, ignore
9+
10+
The ignore flag allows you to specify directories or files that should NOT
11+
be uploaded. It supports the glob format (https://git-scm.com/docs/gitignore)
12+
and can be specified multiple times.
913

1014
Options:
1115

0 commit comments

Comments
 (0)