Class: Pod::Command::Bin::Lock::Version
- Inherits:
-
Pod::Command::Bin::Lock
- Object
- Pod::Command
- Pod::Command::Bin
- Pod::Command::Bin::Lock
- Pod::Command::Bin::Lock::Version
- Includes:
- Pod
- Defined in:
- lib/cocoapods-mtxx-bin/command/bin/lock/version.rb
Instance Method Summary collapse
-
#initialize(argv) ⇒ Version
constructor
A new instance of Version.
- #run ⇒ Object
Methods included from Pod
Methods inherited from Pod::Command::Bin::Lock
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_list, #sources_manager, #sources_option, #valid_sources
Constructor Details
#initialize(argv) ⇒ Version
Returns a new instance of Version.
15 16 17 18 |
# File 'lib/cocoapods-mtxx-bin/command/bin/lock/version.rb', line 15 def initialize(argv) super @pod_name = argv.shift_argument end |
Instance Method Details
#run ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/cocoapods-mtxx-bin/command/bin/lock/version.rb', line 20 def run super raise Informative, "请输入Pod库名称,如:AFNetworking" if @pod_name.nil? versions = [] @analyze_result.specifications.map do |spec| if spec.name == @pod_name versions << spec.version end end versions = versions.uniq UI.puts "\n" raise Informative, "未查找到`#{@pod_name}`的版本号,请检查`#{@pod_name}`是否拼写错误" if versions.empty? UI.puts "`#{@pod_name}`版本如下:".yellow versions.map { |v| UI.puts "- #{v}" } UI.puts "[!] `#{@pod_name}`有`#{versions.size}`个版本,可能会导致意想不到的事情,请确保每个Pod库只有一个依赖版本".yellow if versions.size > 1 end |