lib/cocoapods-jxedt/binary/config.rb in cocoapods-jxedt-0.0.12 vs lib/cocoapods-jxedt/binary/config.rb in cocoapods-jxedt-0.0.13
- old
+ new
@@ -22,16 +22,26 @@
:clean_build => "编译的时候是否clean。默认true",
:bitcode_enabled => "开启bitcode。默认false",
:device_build_enabled => "编译真机。默认true",
:simulator_build_enabled => "编译模拟器。默认false",
:disable_dsym => "禁止编译dsym产物。默认true",
+ :disable_resource_compilable_pods => "禁止编译有需要编译的resource文件(xib、xcdatamodeld等)的pod",
:build_log_path => "编译的log输出路径",
:build_args => "编译的配置。了解xcodebuild命令的可以配置编译参数,例如配置 ARCHS='arm64 armv7'",
+ :git_cache => 'git缓存配置,A Hash. 详情查看 GIT_CACHE_CONFIG'
}.freeze
+ GIT_CACHE_CONFIG = {
+ :repo => '配置缓存仓库地址,如:{:remote => "https://github.com/user/cocoapods-cache.git", :local => "~/.cocoapods-jxedt/cocoapods-cache"},或者直接写远程仓库地址"https://github.com/user/cocoapods-cache.git"',
+ :branch => 'git cache的branch,默认是master分支',
+ :auto_fetch => 'pod install过程是否自动拉取远程的二进制,默认true',
+ :auto_push => 'pod install过程是否自动同步二进制结果到远程仓库,默认false',
+ }.freeze
+
def initialize()
@dsl_config = {}
+ @git_config = {}
end
def self.instance
@instance ||= new()
end
@@ -106,10 +116,14 @@
def disable_dsym?
@dsl_config[:disable_dsym] || @dsl_config[:disable_dsym].nil?
end
+ def disable_resource_compilable_pods?
+ @dsl_config[:disable_resource_compilable_pods] || false
+ end
+
def device_build_enabled?
@dsl_config[:device_build_enabled] || @dsl_config[:device_build_enabled].nil?
end
def simulator_build_enabled?
@@ -138,7 +152,55 @@
configurations += user_config if user_config.is_a?(Array)
configurations = ["Release"] if configurations.empty?
configurations
end
end
+
+ # git配置 ======================================= git配置
+ def git_cache_config
+ @git_cache ||= @dsl_config[:git_cache] || {}
+ end
+
+ def cache_repo
+ @cache_repo ||= begin
+ cache_repo = {}
+ user_config = git_cache_config[:repo]
+ cache_repo[:remote] = user_config if user_config.is_a?(String)
+ cache_repo.merge!(user_config) if user_config.is_a?(Hash)
+ cache_repo
+ end
+ end
+
+ def git_remote_repo
+ @remote ||= cache_repo[:remote]
+ end
+
+ def cache_repo_enabled?
+ remote = git_remote_repo
+ remote && remote.is_a?(String) && remote =~ /.*\.git$/
+ end
+
+ def git_cache_path
+ return nil unless cache_repo_enabled?
+
+ local = cache_repo[:local]
+ return File.expand_path(local) if local && local.is_a?(String) && local.split('/').size > 1
+
+ remote = git_remote_repo
+ repo_name = Pathname.new(remote).basename.sub_ext('').to_s
+ File.expand_path("~/.cocoapods-jxedt/#{repo_name}")
+ end
+
+ def auto_fetch?
+ git_cache_config[:auto_fetch] || git_cache_config[:auto_fetch].nil?
+ end
+
+ def auto_push?
+ git_cache_config[:auto_push]
+ end
+
+ def cache_branch
+ git_cache_config[:branch] || 'master'
+ end
+ # git配置 ======================================= git配置
end
end
\ No newline at end of file