PKqK[[#zzgitautopush/__init__.py"""A command-line tool to automatically sync/push a file to GitHub.""" __version__ = '0.2' from .gitautopush import main PKfoKG ppgitautopush/gitautopush.pyimport sys from subprocess import call, check_output import os from time import sleep import argparse import shutil as sh from datetime import datetime DESCRIPTION = ("Automatically syncronize and push a file/foder to GitHub.\n" "Useful for teaching with one of more files that you populate " "as you go along. This tool will automatically sync " "changes that you make and push them to GitHub so that " "students can use it as a reference.") parser = argparse.ArgumentParser(description=DESCRIPTION) parser.add_argument("path", help="Path to the notebook or folder to be pushed.") parser.add_argument("--sleep", default=15, help="Time to wait (in seconds) before checking for updates.") parser.add_argument("--rename", default=None, help="A new name for the file/folder to be pushed to GitHub.") def main(): args = parser.parse_args() path = args.path this_sleep = int(args.sleep) rename = str(args.rename) if args.rename is not None else None newname = os.path.basename(path) if rename is None else rename new_path = os.path.join('.', newname) if not os.path.exists(path): raise ValueError("Path doesn't exist, double-check your path") copy = sh.copytree if os.path.isdir(path) else sh.copy if not os.path.exists(new_path): print('Adding new path: {}'.format(new_path)) copy(path, new_path) call(['git', 'add', new_path]) call(['git', 'commit', '-m', '"new path: {}"'.format(newname)]) ii = 1 while True: sh.copy(path, new_path) print('\n\n---\n\n') out = call(('git', 'commit', '-am', "update: {:%x %X}".format(datetime.now()))) if out == 0: call(('git', 'push')) print('Notebook synced (Num: {})'.format(ii)) ii += 1 sleep(this_sleep) if __name__ == '__main__': main() PKpiKNFF!gitautopush-0.2.dist-info/LICENSEThe MIT License (MIT) Copyright (c) 2017 John Lee and Chris Holdgraf Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!H9?Wdgitautopush-0.2.dist-info/WHEEL HM K-*ϳR03rOK-J,/RH,Q0343 /, (-JLR()*M ILR(4KM̫#DPK!HZ'="gitautopush-0.2.dist-info/METADATAMNn0 mGM52igH3# Bwǻ;S 36{'}#Zp5&-B_Wk1nzPnj ;) mNuf6Uo֊[j.%Mibf69mmW9"1^~FѯY(k'"(#'i" JR!S♩8 %\GCNS_Z<PK!Hxn& gitautopush-0.2.dist-info/RECORD}̹0~CdSl0+b8 GăC*WhhԬ4IhdzT?zۗ,g7af6:RՉJ\|3AVlԍ<]o 5v/;J^_,oHq)Jer.x#UZODn޳^lA-5t""$6.zo:Y歅~&pe{IX9{qB!|i)i+~TGd="i)}&N*fL,PKqK[[#zzgitautopush/__init__.pyPKfoKG pp큯gitautopush/gitautopush.pyPKpiKNFF!Wgitautopush-0.2.dist-info/LICENSEPK!H9?Wd gitautopush-0.2.dist-info/WHEELPK!HZ'="p gitautopush-0.2.dist-info/METADATAPK!Hxn& gitautopush-0.2.dist-info/RECORDPK