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
064958d4
Commit
064958d4
authored
May 01, 2014
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Spec] Fix ErrorReport spec
parent
3762f5a1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
error_report.rb
lib/cocoapods/user_interface/error_report.rb
+15
-4
error_report_spec.rb
spec/unit/user_interface/error_report_spec.rb
+4
-3
No files found.
lib/cocoapods/user_interface/error_report.rb
View file @
064958d4
...
...
@@ -7,9 +7,6 @@ module Pod
module
UserInterface
module
ErrorReport
class
<<
self
def
pathless_exception_message
(
message
)
message
.
gsub
(
/- \(.*\):/
,
'-'
)
end
def
report
(
exception
)
return
<<-
EOS
...
...
@@ -49,7 +46,7 @@ Repositories : #{repo_information.join("\n ")}
#{
'[!] Oh no, an error occurred.'
.
red
}
#{
error_from_podfile
(
exception
)
}
#{
'Search for existing github issues similar to yours:'
.
yellow
}
#{
"https://github.com/CocoaPods/CocoaPods/search?q=
#{
CGI
.
escape
(
pathless_exception_message
(
exception
.
message
))
}
&type=Issues"
}
#{
issues_url
(
exception
)
}
#{
'If none exists, create a ticket, with the template displayed above, on:'
.
yellow
}
https://github.com/CocoaPods/CocoaPods/issues/new
...
...
@@ -61,6 +58,10 @@ EOS
private
def
pathless_exception_message
(
message
)
message
.
gsub
(
/- \(.*\):/
,
'-'
)
end
def
markdown_podfile
return
''
unless
Config
.
instance
.
podfile_path
&&
Config
.
instance
.
podfile_path
.
exist?
<<-
EOS
...
...
@@ -79,6 +80,16 @@ EOS
end
end
def
remove_color
(
string
)
string
.
gsub
(
/\e\[(\d+)m/
,
''
)
end
def
issues_url
(
exception
)
message
=
remove_color
(
pathless_exception_message
(
exception
.
message
))
'https://github.com/CocoaPods/CocoaPods/search?q='
\
"
#{
CGI
.
escape
(
message
)
}
&type=Issues"
end
def
host_information
product
,
version
,
build
=
`sw_vers`
.
strip
.
split
(
"
\n
"
).
map
{
|
line
|
line
.
split
(
":"
).
last
.
strip
}
"
#{
product
}
#{
version
}
(
#{
build
}
)"
...
...
spec/unit/user_interface/error_report_spec.rb
View file @
064958d4
...
...
@@ -9,7 +9,7 @@ module Pod
describe
'In general'
do
before
do
@exception
=
Informative
.
exception
(
'at - (~/code.rb):'
)
@exception
.
stubs
(
:backtrace
).
returns
(
%w{Line 1 Line 2}
)
@exception
.
stubs
(
:backtrace
).
returns
(
[
'Line 1'
,
'Line 2'
]
)
@report
=
UserInterface
::
ErrorReport
end
...
...
@@ -59,7 +59,7 @@ Line 2
[!] Oh no, an error occurred.
Search for existing github issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=%
1B%5B31m%5B%21%5D+at+-%1B%5B0m
&type=Issues
https://github.com/CocoaPods/CocoaPods/search?q=%
5B%21%5D+at+-
&type=Issues
If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new
...
...
@@ -79,11 +79,12 @@ EOS
@report
.
stubs
(
:xcode_information
).
returns
(
':xcode_information'
)
@report
.
stubs
(
:repo_information
).
returns
([
'repo_1'
,
'repo_2'
])
report
=
remove_color
(
@report
.
report
(
@exception
))
puts
report
report
.
should
==
expected
end
it
'strips the local path from the exception message'
do
message
=
@report
.
pathless_exception_message
(
@exception
.
message
)
message
=
@report
.
send
(
:pathless_exception_message
,
@exception
.
message
)
message
=
remove_color
(
message
)
message
.
should
==
'[!] at -'
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