Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
2187a0a5
Commit
2187a0a5
authored
May 10, 2015
by
Marius Rackwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Analyzer] Move SpecsState into an own file
parent
ed3d3e78
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
73 deletions
+77
-73
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+1
-73
specs_state.rb
lib/cocoapods/installer/analyzer/specs_state.rb
+76
-0
No files found.
lib/cocoapods/installer/analyzer.rb
View file @
2187a0a5
...
...
@@ -8,6 +8,7 @@ module Pod
autoload
:AnalysisResult
,
'cocoapods/installer/analyzer/analysis_result'
autoload
:SandboxAnalyzer
,
'cocoapods/installer/analyzer/sandbox_analyzer'
autoload
:SpecsState
,
'cocoapods/installer/analyzer/specs_state'
autoload
:LockingDependencyAnalyzer
,
'cocoapods/installer/analyzer/locking_dependency_analyzer'
# @return [Sandbox] The sandbox where the Pods should be installed.
...
...
@@ -767,79 +768,6 @@ module Pod
end
end
end
#-----------------------------------------------------------------------#
# This class represents the state of a collection of Pods.
#
# @note The names of the pods stored by this class are always the **root**
# name of the specification.
#
# @note The motivation for this class is to ensure that the names of the
# subspecs are added instead of the name of the Pods.
#
class
SpecsState
# Initialize a new instance
#
# @param [Hash{Symbol=>String}] pods_by_state
# The name of the pods grouped by their state
# (`:added`, `:removed`, `:changed` or `:unchanged`).
#
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
# @return [Array<String>] the names of the pods that were added.
#
attr_accessor
:added
# @return [Array<String>] the names of the pods that were changed.
#
attr_accessor
:changed
# @return [Array<String>] the names of the pods that were deleted.
#
attr_accessor
:deleted
# @return [Array<String>] the names of the pods that were unchanged.
#
attr_accessor
:unchanged
# Displays the state of each pod.
#
# @return [void]
#
def
print
added
.
sort
.
each
{
|
pod
|
UI
.
message
(
'A'
.
green
+
"
#{
pod
}
"
,
''
,
2
)
}
deleted
.
sort
.
each
{
|
pod
|
UI
.
message
(
'R'
.
red
+
"
#{
pod
}
"
,
''
,
2
)
}
changed
.
sort
.
each
{
|
pod
|
UI
.
message
(
'M'
.
yellow
+
"
#{
pod
}
"
,
''
,
2
)
}
unchanged
.
sort
.
each
{
|
pod
|
UI
.
message
(
'-'
+
"
#{
pod
}
"
,
''
,
2
)
}
end
# Adds the name of a Pod to the give state.
#
# @param [String] name
# the name of the Pod.
#
# @param [Symbol] state
# the state of the Pod.
#
# @return [void]
#
def
add_name
(
name
,
state
)
send
(
state
)
<<
name
end
end
end
end
end
lib/cocoapods/installer/analyzer/specs_state.rb
0 → 100644
View file @
2187a0a5
module
Pod
class
Installer
class
Analyzer
# This class represents the state of a collection of Pods.
#
# @note The names of the pods stored by this class are always the **root**
# name of the specification.
#
# @note The motivation for this class is to ensure that the names of the
# subspecs are added instead of the name of the Pods.
#
class
SpecsState
# Initialize a new instance
#
# @param [Hash{Symbol=>String}] pods_by_state
# The name of the pods grouped by their state
# (`:added`, `:removed`, `:changed` or `:unchanged`).
#
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
# @return [Array<String>] the names of the pods that were added.
#
attr_accessor
:added
# @return [Array<String>] the names of the pods that were changed.
#
attr_accessor
:changed
# @return [Array<String>] the names of the pods that were deleted.
#
attr_accessor
:deleted
# @return [Array<String>] the names of the pods that were unchanged.
#
attr_accessor
:unchanged
# Displays the state of each pod.
#
# @return [void]
#
def
print
added
.
sort
.
each
{
|
pod
|
UI
.
message
(
'A'
.
green
+
"
#{
pod
}
"
,
''
,
2
)
}
deleted
.
sort
.
each
{
|
pod
|
UI
.
message
(
'R'
.
red
+
"
#{
pod
}
"
,
''
,
2
)
}
changed
.
sort
.
each
{
|
pod
|
UI
.
message
(
'M'
.
yellow
+
"
#{
pod
}
"
,
''
,
2
)
}
unchanged
.
sort
.
each
{
|
pod
|
UI
.
message
(
'-'
+
"
#{
pod
}
"
,
''
,
2
)
}
end
# Adds the name of a Pod to the give state.
#
# @param [String] name
# the name of the Pod.
#
# @param [Symbol] state
# the state of the Pod.
#
# @return [void]
#
def
add_name
(
name
,
state
)
send
(
state
)
<<
name
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment