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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
15 deletions
+52
-15
dependency.rb
lib/cocoapods/dependency.rb
+4
-2
user_interface.rb
lib/cocoapods/user_interface.rb
+48
-13
No files found.
lib/cocoapods/dependency.rb
View file @
0eadc218
...
...
@@ -193,7 +193,7 @@ module Pod
class
GitSource
<
AbstractExternalSource
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
.
rmtree
if
target
.
exist?
downloader
=
Downloader
.
for_target
(
sandbox
.
root
+
name
,
@params
)
...
...
@@ -203,6 +203,7 @@ module Pod
local_pod
.
downloaded
=
true
end
end
end
def
description
"from `
#{
@params
[
:git
]
}
'"
.
tap
do
|
description
|
...
...
@@ -216,11 +217,12 @@ module Pod
# can be http, file, etc
class
PodspecSource
<
AbstractExternalSource
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
=
Pathname
.
new
(
path
).
expand_path
if
path
.
start_with?
(
"~"
)
open
(
path
)
{
|
io
|
store_podspec
(
sandbox
,
io
.
read
)
}
end
end
def
description
"from `
#{
@params
[
:podspec
]
}
'"
...
...
lib/cocoapods/user_interface.rb
View file @
0eadc218
...
...
@@ -4,9 +4,10 @@ module Pod
autoload
:UIPod
,
'cocoapods/user_interface/ui_pod'
@indentation_level
=
0
@title_level
=
0
@title_colors
=
%w|yellow green|
@title_level
=
0
@indentation_level
=
0
@treat_titles_as_messages
=
false
class
<<
self
include
Config
::
Mixin
...
...
@@ -41,12 +42,16 @@ module Pod
# A title oposed to a section is always visible
#
def
title
(
title
,
verbose_prefix
=
''
,
relative_indentation
=
2
)
if
(
@treat_titles_as_messages
)
message
(
title
,
verbose_prefix
)
else
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
self
.
indentation_level
+=
relative_indentation
self
.
title_level
+=
1
...
...
@@ -73,18 +78,22 @@ module Pod
self
.
indentation_level
-=
relative_indentation
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
=
''
)
super
(
message
)
unless
config
.
silent?
end
# Prints a message respecting the current indentation level and
# wrapping it to the termina width if necessary.
# Any title printed in the optional block is treated as a message.
#
def
puts_indented
(
message
=
''
)
indented
=
wrap_string
(
message
,
" "
*
self
.
indentation_level
)
def
info
(
message
)
indentation
=
config
.
verbose?
?
self
.
indentation_level
:
0
indented
=
wrap_string
(
message
,
" "
*
indentation
)
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
# Returns a string containing relative location of a path from the Podfile.
...
...
@@ -141,8 +150,34 @@ module Pod
end
end
# Wraps a string with a given indent to the width of the terminal.
# adapted from http://blog.macromates.com/2006/wrapping-text-with-regular-expressions/
# @!group Basic printing
# 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
=
''
)
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