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
0eadc218
Commit
0eadc218
authored
Sep 19, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Dependency] indent fetching messages.
parent
7df2566a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
47 deletions
+84
-47
dependency.rb
lib/cocoapods/dependency.rb
+14
-12
user_interface.rb
lib/cocoapods/user_interface.rb
+70
-35
No files found.
lib/cocoapods/dependency.rb
View file @
0eadc218
...
@@ -193,14 +193,15 @@ module Pod
...
@@ -193,14 +193,15 @@ module Pod
class
GitSource
<
AbstractExternalSource
class
GitSource
<
AbstractExternalSource
def
copy_external_source_into_sandbox
(
sandbox
,
platform
)
def
copy_external_source_into_sandbox
(
sandbox
,
platform
)
puts
"-> Pre-downloading: '
#{
name
}
'"
unless
config
.
silent?
UI
.
info
(
"->"
.
green
+
" Pre-downloading: '
#{
name
}
'"
)
do
target
=
sandbox
.
root
+
name
target
=
sandbox
.
root
+
name
target
.
rmtree
if
target
.
exist?
target
.
rmtree
if
target
.
exist?
downloader
=
Downloader
.
for_target
(
sandbox
.
root
+
name
,
@params
)
downloader
=
Downloader
.
for_target
(
sandbox
.
root
+
name
,
@params
)
downloader
.
download
downloader
.
download
store_podspec
(
sandbox
,
target
+
"
#{
name
}
.podspec"
)
store_podspec
(
sandbox
,
target
+
"
#{
name
}
.podspec"
)
if
local_pod
=
sandbox
.
installed_pod_named
(
name
,
platform
)
if
local_pod
=
sandbox
.
installed_pod_named
(
name
,
platform
)
local_pod
.
downloaded
=
true
local_pod
.
downloaded
=
true
end
end
end
end
end
...
@@ -216,10 +217,11 @@ module Pod
...
@@ -216,10 +217,11 @@ module Pod
# can be http, file, etc
# can be http, file, etc
class
PodspecSource
<
AbstractExternalSource
class
PodspecSource
<
AbstractExternalSource
def
copy_external_source_into_sandbox
(
sandbox
,
_
)
def
copy_external_source_into_sandbox
(
sandbox
,
_
)
puts
"-> Fetching podspec for `
#{
name
}
' from:
#{
@params
[
:podspec
]
}
"
unless
config
.
silent?
UI
.
info
(
"->"
.
green
+
" Fetching podspec for `
#{
name
}
' from:
#{
@params
[
:podspec
]
}
"
)
do
path
=
@params
[
:podspec
]
path
=
@params
[
:podspec
]
path
=
Pathname
.
new
(
path
).
expand_path
if
path
.
start_with?
(
"~"
)
path
=
Pathname
.
new
(
path
).
expand_path
if
path
.
start_with?
(
"~"
)
open
(
path
)
{
|
io
|
store_podspec
(
sandbox
,
io
.
read
)
}
open
(
path
)
{
|
io
|
store_podspec
(
sandbox
,
io
.
read
)
}
end
end
end
def
description
def
description
...
...
lib/cocoapods/user_interface.rb
View file @
0eadc218
...
@@ -4,9 +4,10 @@ module Pod
...
@@ -4,9 +4,10 @@ module Pod
autoload
:UIPod
,
'cocoapods/user_interface/ui_pod'
autoload
:UIPod
,
'cocoapods/user_interface/ui_pod'
@indentation_level
=
0
@title_level
=
0
@title_colors
=
%w|yellow green|
@title_colors
=
%w|yellow green|
@title_level
=
0
@indentation_level
=
0
@treat_titles_as_messages
=
false
class
<<
self
class
<<
self
include
Config
::
Mixin
include
Config
::
Mixin
...
@@ -41,12 +42,16 @@ module Pod
...
@@ -41,12 +42,16 @@ module Pod
# A title oposed to a section is always visible
# A title oposed to a section is always visible
#
#
def
title
(
title
,
verbose_prefix
=
''
,
relative_indentation
=
2
)
def
title
(
title
,
verbose_prefix
=
''
,
relative_indentation
=
2
)
title
=
verbose_prefix
+
title
if
config
.
verbose?
if
(
@treat_titles_as_messages
)
title
=
"
\n
#{
title
}
"
if
@title_level
<
2
message
(
title
,
verbose_prefix
)
if
(
color
=
@title_colors
[
@title_level
])
else
title
=
title
.
send
(
color
)
title
=
verbose_prefix
+
title
if
config
.
verbose?
title
=
"
\n
#{
title
}
"
if
@title_level
<
2
if
(
color
=
@title_colors
[
@title_level
])
title
=
title
.
send
(
color
)
end
puts
"
#{
title
}
"
end
end
puts
"
#{
title
}
"
self
.
indentation_level
+=
relative_indentation
self
.
indentation_level
+=
relative_indentation
self
.
title_level
+=
1
self
.
title_level
+=
1
...
@@ -64,7 +69,7 @@ module Pod
...
@@ -64,7 +69,7 @@ module Pod
#
#
# TODO: clean interface.
# TODO: clean interface.
#
#
def
message
(
message
,
verbose_prefix
=
''
,
relative_indentation
=
2
)
def
message
(
message
,
verbose_prefix
=
''
,
relative_indentation
=
2
)
message
=
verbose_prefix
+
message
if
config
.
verbose?
message
=
verbose_prefix
+
message
if
config
.
verbose?
puts_indented
message
if
config
.
verbose?
puts_indented
message
if
config
.
verbose?
...
@@ -73,18 +78,22 @@ module Pod
...
@@ -73,18 +78,22 @@ module Pod
self
.
indentation_level
-=
relative_indentation
self
.
indentation_level
-=
relative_indentation
end
end
# Prints a message unless config is silent.
# Prints an info to the user. The info is always displayed.
# It respects the current indentation level only in verbose
# mode.
#
#
def
puts
(
message
=
''
)
# Any title printed in the optional block is treated as a message.
super
(
message
)
unless
config
.
silent?
end
# Prints a message respecting the current indentation level and
# wrapping it to the termina width if necessary.
#
#
def
puts_indented
(
message
=
''
)
def
info
(
message
)
indented
=
wrap_string
(
message
,
" "
*
self
.
indentation_level
)
indentation
=
config
.
verbose?
?
self
.
indentation_level
:
0
indented
=
wrap_string
(
message
,
" "
*
indentation
)
puts
(
indented
)
puts
(
indented
)
self
.
indentation_level
+=
2
@treat_titles_as_messages
=
true
yield
if
block_given?
@treat_titles_as_messages
=
false
self
.
indentation_level
-=
2
end
end
# Returns a string containing relative location of a path from the Podfile.
# Returns a string containing relative location of a path from the Podfile.
...
@@ -105,23 +114,23 @@ module Pod
...
@@ -105,23 +114,23 @@ module Pod
if
mode
==
:name
if
mode
==
:name
puts_indented
set
.
name
puts_indented
set
.
name
else
else
pod
=
UIPod
.
new
(
set
)
pod
=
UIPod
.
new
(
set
)
title
(
"
\n
->
#{
pod
.
name
}
(
#{
pod
.
version
}
)"
.
green
,
''
,
3
)
do
title
(
"
\n
->
#{
pod
.
name
}
(
#{
pod
.
version
}
)"
.
green
,
''
,
3
)
do
puts_indented
pod
.
summary
puts_indented
pod
.
summary
labeled
(
'Homepage'
,
pod
.
homepage
)
labeled
(
'Homepage'
,
pod
.
homepage
)
labeled
(
'Source'
,
pod
.
source_url
)
labeled
(
'Source'
,
pod
.
source_url
)
labeled
(
'Versions'
,
pod
.
versions
)
unless
set
.
versions
.
count
==
1
labeled
(
'Versions'
,
pod
.
versions
)
unless
set
.
versions
.
count
==
1
if
mode
==
:stats
if
mode
==
:stats
labeled
(
'Pushed'
,
pod
.
github_last_activity
)
labeled
(
'Pushed'
,
pod
.
github_last_activity
)
labeled
(
'Authors'
,
pod
.
authors
)
if
pod
.
authors
=~
/,/
labeled
(
'Authors'
,
pod
.
authors
)
if
pod
.
authors
=~
/,/
labeled
(
'Author'
,
pod
.
authors
)
if
pod
.
authors
!~
/,/
labeled
(
'Author'
,
pod
.
authors
)
if
pod
.
authors
!~
/,/
labeled
(
'License'
,
pod
.
license
)
labeled
(
'License'
,
pod
.
license
)
labeled
(
'Platform'
,
pod
.
platform
)
labeled
(
'Platform'
,
pod
.
platform
)
labeled
(
'Watchers'
,
pod
.
github_watchers
)
labeled
(
'Watchers'
,
pod
.
github_watchers
)
labeled
(
'Forks'
,
pod
.
github_forks
)
labeled
(
'Forks'
,
pod
.
github_forks
)
end
labeled
(
'Sub specs'
,
pod
.
subspecs
)
end
end
labeled
(
'Sub specs'
,
pod
.
subspecs
)
end
end
end
end
end
...
@@ -141,8 +150,34 @@ module Pod
...
@@ -141,8 +150,34 @@ module Pod
end
end
end
end
# Wraps a string with a given indent to the width of the terminal.
# @!group Basic printing
# adapted from http://blog.macromates.com/2006/wrapping-text-with-regular-expressions/
# Prints a message unless config is silent.
#
def
puts
(
message
=
''
)
super
(
message
)
unless
config
.
silent?
end
# Prints a message respecting the current indentation level and
# wrapping it to the terminal width if necessary.
#
def
puts_indented
(
message
=
''
)
indented
=
wrap_string
(
message
,
" "
*
self
.
indentation_level
)
puts
(
indented
)
end
private
# @!group Helpers
# Wraps a string taking into account the width of the terminal and an
# option indent. Adapted from http://blog.macromates.com/2006/wrapping-text-with-regular-expressions/
#
# @param [String] txt The string to wrap
#
# @param [String] indent The string to use to indent the result.
#
# @return [String] The formatted string.
#
#
def
wrap_string
(
txt
,
indent
=
''
)
def
wrap_string
(
txt
,
indent
=
''
)
width
=
`stty size`
.
split
(
' '
)[
1
].
to_i
-
indent
.
length
width
=
`stty size`
.
split
(
' '
)[
1
].
to_i
-
indent
.
length
...
...
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