Left: | ||
Right: |
OLD | NEW |
---|---|
1 # coding: utf-8 | 1 # coding: utf-8 |
2 | 2 |
3 # This Source Code Form is subject to the terms of the Mozilla Public | 3 # This Source Code Form is subject to the terms of the Mozilla Public |
4 # License, v. 2.0. If a copy of the MPL was not distributed with this | 4 # License, v. 2.0. If a copy of the MPL was not distributed with this |
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
6 | 6 |
7 import os, sys, re, subprocess, shutil, buildtools | 7 import os, sys, re, subprocess, shutil, buildtools |
8 from getopt import getopt, GetoptError | 8 from getopt import getopt, GetoptError |
9 from StringIO import StringIO | 9 from StringIO import StringIO |
10 from zipfile import ZipFile | 10 from zipfile import ZipFile |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
362 )).encode('utf-8') | 362 )).encode('utf-8') |
363 | 363 |
364 | 364 |
365 def generateDocs(baseDir, scriptName, opts, args, type): | 365 def generateDocs(baseDir, scriptName, opts, args, type): |
366 if len(args) == 0: | 366 if len(args) == 0: |
367 print 'No target directory specified for the documentation' | 367 print 'No target directory specified for the documentation' |
368 usage(scriptName, type, 'docs') | 368 usage(scriptName, type, 'docs') |
369 return | 369 return |
370 targetDir = args[0] | 370 targetDir = args[0] |
371 | 371 |
372 toolkit = None | 372 command = ['jsdoc', |
373 quiet = False | 373 '--destination', targetDir, |
374 for option, value in opts: | 374 '--access', 'all', |
375 if option in ('-t', '--toolkit'): | |
376 toolkit = value | |
377 elif option in ('-q', '--quiet'): | |
378 quiet = True | |
379 | |
380 if toolkit == None: | |
381 toolkit = os.path.join(baseDir, 'jsdoc-toolkit') | |
382 if not os.path.exists(toolkit): | |
383 subprocess.check_call(['hg', 'clone', 'https://hg.adblockplus.org/jsdoc-to olkit/', toolkit]) | |
384 | |
385 command = [os.path.join(toolkit, 'jsrun.js'), | |
386 '-t=' + os.path.join(toolkit, 'templates', 'jsdoc'), | |
387 '-d=' + targetDir, | |
388 '-a', | |
389 '-p', | |
390 '-x=js,jsm', | |
391 os.path.join(baseDir, 'lib')] | 375 os.path.join(baseDir, 'lib')] |
392 if quiet: | 376 if any(opt in ('-q', '--quiet') for opt, _ in opts): |
393 subprocess.check_output(command) | 377 subprocess.check_output(command) |
394 else: | 378 else: |
395 subprocess.check_call(command) | 379 subprocess.check_call(command) |
396 | 380 |
397 def runReleaseAutomation(baseDir, scriptName, opts, args, type): | 381 def runReleaseAutomation(baseDir, scriptName, opts, args, type): |
398 keyFiles = [] | 382 keyFiles = [] |
399 downloadsRepo = os.path.join(baseDir, '..', 'downloads') | 383 downloadsRepo = os.path.join(baseDir, '..', 'downloads') |
400 for option, value in opts: | 384 for option, value in opts: |
401 if option in ('-k', '--key'): | 385 if option in ('-k', '--key'): |
402 keyFiles.append(value) | 386 keyFiles.append(value) |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
484 | 468 |
485 with addCommand(showDescriptions, 'showdesc') as command: | 469 with addCommand(showDescriptions, 'showdesc') as command: |
486 command.shortDescription = 'Print description strings for all locales' | 470 command.shortDescription = 'Print description strings for all locales' |
487 command.description = 'Display description strings for all locales as specifie d in the corresponding meta.properties files.' | 471 command.description = 'Display description strings for all locales as specifie d in the corresponding meta.properties files.' |
488 command.addOption('Only include the given locales', short='l', long='locales', value='l1,l2,l3') | 472 command.addOption('Only include the given locales', short='l', long='locales', value='l1,l2,l3') |
489 command.params = '[options]' | 473 command.params = '[options]' |
490 command.supportedTypes = ('gecko') | 474 command.supportedTypes = ('gecko') |
491 | 475 |
492 with addCommand(generateDocs, 'docs') as command: | 476 with addCommand(generateDocs, 'docs') as command: |
493 command.shortDescription = 'Generate documentation (requires node.js)' | 477 command.shortDescription = 'Generate documentation (requires node.js)' |
494 command.description = 'Generate documentation files and write them into the sp ecified directory. This operation requires node.js to be installed.' | 478 command.description = 'Generate documentation files and write them into the sp ecified directory. This operation requires JsDoc to be installed.' |
Wladimir Palant
2015/03/31 13:13:55
Nit: JsDoc 3
Sebastian Noack
2015/03/31 13:18:16
Done.
| |
495 command.addOption('JsDoc Toolkit location', short='t', long='toolkit', value=' dir') | |
496 command.addOption('Suppress JsDoc Toolkit output', short='q', long='quiet') | 479 command.addOption('Suppress JsDoc Toolkit output', short='q', long='quiet') |
497 command.params = '[options] <directory>' | 480 command.params = '[options] <directory>' |
498 command.supportedTypes = ('gecko') | 481 command.supportedTypes = ('gecko') |
499 | 482 |
500 with addCommand(runReleaseAutomation, 'release') as command: | 483 with addCommand(runReleaseAutomation, 'release') as command: |
501 command.shortDescription = 'Run release automation' | 484 command.shortDescription = 'Run release automation' |
502 command.description = 'Note: If you are not the project owner then you '\ | 485 command.description = 'Note: If you are not the project owner then you '\ |
503 'probably don\'t want to run this!\n\n'\ | 486 'probably don\'t want to run this!\n\n'\ |
504 'Runs release automation: creates downloads for the new version, tags '\ | 487 'Runs release automation: creates downloads for the new version, tags '\ |
505 'source code repository as well as downloads and buildtools repository.' | 488 'source code repository as well as downloads and buildtools repository.' |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
577 if option in ('-h', '--help'): | 560 if option in ('-h', '--help'): |
578 usage(scriptName, type, command) | 561 usage(scriptName, type, command) |
579 sys.exit() | 562 sys.exit() |
580 commands[command](baseDir, scriptName, opts, args, type) | 563 commands[command](baseDir, scriptName, opts, args, type) |
581 else: | 564 else: |
582 print 'Command %s is not supported for this application type' % command | 565 print 'Command %s is not supported for this application type' % command |
583 usage(scriptName, type) | 566 usage(scriptName, type) |
584 else: | 567 else: |
585 print 'Command %s is unrecognized' % command | 568 print 'Command %s is unrecognized' % command |
586 usage(scriptName, type) | 569 usage(scriptName, type) |
OLD | NEW |