Class: Pod::Command::Bin::LocalPush
- Inherits:
-
Pod::Command::Bin
- Object
- Pod::Command
- Pod::Command::Bin
- Pod::Command::Bin::LocalPush
- Defined in:
- lib/cocoapods-bb-bin/command/bin/localPush.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#find_podspec ⇒ Object
Dir.glob 可替代.
-
#initialize(argv) ⇒ LocalPush
constructor
A new instance of LocalPush.
- #run ⇒ Object
- #update_uploadpath ⇒ Object
- #validate! ⇒ Object
Methods included from CBin::SpecFilesHelper
#binary_spec, #binary_spec_files, #binary_template_spec, #binary_template_spec_file, #binary_template_spec_files, #clear_binary_spec_file_if_needed, #code_spec, #code_spec_files, #create_binary_spec_file, #find_spec_file, #spec_files
Methods included from CBin::SourcesHelper
#binary_source, #code_source, #sources_manager, #sources_option, #sources_optionV2, #valid_sources, #valid_sourcesV2
Constructor Details
#initialize(argv) ⇒ LocalPush
Returns a new instance of LocalPush.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/cocoapods-bb-bin/command/bin/localPush.rb', line 28 def initialize(argv) @help = argv.flag?('help', false ) if @help else @env = argv.option('env') || 'dev' CBin.config.set_configuration_env(@env) @podspec = argv.shift_argument || find_podspec @sources = argv.option('sources') || [] @localPath = argv.option('path') || nil @vendored_framework_name = argv.option('vendored_framework_name') || nil @is_dylib = argv.flag?('dylib', false ) @is_dev_model = argv.flag?('developer_mode', false ) end super end |
Class Method Details
.options ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/cocoapods-bb-bin/command/bin/localPush.rb', line 18 def self. [ ['--sources', '私有源地址,多个用分号区分'], ['--path', '(必传)需要上传文件路径'], ['--vendored_framework_name', '(可选)组件库依赖framework名称,默认组件名称'], ['--dylib', '(可选)是否动态库,默认静态库'], ['--developer_mode', '(可选)是否开发者模式,默认发布模式'], ].concat(Pod::Command::Gen.).concat(super).uniq end |
Instance Method Details
#find_podspec ⇒ Object
Dir.glob 可替代
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/cocoapods-bb-bin/command/bin/localPush.rb', line 101 def find_podspec name = nil Pathname.pwd.children.each do |child| # puts child if File.file?(child) if child.extname == '.podspec' || child.basename.to_s.include?('.podspec.json') name = File.basename(child) unless name.include?("binary-template") return name end end end end raise Informative, "podspec File no exist, please check" unless name return name end |
#run ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/cocoapods-bb-bin/command/bin/localPush.rb', line 50 def run # 配置二进制库环境,需要区分静态库还是动态库 isGenDylib = @is_dylib sources_manager = Pod::Config.instance.sources_manager sources_manager.initLibEnv(isGenDylib) # 清除之前的缓存 CBin::Config::Builder.instance.clean @spec = Specification.from_file(@podspec) # dev环境修改version规则 by hm 24/8/20 @spec.version = binary_version(@is_dev_model) # 上传文件 localPath = update_uploadpath unless !@localPath if File.file?(localPath) # 生成podspec sources_sepc = Array.new sources_sepc << @spec fail_push_specs = [] sources_sepc.uniq.each do |spec| begin fail_push_specs << spec unless CBin::Upload::Helper.new(spec,true,@sources,true).upload_binary_file(localPath, @is_dylib, @vendored_framework_name) rescue Object => exception UI.puts exception fail_push_specs << spec end end if fail_push_specs.any? fail_push_specs.uniq.each do |spec| UI.warn "【#{spec.name} | #{spec.version}】组件spec push失败 ." end end success_specs = sources_sepc - fail_push_specs if success_specs.any? auto_success = "" success_specs.uniq.each do |spec| auto_success += "#{spec.name} | #{spec.version}\n" UI.warn "===【 #{spec.name} | #{spec.version} 】二进制组件制作完成 !!! " end puts auto_success ENV['auto_success'] = auto_success end #pod repo update UI.section("\nUpdating Spec Repositories\n".yellow) do Pod::Command::Bin::Repo::Update.new(CLAide::ARGV.new([])).run end end end |
#update_uploadpath ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/cocoapods-bb-bin/command/bin/localPush.rb', line 118 def update_uploadpath worksppace_path = Dir.pwd path = File.join(worksppace_path, @localPath) if File.file?(path) return path end path = @localPath if File.file?(path) # 判断文件绝对路径absolute_path 2x版本不支持 return path end return nil end |
#validate! ⇒ Object
45 46 47 48 |
# File 'lib/cocoapods-bb-bin/command/bin/localPush.rb', line 45 def validate! help! "未找到 podspec文件" unless @podspec super end |