From b9160dbf831d0a72dd32b4043986198c9c561cbf Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 5 Dec 2016 13:41:17 -0500 Subject: Better release zip generation --- .gitignore | 4 +++- docs/.gitignore | 1 + jarmonbuild/commands.py | 32 ++++++++++++++++++++------------ 3 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 docs/.gitignore diff --git a/.gitignore b/.gitignore index 38688f9..f825d82 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *.pyc -*.zip + /build/ +/test.rrd +/jarmon-*.zip diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..6a7cbfd --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +/apidocs/ diff --git a/jarmonbuild/commands.py b/jarmonbuild/commands.py index e4c20ca..ebd6ebc 100644 --- a/jarmonbuild/commands.py +++ b/jarmonbuild/commands.py @@ -72,11 +72,11 @@ class BuildApidocsCommand(BuildCommand): """ parser = OptionParser( - usage='build [options] %s VERSION' % (self.command_name,)) + usage='build [options] %s VERSION [DIRECTORY]' % (self.command_name,)) parser.disable_interspersed_args() options, args = parser.parse_args(argv) - if len(args) != 1: + if len(args) != 1 and len(args) != 2: parser.error('Wrong number of arguments. This command expects a ' 'version number only.') @@ -85,6 +85,8 @@ class BuildApidocsCommand(BuildCommand): tmpdir = gettempdir() workingbranch_dir = self.workingbranch_dir build_dir = self.build_dir + apidocs_dir = os.path.join(args[1] if len(args) == 2 else build_dir, 'docs', 'apidocs') + yuidoc_dir = os.path.join(build_dir, YUIDOC_DIR) # Check for yuidoc dependencies for r in pkg_resources.parse_requirements(YUIDOC_DEPENDENCIES): @@ -130,9 +132,7 @@ class BuildApidocsCommand(BuildCommand): self.log.debug('YUI Doc checksum verified') # Remove any existing apidocs so that we can track removed files - shutil.rmtree(os.path.join(build_dir, 'docs', 'apidocs'), True) - - yuidoc_dir = os.path.join(build_dir, YUIDOC_DIR) + shutil.rmtree(apidocs_dir, True) # extract yuidoc folder from the downloaded zip file self.log.debug( @@ -147,10 +147,8 @@ class BuildApidocsCommand(BuildCommand): sys.executable, os.path.join(yuidoc_dir, 'bin', 'yuidoc.py'), os.path.join(workingbranch_dir, 'jarmon'), - '--parseroutdir=%s' % ( - os.path.join(build_dir, 'docs', 'apidocs'),), - '--outputdir=%s' % ( - os.path.join(build_dir, 'docs', 'apidocs'),), + '--parseroutdir=%s' % (apidocs_dir,), + '--outputdir=%s' % (apidocs_dir,), '--template=%s' % ( os.path.join( workingbranch_dir, 'jarmonbuild', 'yuidoc_template'),), @@ -187,11 +185,21 @@ class BuildReleaseCommand(BuildCommand): workingbranch_dir = self.workingbranch_dir build_dir = self.build_dir + self.log.debug('Clean the build folder') + shutil.rmtree(build_dir, True) + os.mkdir(build_dir) + self.log.debug('Export versioned files to a build folder') check_call(('git', '--work-tree=%s' % (build_dir,), 'checkout', '-f')) self.log.debug('Generate apidocs') - BuildApidocsCommand().main([buildversion]) + BuildApidocsCommand().main([buildversion, build_dir]) + + self.log.debug('Generate jsdeps') + BuildJavascriptDependenciesCommand().main([build_dir]) + + self.log.debug('Generate testdata') + BuildTestDataCommand().main([build_dir]) self.log.debug('Generate archive') archive_root = 'jarmon-%s' % (buildversion,) @@ -224,7 +232,7 @@ class BuildTestDataCommand(BuildCommand): start = int(datetime(1980, 1, 1, 0, 0).strftime('%s')) dss = [] rras = [] - filename = os.path.join(self.build_dir, 'test.rrd') + filename = os.path.join(argv[0] if len(argv) > 0 else self.build_dir, 'test.rrd') rows = 12 step = 10 @@ -264,7 +272,7 @@ class BuildJavascriptDependenciesCommand(BuildCommand): self.log.debug('Compiling javascript dependencies') depjs_path = os.path.join( - self.workingbranch_dir, + argv[0] if len(argv) > 0 else self.workingbranch_dir, 'docs/examples/assets/js/dependencies.js') # Get the closure params from the original file -- cgit v1.1-4-g5e80