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

#getCaseNumberObject

产品备案号



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

def getCaseNumber
    val = BB::PodUtils.getValueFromInfoPlist("CaseNumber")
    return val
end

#getProductIDObject

产品id



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

def getProductID
    val = BB::PodUtils.getValueFromInfoPlist("ProductId")
    return val 
end

#getProjectBundleIdentifierObject

获取工程包名



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

def getProjectBundleIdentifier
    return BB::PodUtils.getProjectBundleIdentifier
end

#getProjectPathObject

获取工程路径



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

def getProjectPath
    return BB::PodUtils.getProjectPath
end

#getProjectRootPathObject

获取工程根目录路径



78
79
80
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 78

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

#isABCAppObject

是否abc产品



117
118
119
120
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 117

def isABCApp
    bundleId = getProjectBundleIdentifier()
    return bundleId === "com.sinyee.babybus.abc"
end

#isCityAppObject

是否城市产品



123
124
125
126
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 123

def isCityApp
    bundleId = getProjectBundleIdentifier()
    return bundleId === "com.sinyee.babybus.city"
end

#isCourseAppObject

是否科学产品



105
106
107
108
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 105

def isCourseApp
    bundleId = getProjectBundleIdentifier()
    return bundleId === "com.ailiyong.world.course"
end

#isGameWorldAppObject

是否创意世界产品



129
130
131
132
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 129

def isGameWorldApp
    bundleId = getProjectBundleIdentifier()
    return bundleId === "com.sinyee.babybus.gameworld"
end

#isHanZiAppObject

是否汉字产品



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

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

#isMathAppObject

是否思维产品



111
112
113
114
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 111

def isMathApp
    bundleId = getProjectBundleIdentifier()
    return bundleId === "com.sinyee.babybus.mathIII"
end

#isMatrixAppObject

是否矩阵产品



135
136
137
138
139
140
141
142
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 135

def isMatrixApp
    bundleId = getProjectBundleIdentifier()
    puts "###bundleId:#{bundleId}###".red
    if (isHanZiApp || isQMWApp || isPinyinAppp || isCourseApp || isMathApp || isABCApp || isCityApp) then
        return false
    end
    return true
end

#isPinyinApppObject

是否拼音产品



99
100
101
102
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 99

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

#isQMWAppObject

是否奇妙屋产品



93
94
95
96
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 93

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

#isThirdPaySdkObject

是否需要第三方支付sdk



42
43
44
45
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 42

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

#isUnity3DAppObject

是否3d产品(968开始切新版unity2022引擎)



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

def isUnity3DApp
    if isUnityApp
        # 1=>Cocos2D; 2=>Unity2D; 3=>普通 Unity3D; 4=>新版 Unity 3D; 5=>2D融合 打包机负责写入
        value = BB::PodUtils.getValueFromInfoPlist("packer_engines_id")
        return value === "4"
    end
    return false
end

#isUnityAppObject

是否unity产品,包含2d/3d



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

def isUnityApp
    value = BB::PodUtils.getValueFromInfoPlist("Unity3D")
    return value === "true"
end

#multiEngineObject

是否支持多引擎



47
48
49
50
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 47

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

是否使用插件



52
53
54
55
56
57
58
59
60
61
# File 'lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb', line 52

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