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
4c3544dc
Commit
4c3544dc
authored
Apr 09, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't initialize Spec::Set::Statistics if not needed
See #919
parent
8be4e89a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
16 deletions
+26
-16
cocoapods.rb
lib/cocoapods.rb
+3
-1
command.rb
lib/cocoapods/command.rb
+10
-9
list.rb
lib/cocoapods/command/list.rb
+4
-2
search.rb
lib/cocoapods/command/search.rb
+7
-1
user_interface.rb
lib/cocoapods/user_interface.rb
+2
-2
user_interface_spec.rb
spec/functional/user_interface_spec.rb
+0
-1
No files found.
lib/cocoapods.rb
View file @
4c3544dc
...
@@ -33,7 +33,9 @@ module Pod
...
@@ -33,7 +33,9 @@ module Pod
#
#
MAX_CACHE_SIZE
=
500
MAX_CACHE_SIZE
=
500
Pod
::
Specification
::
Set
::
Statistics
.
instance
.
cache_file
=
CACHE_ROOT
+
'statistics.yml'
# @return [Pathname] The file to use a cache of the statistics provider.
#
STATISTICS_CACHE_FILE
=
CACHE_ROOT
+
'statistics.yml'
autoload
:Command
,
'cocoapods/command'
autoload
:Command
,
'cocoapods/command'
autoload
:Executable
,
'cocoapods/executable'
autoload
:Executable
,
'cocoapods/executable'
...
...
lib/cocoapods/command.rb
View file @
4c3544dc
...
@@ -8,6 +8,16 @@ module Pod
...
@@ -8,6 +8,16 @@ module Pod
class
Command
<
CLAide
::
Command
class
Command
<
CLAide
::
Command
require
'cocoapods/command/list'
require
'cocoapods/command/outdated'
require
'cocoapods/command/project'
require
'cocoapods/command/push'
require
'cocoapods/command/repo'
require
'cocoapods/command/search'
require
'cocoapods/command/setup'
require
'cocoapods/command/spec'
require
'cocoapods/command/inter_process_communication'
self
.
abstract_command
=
true
self
.
abstract_command
=
true
self
.
command
=
'pod'
self
.
command
=
'pod'
self
.
description
=
'CocoaPods, the Objective-C library package manager.'
self
.
description
=
'CocoaPods, the Objective-C library package manager.'
...
@@ -102,12 +112,3 @@ module Pod
...
@@ -102,12 +112,3 @@ module Pod
end
end
end
end
require
'cocoapods/command/list'
require
'cocoapods/command/outdated'
require
'cocoapods/command/project'
require
'cocoapods/command/push'
require
'cocoapods/command/repo'
require
'cocoapods/command/search'
require
'cocoapods/command/setup'
require
'cocoapods/command/spec'
require
'cocoapods/command/inter_process_communication'
lib/cocoapods/command/list.rb
View file @
4c3544dc
...
@@ -48,7 +48,8 @@ module Pod
...
@@ -48,7 +48,8 @@ module Pod
dates
,
groups
=
{},
{}
dates
,
groups
=
{},
{}
days
.
each
{
|
d
|
dates
[
d
]
=
Time
.
now
-
60
*
60
*
24
*
d
}
days
.
each
{
|
d
|
dates
[
d
]
=
Time
.
now
-
60
*
60
*
24
*
d
}
sets
=
SourcesManager
.
all_sets
sets
=
SourcesManager
.
all_sets
creation_dates
=
Specification
::
Set
::
Statistics
.
instance
.
creation_dates
(
sets
)
statistics_provider
=
Specification
::
Set
::
Statistics
.
new
(
STATISTICS_CACHE_FILE
)
creation_dates
=
statistics_provider
.
creation_dates
(
sets
)
sets
.
each
do
|
set
|
sets
.
each
do
|
set
|
set_date
=
creation_dates
[
set
.
name
]
set_date
=
creation_dates
[
set
.
name
]
...
@@ -65,7 +66,8 @@ module Pod
...
@@ -65,7 +66,8 @@ module Pod
next
unless
sets
next
unless
sets
UI
.
section
(
"
\n
Pods added in the last
#{
"day"
.
pluralize
(
d
)
}
"
.
yellow
)
do
UI
.
section
(
"
\n
Pods added in the last
#{
"day"
.
pluralize
(
d
)
}
"
.
yellow
)
do
sorted
=
sets
.
sort_by
{
|
s
|
creation_dates
[
s
.
name
]}
sorted
=
sets
.
sort_by
{
|
s
|
creation_dates
[
s
.
name
]}
sorted
.
each
{
|
set
|
UI
.
pod
(
set
,
(
@stats
?
:
stats
:
:name
))
}
mode
=
@stats
?
:
stats
:
:name
sorted
.
each
{
|
set
|
UI
.
pod
(
set
,
mode
,
statistics_provider
)
}
end
end
end
end
end
end
...
...
lib/cocoapods/command/search.rb
View file @
4c3544dc
...
@@ -42,9 +42,15 @@ module Pod
...
@@ -42,9 +42,15 @@ module Pod
if
@supported_on_osx
if
@supported_on_osx
sets
.
reject!
{
|
set
|
!
set
.
specification
.
available_platforms
.
map
(
&
:name
).
include?
(
:osx
)
}
sets
.
reject!
{
|
set
|
!
set
.
specification
.
available_platforms
.
map
(
&
:name
).
include?
(
:osx
)
}
end
end
statistics_provider
=
Specification
::
Set
::
Statistics
.
new
(
STATISTICS_CACHE_FILE
)
sets
.
each
do
|
set
|
sets
.
each
do
|
set
|
begin
begin
UI
.
pod
(
set
,
(
@stats
?
:
stats
:
:normal
))
if
@stats
UI
.
pod
(
set
,
:stats
,
statistics_provider
)
else
UI
.
pod
(
set
,
:normal
)
end
rescue
DSLError
rescue
DSLError
UI
.
warn
"Skipping `
#{
set
.
name
}
` because the podspec contains errors."
UI
.
warn
"Skipping `
#{
set
.
name
}
` because the podspec contains errors."
end
end
...
...
lib/cocoapods/user_interface.rb
View file @
4c3544dc
...
@@ -157,11 +157,11 @@ module Pod
...
@@ -157,11 +157,11 @@ module Pod
# Prints the textual representation of a given set.
# Prints the textual representation of a given set.
#
#
def
pod
(
set
,
mode
=
:normal
)
def
pod
(
set
,
mode
=
:normal
,
statistics_provider
=
nil
)
if
mode
==
:name
if
mode
==
:name
puts_indented
set
.
name
puts_indented
set
.
name
else
else
pod
=
Specification
::
Set
::
Presenter
.
new
(
set
)
pod
=
Specification
::
Set
::
Presenter
.
new
(
set
,
statistics_provider
)
title
(
"
\n
->
#{
pod
.
name
}
(
#{
pod
.
version
}
)"
.
green
,
''
,
1
)
do
title
(
"
\n
->
#{
pod
.
name
}
(
#{
pod
.
version
}
)"
.
green
,
''
,
1
)
do
puts_indented
pod
.
summary
puts_indented
pod
.
summary
labeled
(
'Homepage'
,
pod
.
homepage
)
labeled
(
'Homepage'
,
pod
.
homepage
)
...
...
spec/functional/user_interface_spec.rb
View file @
4c3544dc
...
@@ -7,7 +7,6 @@ module Pod
...
@@ -7,7 +7,6 @@ module Pod
before
do
before
do
@set
=
SourcesManager
.
search
(
Dependency
.
new
(
'CocoaLumberjack'
))
@set
=
SourcesManager
.
search
(
Dependency
.
new
(
'CocoaLumberjack'
))
Specification
::
Set
::
Statistics
.
instance
.
cache_file
=
nil
end
end
it
"presents the name, version, description, homepage and source of a specification set"
do
it
"presents the name, version, description, homepage and source of a specification set"
do
...
...
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