Class: BB::DataConfig
- Inherits:
-
Object
- Object
- BB::DataConfig
- Defined in:
- lib/cocoapods-bb-PodAssistant/config/data_config.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#customConfigPath ⇒ Object
与打包机约定自定义配置文件.
-
#file_exists?(file_path) ⇒ Boolean
检查文件是否存在.
-
#get_custom_json_data ⇒ Object
提供给业务方的获取 JSON 数据方法.
-
#ignore_dependencies_pod_names ⇒ Object
需要过滤忽略组件.
-
#initialize ⇒ DataConfig
constructor
A new instance of DataConfig.
-
#set_ignore_dependencies_pod_names(pods = []) ⇒ Object
配置过滤忽略组件.
Constructor Details
#initialize ⇒ DataConfig
Returns a new instance of DataConfig.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/cocoapods-bb-PodAssistant/config/data_config.rb', line 9 def initialize() file_path = customConfigPath puts "开始解析打包机自定义配置 json:#{file_path}".yellow if file_exists?(customConfigPath) json_parser = BB::JsonParser.new(file_path) @json_data = json_parser.get_json_data puts "配置json数据:#{@json_data}" else puts "没有配置自定义数据" end end |
Class Method Details
.config ⇒ Object
5 6 7 |
# File 'lib/cocoapods-bb-PodAssistant/config/data_config.rb', line 5 def self.config @config ||= DataConfig.new end |
Instance Method Details
#customConfigPath ⇒ Object
与打包机约定自定义配置文件
22 23 24 |
# File 'lib/cocoapods-bb-PodAssistant/config/data_config.rb', line 22 def customConfigPath return "#{Dir.pwd}/bbCustomConfig.json" # 存放工程目录下 end |
#file_exists?(file_path) ⇒ Boolean
检查文件是否存在
33 34 35 |
# File 'lib/cocoapods-bb-PodAssistant/config/data_config.rb', line 33 def file_exists?(file_path) File.exist?(file_path) end |
#get_custom_json_data ⇒ Object
提供给业务方的获取 JSON 数据方法
27 28 29 30 |
# File 'lib/cocoapods-bb-PodAssistant/config/data_config.rb', line 27 def get_custom_json_data return {} unless @json_data @json_data end |
#ignore_dependencies_pod_names ⇒ Object
需要过滤忽略组件
38 39 40 41 |
# File 'lib/cocoapods-bb-PodAssistant/config/data_config.rb', line 38 def ignore_dependencies_pod_names puts "<===获取业务方配置过滤组件数据:#{@ignore_pods_list} 打包机自定义配置数据:#{@json_data}".yellow return @ignore_pods_list end |
#set_ignore_dependencies_pod_names(pods = []) ⇒ Object
配置过滤忽略组件
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/cocoapods-bb-PodAssistant/config/data_config.rb', line 44 def set_ignore_dependencies_pod_names(pods=[]) @ignore_pods_list = pods # puts "==>业务方配置需要过滤组件数据:#{pods} cls:#{pods.class}".yellow # json_data = get_custom_json_data # if json_data.nil? || json_data.empty? # @ignore_pods_list = pods # else # whitelist_pods=[] # pods.each do |pod_name| # data = json_data[pod_name] # if data.nil? || data.empty? # whitelist_pods.push(pod_name) # end # end # puts "==>修正后需要过滤组件数据:#{whitelist_pods} cls:#{whitelist_pods.class}".green # @ignore_pods_list = whitelist_pods # end end |