20
19
databaserecord = ""
21
20
RECORD_TYPE = 'http://www.okiebuntu.homelinux.com/packagesync'
22
21
VIM_CONFIG = os.path.expanduser("~") + "/.vimrc"
22
HOME_DIR = os.path.expanduser("~")
23
VIM_DIR = HOME_DIR + "/.vim"
24
25
class Plugin(PluginBase):
26
26
def __init__ (self):
27
27
""" Function doc """
47
47
record_type = RECORD_TYPE)
48
if os.path.exists(VIM_DIR):
49
tar = tarfile.open(HOME_DIR + "/vim.tar", "w")
52
record_four.attach(open(HOME_DIR + "/vim.tar", "r"), "vim.tar", "tarfile/tar")
53
os.remove(HOME_DIR + "/vim.tar")
49
54
databaserecord = database.put_record(record_four)
52
57
print "Bash it's not even installed SUCKER!"
56
# the part for taring the vim directory
57
#if os.path.isdir(vimdir):
58
# tar = tarfile.open(self.name.lower()+".tar", "w")
62
# maybe use https://launchpad.net/ubuntuone-storage-protocol
65
61
map_js2 = 'function(doc){if (doc._id == "vim"){emit(null,doc.file);}}'
66
62
database.add_view("vimconfig", map_js2, None, "getfile")
67
63
result = database.execute_view("vimconfig", "getfile")
70
66
config_iter = row.value
72
vim_file = open(os.path.expanduser("~") + "/.vimrc2", 'w')
68
vim_file = open(os.path.expanduser("~") + "/.vimrc", 'w')
73
69
vim_file.write(config_iter)
71
rec = database.get_record("vim")
72
if len(rec.list_attachments()) > 0:
73
tar = open(os.path.expanduser("~") + "/vim.tar", 'w')
74
tar.write(rec.attachment_data(rec.list_attachments()[0])[0])
76
tar = tarfile.open(HOME_DIR + "/vim.tar", "r")
79
os.remove(HOME_DIR + "/vim.tar")