def build(): parser = argparse.ArgumentParser(description='Build the documents') parser.add_argument('commands', nargs='+', choices=commands) args = parser.parse_args(sys.argv[2:]) config = Config() builder = Builder(config) for cmd in args.commands: getattr(builder, cmd)()
def deploy(): parser = argparse.ArgumentParser(description='Deploy documents') parser.add_argument('commands', nargs='+', choices=commands) args = parser.parse_args(sys.argv[2:]) config = Config() deployer = Deployer(config) for cmd in args.commands: getattr(deployer, cmd)()
def build(): parser = argparse.ArgumentParser(description='Build the documents') parser.add_argument('commands', nargs='+', choices=commands) parser.add_argument('--tab', default=None, help='The tab to build, if multi-tab is enabled.') args = parser.parse_args(sys.argv[2:]) config = Config(tab=args.tab) builder = Builder(config) for cmd in args.commands: getattr(builder, cmd)()
def deploy(): parser = argparse.ArgumentParser(description='Deploy documents') parser.add_argument('commands', nargs='+', choices=commands) args = parser.parse_args(sys.argv[2:]) config = Config() if config.deploy['s3_bucket']: deployer = S3Deployer(config) elif config.deploy['github_repo']: deployer = GithubDeployer(config) else: logging.fatal('No deployment URL. You need to specify either' 'a Github repo or a S3 bucket') exit(-1) for cmd in args.commands: getattr(deployer, cmd)()
def deploy(): parser = argparse.ArgumentParser(description='Deploy documents') parser.add_argument('commands', nargs='+', choices=commands) parser.add_argument('--s3', help='s3 bucket') args = parser.parse_args(sys.argv[2:]) config = Config() if args.s3: config.deploy['s3_bucket'] = args.s3 if config.deploy['s3_bucket']: deployer = S3Deployer(config) elif config.deploy['github_repo']: deployer = GithubDeployer(config) else: deployer = Deployer(config) for cmd in args.commands: getattr(deployer, cmd)()
def build(): parser = argparse.ArgumentParser(description='Build the documents') parser.add_argument('commands', nargs='+', choices=commands) parser.add_argument('--tab', default=None, help='The tab to build, if multi-tab is enabled.') parser.add_argument( '--timeout', type=int, default=1200, help= "Timeout for excution. Default: 1200 (s). Set timeout -1 to disable timeout." ) args = parser.parse_args(sys.argv[2:]) config = Config(tab=args.tab) timeout = args.timeout builder = Builder(config, timeout) for cmd in args.commands: getattr(builder, cmd)()
def clear(): config = Config() build_dir = config.tgt_dir logging.info('Delete %s', build_dir) shutil.rmtree(build_dir, ignore_errors=True)