Git integration complete

Ready to be made better
Fixes maebert/jrnl#35

Signed-off-by: Aniket Pant <me@aniketpant.com>
This commit is contained in:
Aniket Pant 2013-04-14 03:27:58 +05:30
parent 021ff9fb38
commit 0de0c28ea8

View file

@ -3,6 +3,7 @@
from Entry import Entry
import exporters
import subprocess
import os
import parsedatetime.parsedatetime as pdt
import re
@ -284,6 +285,12 @@ class Journal(object):
exporters.to_txt(self, self.config['sync_folder'] + "journal.txt")
elif arg == "files":
exporters.to_files(self, self.config['sync_folder'] + "*.txt")
os.chdir(self.config['sync_folder'])
subprocess.call(["git", "pull"])
subprocess.call(["git", "add", "."])
message = "Site update at " + str(datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
subprocess.call(["git", "commit", "-m", message])
subprocess.call(["git", "push"])
return "journal synced to " + self.config['sync_folder']