Top Level Namespace

Defined Under Namespace

Modules: BB, CocoapodsBbPodassistant, Pod Classes: Dir

Constant Summary collapse

DEFAULT =

method

0
LOCAL =
1
REMOTE_GIT =
2
REMOTE_VERSION =
3
REMOTE_BRANCH =
4
REMOTE_TAG =
5
YAML_CONFIG_LIST_KEY =
"list"
YAML_CONFIG_REMOVE_KEY =
"remove"
YAML_CONFIG_DEPENDENCIES_KEY =
"dependencies"

Instance Method Summary collapse

Instance Method Details

#configGitPath(gitPath) ⇒ Object

Git Command ########################################



4
5
6
# File 'lib/cocoapods-bb-PodAssistant/helpers/git_cmd_helper.rb', line 4

def configGitPath(gitPath)
    @gitPath = gitPath
end

#git_branch_exists?(branch) ⇒ Boolean

Returns:

  • (Boolean)


57
58
59
60
61
62
63
# File 'lib/cocoapods-bb-PodAssistant/helpers/git_cmd_helper.rb', line 57

def git_branch_exists?(branch)
    if branch
        branchs = git_cmd('branch','-a').split("\n")
        branchs.include?(branch) || branchs.include?('  remotes/origin/' + branch) || branchs.include?('remotes/origin/' + branch)
    end
    return true
end

#git_checkout_and_pull(stable_source, stable_branch = nil, stable_tag = nil) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/cocoapods-bb-PodAssistant/helpers/git_cmd_helper.rb', line 22

def git_checkout_and_pull(stable_source, stable_branch = nil, stable_tag = nil)
    # puts "spec source:#{stable_source} branch:#{stable_branch} tag:#{stable_tag}"
    if stable_branch || stable_tag 
        if stable_branch
            unless git_branch_exists?(stable_branch)
                err_msg = "- Error: #{stable_source} did not exit branch #{stable_branch}"
                Pod::UI.puts "#{err_msg}".send(:red)
                exit -9006
            end
            git_cmd('checkout',stable_branch) #fommate git command
            git_cmd('reset','--hard',"origin/#{stable_branch}") #fommate git command
        end
        if stable_tag
            unless git_tag_exists?(stable_tag)
                err_msg = "- Error: #{stable_source} did not exit tag #{stable_tag}"
                Pod::UI.puts "#{err_msg}".send(:red)
                exit -9007
            end
    
            git_cmd('checkout',stable_tag) #fommate git command
        end
    else
        protechBranch = git_cmd('symbolic-ref','refs/remotes/origin/HEAD').split("/").last.strip || "main"
        git_cmd('checkout',protechBranch)
        git_cmd('reset','--hard',"origin/#{protechBranch}") #fommate git command
    end
end

#git_clone(source, path) ⇒ Object



65
66
67
68
69
# File 'lib/cocoapods-bb-PodAssistant/helpers/git_cmd_helper.rb', line 65

def git_clone(source, path)
    UI.section("Cloning `#{source}` into `#{path}`.") do
        Dir.chdir(path) { git! ['clone', source] } #origin git command
    end
end

#git_cmd(*args) ⇒ Object



8
9
10
11
12
# File 'lib/cocoapods-bb-PodAssistant/helpers/git_cmd_helper.rb', line 8

def git_cmd(*args)
    Dir.chdir(File.join(@gitPath)) { 
     return git! args 
   }
end

#git_fetchObject



18
19
20
# File 'lib/cocoapods-bb-PodAssistant/helpers/git_cmd_helper.rb', line 18

def git_fetch 
    git_cmd('fetch') #fommate git command
end

#git_resetObject



14
15
16
# File 'lib/cocoapods-bb-PodAssistant/helpers/git_cmd_helper.rb', line 14

def git_reset
    git_cmd('reset','--hard') #fommate git command
end

#git_tag_exists?(tag) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
53
54
55
# File 'lib/cocoapods-bb-PodAssistant/helpers/git_cmd_helper.rb', line 50

def git_tag_exists?(tag)
    if tag
        git_cmd('tag').split("\n").include?(tag)
    end
    return true
end