require 'cocoapods' require_relative '../source/core/run_helper' module OrmDev class Command class Publish < Command self.summary = '发布插件' self.description = <<-DESC 发布插件. 指定'插件名.podspec'的路径`PATH`。 DESC self.arguments = [ CLAide::Argument.new('PATH', false) ] def self.options [ ].concat(super) end def initialize(argv) @podspec_file = argv.shift_argument @podspec_files = Pathname.pwd.children.select { |pn| pn.extname == '.podspec' } super end def validate! super # raise Pod::Informative, "No `Cimfile' found in the project directory." unless @cipfile_path.exist? if @podspec_file help! "podspec file at #{@podspec_file} does not exist" unless File.exist? @podspec_file @podspec_path = @podspec_file else raise Pod::Informative, 'No podspec file found, please specify one' unless @podspec_files.length > 0 raise Pod::Informative, 'Multiple podspec file found, please specify one' unless @podspec_files.length == 1 @podspec_path = @podspec_files.first end end def run super OrmDev::LogUtil.info '[插件发布] '.green installer = OrmDev::RunHelper.new(@podspec_path) installer.setup() OrmDev::LogUtil.info "Success!!! Please run command:\n orm ipa \#{platform}" end end end end