Class: Pod::Command::Binary::Version::Match

Inherits:
Pod::Command::Binary::Version show all
Defined in:
lib/cocoapods-tdfire-binary/command/version/match.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pod::Command::Binary

#binary_config, #first_podspec, #private_sources

Constructor Details

#initialize(argv) ⇒ Match

Returns a new instance of Match.



22
23
24
25
26
# File 'lib/cocoapods-tdfire-binary/command/version/match.rb', line 22

def initialize(argv)
	@update_source = argv.flag?('update-source')
	@source = private_sources.first
	super 
end

Instance Attribute Details

#sourceObject (readonly)

Returns the value of attribute source.



14
15
16
# File 'lib/cocoapods-tdfire-binary/command/version/match.rb', line 14

def source
  @source
end

Class Method Details

.optionsObject



16
17
18
19
20
# File 'lib/cocoapods-tdfire-binary/command/version/match.rb', line 16

def self.options
  [
    ['--update-source', '更新私有源'],
  ].concat(super)
end

Instance Method Details



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/cocoapods-tdfire-binary/command/version/match.rb', line 48

def print_unmatched_newest_dependencies
	tagged_dependencies = config.podfile.dependencies.reject(&:external?)
	if tagged_dependencies.any?
		unmatched_newest_dependencies = tagged_dependencies.reject do |dep|
			versions = source.versions(dep.name) || source.versions(dep.name.split('/').first)
			version = versions && versions.sort.last 
			dep.requirement === version if version
		end

		if unmatched_newest_dependencies.any?
			puts "\n以下组件没有 match 最新版本:"    
     puts "============================================" 
			puts unmatched_newest_dependencies.reduce("") { |result, dep|
       versions = source.versions(dep.name) || source.versions(dep.name.split('/').first)
       version = versions.sort.last if versions
       result << ("%-50s %s %-15s %s %s\n" % [dep.name, '=> 当前:', dep.requirement, '最新:', version])
     }
     puts "============================================" 
		end
	end
end


33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/cocoapods-tdfire-binary/command/version/match.rb', line 33

def print_untagged_pod
	external_names = config.podfile.dependencies.select(&:external?).map(&:name)
	if external_names.any?
		puts "\n以下组件版本没有打tag:"    
    puts "============================================" 
    puts external_names.reduce("") { |result, pod|
      versions = source.versions(pod)
      version = versions.sort.last if versions
      pod = pod + "\t(最新版本 #{version.to_s}" if version
      result << pod + "\n"
    }
    puts "============================================" 
	end
end

#runObject



70
71
72
73
74
75
# File 'lib/cocoapods-tdfire-binary/command/version/match.rb', line 70

def run 
	private_sources.each { |s| s.update(true) } if @update_source

						print_untagged_pod	 
						print_unmatched_newest_dependencies       	
end

#validate!Object



28
29
30
31
# File 'lib/cocoapods-tdfire-binary/command/version/match.rb', line 28

def validate!
  super
  verify_podfile_exists!
end