Top Level Namespace

Defined Under Namespace

Modules: CocoapodsGit2local, Pod

Instance Method Summary collapse

Instance Method Details

#gitclone(git, branch, commit) ⇒ Object



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/pod/git.rb', line 1

def gitclone(git, branch, commit)
    component = git.split("/")[4].split(".")[0]
    pwd = Dir.pwd
    Dir.chdir("..")
    if File.directory?(component)
        Dir.chdir(component)
        p Dir.pwd
        unless system("git status | grep 'nothing to commit'") 
            puts 'sssss'
        else
            system("git reset --hard")
            if branch
                system("git checkout " + branch)
                system("git pull")
            else
                system("git checkout " + commit)
            end
        end
    else
        system("git clone " + git)
        Dir.chdir(component)
        p Dir.pwd
        system("git checkout " + commit)
    end

    Dir.chdir(pwd)
end