PKiK%Ayygitautopush/__init__.py"""A command-line tool to automatically sync/push a file to GitHub.""" __version__ = '0.1' from .gitautopush import mainPK˹iK<]]gitautopush/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 to GitHub.\n" "Useful for teaching with a file 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 to be pushed.") parser.add_argument("--sleep", default=15, help="Time to wait (in seconds) before checking for updates.") def main(): args = parser.parse_args() path = args.path this_sleep = int(args.sleep) name = os.path.basename(path) new_path = os.path.join('.', name) if not os.path.exists(path): raise ValueError("Notebook doesn't exist, double-check your path") if not os.path.exists(new_path): print('Adding new file: {}'.format(new_path)) sh.copy(path, new_path) call(['git', 'add', new_path]) call(['git', 'commit', '-m', '"new file: {}"'.format(name)]) 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.1.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.1.dist-info/WHEEL HM K-*ϳR03rOK-J,/RH,Q0343 /, (-JLR()*M ILR(4KM̫#DPK!HII="gitautopush-0.1.dist-info/METADATAMNn0 MGM52IgHi.Hr}%-;yfl>)&N¡}#Zp5&- 7 =(_V75Aޔe1Bc6HS] M+a}b𖚀Ki9$.DXe|yN[[*\XK1Qk>J8{B!8 o%kF;TVxf*I{H /-~PK!HL& gitautopush-0.1.dist-info/RECORD}͖BP}BD,fqʿhC~ Al:Ǫݷrǁc_l0.rx>Y^(0C'F)d7] e\Or`w V[x1#Vf;4NqR$SE"VZ4l2t9>zN }!ϱPk = |QO$1#mg !zgsiܵ 9~#/ S̛F6' 4G:mq!2wr+U&vof)PKiK%Ayygitautopush/__init__.pyPK˹iK<]]큮gitautopush/gitautopush.pyPKpiKNFF!Cgitautopush-0.1.dist-info/LICENSEPK!H9?Wd gitautopush-0.1.dist-info/WHEELPK!HII="\ gitautopush-0.1.dist-info/METADATAPK!HL& x gitautopush-0.1.dist-info/RECORDPK