Class: Pod::Installer::Analyzer::SpecsState
- Inherits:
-
Object
- Object
- Pod::Installer::Analyzer::SpecsState
- Defined in:
- lib/cocoapods/installer/analyzer.rb
Overview
The names of the pods stored by this class are always the root name of the specification.
The motivation for this class is to ensure that the names of the subspecs are added instead of the name of the Pods.
This class represents the state of a collection of Pods.
Analysis sub-steps collapse
-
#added ⇒ Array<String>
The names of the pods that were added.
-
#changed ⇒ Array<String>
The names of the pods that were changed.
-
#deleted ⇒ Array<String>
The names of the pods that were deleted.
-
#unchanged ⇒ Array<String>
The names of the pods that were unchanged.
Analysis sub-steps collapse
-
#add_name(name, state) ⇒ void
Adds the name of a Pod to the give state.
-
#initialize(pods_by_state = nil) ⇒ SpecsState
constructor
A new instance of SpecsState.
-
#print ⇒ void
Displays the state of each pod.
Constructor Details
#initialize(pods_by_state = nil) ⇒ SpecsState
Returns a new instance of SpecsState.
498 499 500 501 502 503 504 505 506 507 508 509 510 |
# File 'lib/cocoapods/installer/analyzer.rb', line 498 def initialize(pods_by_state = nil) @added = [] @deleted = [] @changed = [] @unchanged = [] if pods_by_state @added = pods_by_state[:added] || [] @deleted = pods_by_state[:removed] || [] @changed = pods_by_state[:changed] || [] @unchanged = pods_by_state[:unchanged] || [] end end |
Instance Attribute Details
#added ⇒ Array<String>
Returns the names of the pods that were added.
514 515 516 |
# File 'lib/cocoapods/installer/analyzer.rb', line 514 def added @added end |
#changed ⇒ Array<String>
Returns the names of the pods that were changed.
518 519 520 |
# File 'lib/cocoapods/installer/analyzer.rb', line 518 def changed @changed end |
#deleted ⇒ Array<String>
Returns the names of the pods that were deleted.
522 523 524 |
# File 'lib/cocoapods/installer/analyzer.rb', line 522 def deleted @deleted end |
#unchanged ⇒ Array<String>
Returns the names of the pods that were unchanged.
526 527 528 |
# File 'lib/cocoapods/installer/analyzer.rb', line 526 def unchanged @unchanged end |
Instance Method Details
#add_name(name, state) ⇒ void
This method returns an undefined value.
Adds the name of a Pod to the give state.
551 552 553 554 |
# File 'lib/cocoapods/installer/analyzer.rb', line 551 def add_name(name, state) raise "[Bug] Attempt to add subspec to the pods state" if name.include?('/') self.send(state) << name end |
#print ⇒ void
This method returns an undefined value.
Displays the state of each pod.
532 533 534 535 536 537 |
# File 'lib/cocoapods/installer/analyzer.rb', line 532 def print added .sort.each { |pod| UI.("A".green + " #{pod}", '', 2) } deleted .sort.each { |pod| UI.("R".red + " #{pod}", '', 2) } changed .sort.each { |pod| UI.("M".yellow + " #{pod}", '', 2) } unchanged.sort.each { |pod| UI.("-" + " #{pod}", '', 2) } end |