def source_run(args,rc, src): from databundles.source.repository.git import GitRepository dir_ = args.dir if not dir_: dir_ = rc.sourcerepo.dir for root, _, files in os.walk(dir_): if 'bundle.yaml' in files: repo = GitRepository(None, root) repo.bundle_dir = root if args.repo_command == 'commit' and repo.needs_commit(): prt("--- {} {}",args.repo_command, root) repo.commit(' '.join(args.message)) elif args.repo_command == 'push' and repo.needs_push(): prt("--- {} {}",args.repo_command, root) repo.push() elif args.repo_command == 'pull': prt("--- {} {}",args.repo_command, root) repo.pull() elif args.repo_command == 'install': prt("--- {} {}",args.repo_command, root) bundle_class = load_bundle(root) bundle = bundle_class(root) bundle.run_install() elif args.shell_command: cmd = ' '.join(args.shell_command) saved_path = os.getcwd() os.chdir(root) prt('----- {}', root) prt('----- {}', cmd) os.system(cmd) prt('') os.chdir(saved_path)
def source_find(args,rc, src): from ..source.repository.git import GitRepository dir_ = args.dir if not dir_: dir_ = rc.sourcerepo.dir for root, _, files in os.walk(dir_): if 'bundle.yaml' in files: repo = GitRepository(None, root) repo.bundle_dir = root if args.commit: if repo.needs_commit(): prt(root) elif args.push: if repo.needs_push(): prt(root) elif args.init: if repo.needs_init(): prt(root) else: err("Must specify either --push or --commit")