Class: Pod::Installer::Analyzer::SpecsState
- Inherits:
-
Object
- Object
- Pod::Installer::Analyzer::SpecsState
- Defined in:
- lib/cocoapods/installer/analyzer/specs_state.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.
Instance Attribute Summary 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.
Instance Method Summary collapse
-
#add_name(name, state) ⇒ void
Adds the name of a Pod to the give state.
-
#initialize(pods_by_state = nil) ⇒ SpecsState
constructor
Initialize a new instance.
-
#print ⇒ void
Displays the state of each pod.
Constructor Details
#initialize(pods_by_state = nil) ⇒ SpecsState
Initialize a new instance
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/cocoapods/installer/analyzer/specs_state.rb', line 19 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.
35 36 37 |
# File 'lib/cocoapods/installer/analyzer/specs_state.rb', line 35 def added @added end |
#changed ⇒ Array<String>
Returns the names of the pods that were changed.
39 40 41 |
# File 'lib/cocoapods/installer/analyzer/specs_state.rb', line 39 def changed @changed end |
#deleted ⇒ Array<String>
Returns the names of the pods that were deleted.
43 44 45 |
# File 'lib/cocoapods/installer/analyzer/specs_state.rb', line 43 def deleted @deleted end |
#unchanged ⇒ Array<String>
Returns the names of the pods that were unchanged.
47 48 49 |
# File 'lib/cocoapods/installer/analyzer/specs_state.rb', line 47 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.
70 71 72 |
# File 'lib/cocoapods/installer/analyzer/specs_state.rb', line 70 def add_name(name, state) send(state) << name end |
#print ⇒ void
This method returns an undefined value.
Displays the state of each pod.
53 54 55 56 57 58 |
# File 'lib/cocoapods/installer/analyzer/specs_state.rb', line 53 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 |