Top Level Namespace

Defined Under Namespace

Modules: BB, CocoapodsBbPodassistant, Pod Classes: BabybusInstallEnv, Dir, PodPostInstaller

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

#addRewardAdObject

是否添加激励广告



12
13
14
15
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 12

def addRewardAd
    flag = BB::PodUtils.getValueFromInfoPlist("AddRewardAd")
    return flag === "true"
end

#childrenAppObject

是否儿童应用



7
8
9
10
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 7

def childrenApp
    isChildrenValue = BB::PodUtils.getValueFromInfoPlist("Children")
    return isChildrenValue === "true"
end

#configGitPath(gitPath) ⇒ Object

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



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

def configGitPath(gitPath)
    @gitPath = gitPath
end

#forceAddDebugToolObject

是否显示调试工具(小白点)



23
24
25
26
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 23

def forceAddDebugTool
    forceAddDebugTool = BB::PodUtils.getValueFromInfoPlist("ForceAddDebugTool")
    return forceAddDebugTool === "true"
end

#getProjectBundleIdentifierObject

获取工程包名



56
57
58
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 56

def getProjectBundleIdentifier
    return BB::PodUtils.getProjectBundleIdentifier
end

#getProjectPathObject

获取工程路径



64
65
66
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 64

def getProjectPath
    return BB::PodUtils.getProjectPath
end

#getProjectRootPathObject

获取工程根目录路径



60
61
62
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 60

def getProjectRootPath
    return BB::PodUtils.getProjectRootPath
end

#git_branch_exists?(branch) ⇒ Boolean

Returns:

  • (Boolean)


61
62
63
64
65
66
67
# File 'lib/cocoapods-bb-PodAssistant/helpers/git_cmd_helper.rb', line 61

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

git_cmd(‘pull’,‘–all’) #fommate git command



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

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



69
70
71
72
73
74
75
76
77
# File 'lib/cocoapods-bb-PodAssistant/helpers/git_cmd_helper.rb', line 69

def git_clone(source, path)
    puts "git clone source:#{source} path:#{path}".yellow
    if !File.directory?(path)
        Dir.mkdir(path)
    end
    UI.section("Cloning `#{source}` into `#{path}`.") do
        Dir.chdir(path) { git! ['clone', source] } #origin git command
    end
end

#git_cmd(*args) ⇒ Object



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

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

#git_fetchObject



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

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

#git_pullObject



23
24
25
# File 'lib/cocoapods-bb-PodAssistant/helpers/git_cmd_helper.rb', line 23

def git_pull
    # git_cmd('pull','--all') #fommate git command
end

#git_resetObject



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

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

#git_tag_exists?(tag) ⇒ Boolean

Returns:

  • (Boolean)


54
55
56
57
58
59
# File 'lib/cocoapods-bb-PodAssistant/helpers/git_cmd_helper.rb', line 54

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

#isHanZiAppObject

是否汉字产品



69
70
71
72
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 69

def isHanZiApp
    bundleId = getProjectBundleIdentifier()
    return bundleId === "com.sinyee.babybus.homeland"
end

#isMatrixAppObject

是否矩阵产品



87
88
89
90
91
92
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 87

def isMatrixApp
    if (isHanZiApp || isQMWApp || isPinyinAppp) then
        return false
    end
    return true
end

#isPinyinApppObject

是否拼音产品



81
82
83
84
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 81

def isPinyinAppp
    bundleId = getProjectBundleIdentifier()
    return bundleId === "com.sinyee.babybus.voicerecognition" || bundleId === "com.sinyee.babybus.read.ios" || bundleId === "com.sinyee.babybus.stroke"
end

#isQMWAppObject

是否奇妙屋产品



75
76
77
78
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 75

def isQMWApp
    bundleId = getProjectBundleIdentifier()
    return bundleId === "com.sinyee.babybus.talk2kiki"
end

#isThirdPaySdkObject

是否需要第三方支付sdk



34
35
36
37
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 34

def isThirdPaySdk
    value = BB::PodUtils.getValueFromInfoPlist("Third_Purcharse")
    return value === "true"
end

#isUnity3DAppObject

是否3d产品



28
29
30
31
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 28

def isUnity3DApp
    isU3dValue = BB::PodUtils.getValueFromInfoPlist("Unity3D")
    return isU3dValue === "true"
end

#multiEngineObject

是否支持多引擎



39
40
41
42
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 39

def multiEngine
    val = BB::PodUtils.getValueFromInfoPlist("MultiEngine")
    return val === "true"
end

#releaseConfigObject

是否重置配置



17
18
19
20
21
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 17

def releaseConfig
    appEnvValue = BB::PodUtils.getValueFromInfoPlist("APP_Environment")
    adhocValue = BB::PodUtils.getValueFromInfoPlist("ADHOC")
    return appEnvValue === "1" && adhocValue != "true"
end

#usePlugin(key) ⇒ Object

是否使用插件



44
45
46
47
48
49
50
51
52
53
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 44

def usePlugin(key)
    val = BB::PodUtils.getValueFromInfoPlist("Plugins")
    plugins = val.split("|")
    plugins.each do |plugin|
        if plugin.eql?(key)
            return true
        end
    end
    return false
end