Class: BB::StableManager

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-bb-PodAssistant/helpers/stable_manager_helper.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env = nil, verify_stable_env = true) ⇒ StableManager

Returns a new instance of StableManager.



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

def initialize(env = nil, verify_stable_env=true)
    @env = env
    @verify_stable_env = verify_stable_env
end

Class Method Details

.pod_assistant_pathObject

pod助手ruby文件路径



98
99
100
101
# File 'lib/cocoapods-bb-PodAssistant/helpers/stable_manager_helper.rb', line 98

def self.pod_assistant_path()
    stableMgr = StableManager.new()
    return File.join(stableMgr.cachePath, "PodAssistant/PodAssistant.rb") #名称固定
end

.pod_assistant_robot_pathObject

pod助手机器人ruby文件路径



103
104
105
106
# File 'lib/cocoapods-bb-PodAssistant/helpers/stable_manager_helper.rb', line 103

def self.pod_assistant_robot_path()
    stableMgr = StableManager.new()
    return File.join(stableMgr.cachePath, "PodAssistant/robot.rb") #名称固定
end

.updateBusinessStableLock(pod_targets) ⇒ Object

podfile 更新配置文件使用(业务线)



88
89
90
91
# File 'lib/cocoapods-bb-PodAssistant/helpers/stable_manager_helper.rb', line 88

def self.updateBusinessStableLock(pod_targets)
    stableMgr = StableManager.new()
    stableMgr.update_business_stable_lock(pod_targets)
end

.updateCommonStableLock(pod_targets) ⇒ Object

更新通用lock



83
84
85
86
# File 'lib/cocoapods-bb-PodAssistant/helpers/stable_manager_helper.rb', line 83

def self.updateCommonStableLock(pod_targets)
    stableMgr = StableManager.new()
    stableMgr.update_common_stable_lock(pod_targets)
end

.updateProductStableLock(pod_targets) ⇒ Object

更新产品lock



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

def self.updateProductStableLock(pod_targets)
    stableMgr = StableManager.new()
    stableMgr.update_product_stable_lock(pod_targets)
end

Instance Method Details

#business_stable_yaml(businessSpecName) ⇒ Object

业务源路径(远端)



52
53
54
55
56
57
# File 'lib/cocoapods-bb-PodAssistant/helpers/stable_manager_helper.rb', line 52

def business_stable_yaml(businessSpecName)
    if businessSpecName
        return File.join(cachePath, "#{businessSpecName}.yml") #名称由各自业务线约定
    end
    return nil
end

#cachePathObject

仓库缓存目录



39
40
41
42
43
44
# File 'lib/cocoapods-bb-PodAssistant/helpers/stable_manager_helper.rb', line 39

def cachePath
    if @cache.nil? 
        @cache = BB::Cache.new(nil, @verify_stable_env)
    end
    return @cache.cachePath
end

#commit_data(yml_path, commit_msg = "") ⇒ Object

提交数据



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

def commit_data(yml_path, commit_msg="")
    commit_stable_lock_data(yml_path, commit_msg)
end

#local_stable_yamlObject

本地源路径



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

def local_stable_yaml
    return File.join(Pathname.pwd, "stable_specs_lock.yml") #名称固定
end

#public_stable_yamlObject

公共源路径(远端)



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

def public_stable_yaml
    return File.join(cachePath, "stable_specs.yml") #名称固定
end

#update_business_stable_lock(pod_targets) ⇒ Object

podfile 更新配置文件使用(业务线)



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/cocoapods-bb-PodAssistant/helpers/stable_manager_helper.rb', line 17

def update_business_stable_lock(pod_targets)
    if @env.nil?
        @env = BB::StableEnv.new()
    end
    businessSpecName = @env.business_stable
    if !businessSpecName.nil?
        update_stable_lock(business_stable_yaml(businessSpecName), pod_targets)
    else
        puts "没有配置业务线公共源,请确认!!!".yellow
    end
end

#update_common_stable_lock(pod_targets) ⇒ Object

podfile 更新配置文件使用(通用)



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

def update_common_stable_lock(pod_targets)
    update_stable_lock(public_stable_yaml, pod_targets)
end

#update_product_stable_lock(pod_targets) ⇒ Object

podfile 更新配置文件使用(项目)



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

def update_product_stable_lock(pod_targets)
    update_local_stable_lock(local_stable_yaml, pod_targets)
end