Пример #1
0
def initialize_git(projectID,opsys):
    # github API 3.0
    #base_url = 'https://api.github.com/repos/RHITJuniorProjects/JrProj-1415-Mike/contents/Code/Platform/Git/Hooks/WindowsEXE/build/exe.win32-2.7/'
    base_url = 'https://github.com/RHITJuniorProjects/JrProj-1415-Mike/raw/master/Code/Platform/Git/Hooks/WindowsEXE/build/exe.win32-2.7/'
    
    files = [ "commit.exe", "cacert.pem", "select.pyd", "_multiprocessing.pyd", "_hashlib.pyd", "pyexpat.pyd", "_ctypes.pyd", "unicodedata.pyd", "_ssl.pyd", "bz2.pyd", "_socket.pyd", "python27.dll", "library.zip" ]

    sh_url = base_url+'/commit-msg'
    py_url = base_url+'/henry/commit.py'

    hook_dir = os.getcwd()+'\\.git\\hooks\\'
    henry_dir = hook_dir+'henry\\'
    
    if not git_utils.inGitRepo():
        print 'HENRY Error: Must be in the root of a Git repository'
        sys.exit(1)
    
    with open(hook_dir+'commit-msg','w') as f:
        f.write('#!/usr/bin/env bash\n.git/hooks/henry/commit.exe $1 "'+projectID+'"')

    if not os.path.exists(henry_dir):
        os.makedirs(henry_dir)

    for my_file in files:
        urllib.urlretrieve(base_url+my_file, os.path.join(henry_dir,my_file))

    print 'HENRY: Repository succesfully connected to Henry'
Пример #2
0
def helpmenu():
    if not git_utils.inGitRepo():
        print 'Henry can only be used within a Git reposity'
        print 'Change directory to a Git repository or create a new one with'
        print '   git init'
        print
    print 'Connect a Git repository to Henry with'
    print '   henry init <project name>'
    print 
    print 'Henry commit data can be entered in-line with the command'
    print "    git commit -m 'my commit message [hours:2] [milestone:Milestone 0] [task:Create database] [status:Regression]'"
    print
    print 'Henry\'s connection information can be displayed with the command'
    print '    henry status'
Пример #3
0
def status(ref):
    if not git_utils.inGitRepo():
        print 'This is not a Git repository, Henry cannot be initialized here'
    elif os.path.isfile(os.getcwd()+'/.git/hooks/commit-msg'):
        with open (os.getcwd()+'\\.git\\hooks\\commit-msg') as f:
            fullfile = f.read()
        try:
            projectID = fullfile.split('"')[1]
            ref = firebase.FirebaseApplication(firebase_url,None)
            projectName = ref.get('/projects/'+projectID,None)['name']
            print 'Git repository is connected to Henry Project: '+projectName
        except Exception as e:
            # traceback.print_exc(file=sys.stdout)  # useful for debugging
            print 'Git repository is connected to an invalid Henry project, possibly one that has been deleted'
    else:
        print 'This Git repository is not yet connected to Henry'
        print 'Connect it with'
        print '   henry init <project name>'