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
f4f115c8
Unverified
Commit
f4f115c8
authored
Jun 26, 2016
by
Orta Therox
Committed by
Samuel Giddins
Jul 09, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[GH Inspector] Add CHANGELOG and fix rubocop/inch issues
parent
b4d58574
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
29 deletions
+64
-29
CHANGELOG.md
CHANGELOG.md
+4
-0
Gemfile.lock
Gemfile.lock
+0
-5
error_report.rb
lib/cocoapods/user_interface/error_report.rb
+1
-1
inspector_reporter.rb
lib/cocoapods/user_interface/inspector_reporter.rb
+48
-9
error_report_spec.rb
spec/unit/user_interface/error_report_spec.rb
+3
-4
inspector_reporter_spec.rb
spec/unit/user_interface/inspector_reporter_spec.rb
+8
-10
No files found.
CHANGELOG.md
View file @
f4f115c8
...
...
@@ -40,6 +40,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Danielle Tomlinson
](
https://github.com/dantoml
)
[
#5517
](
https://github.com/CocoaPods/CocoaPods/issues/5517
)
*
Show GitHub Issues that could be related to exceptions.
[
Orta Therox
](
https://github.com/orta
)
[
#4817
](
https://github.com/CocoaPods/CocoaPods/issues/4817
)
*
Improve handling of app extensions, watch os 1 extensions
and framework targets
[
benasher44
](
https://github.com/benasher44
)
...
...
Gemfile.lock
View file @
f4f115c8
...
...
@@ -107,14 +107,9 @@ PATH
cocoapods-try (>= 1.0.0, < 2.0)
colored (~> 1.2)
escape (~> 0.0.4)
<<<<<<< HEAD
fourflusher (~> 1.0.1)
=======
fourflusher (~> 0.3.0)
gh_inspector (~> 1.0)
>>>>>>> e3c6df0... Update to use the latest GHInspector
molinillo (~> 0.5.0)
gh-issues-inspector (~> 0.5.0)
nap (~> 1.0)
xcodeproj (>= 1.1.0, < 2.0)
...
...
lib/cocoapods/user_interface/error_report.rb
View file @
f4f115c8
...
...
@@ -114,7 +114,7 @@ EOS
end
def
search_for_exceptions
(
exception
)
inspector
=
GhInspector
::
Inspector
.
new
"cocoapods"
,
"cocoapods"
inspector
=
GhInspector
::
Inspector
.
new
'cocoapods'
,
'cocoapods'
message_delegate
=
UserInterface
::
InspectorReporter
.
new
inspector
.
search_exception
exception
,
message_delegate
end
...
...
lib/cocoapods/user_interface/inspector_reporter.rb
View file @
f4f115c8
...
...
@@ -6,12 +6,31 @@ module Pod
#
class
InspectorReporter
# Called just as the investigation has begun.
def
inspector_started_query
(
query
,
inspector
)
# Lets the user know that it's looking for an issue.
#
# @param [query] String unused
#
# @param [GhInspector::Inspector] inspector
# The current inspector
#
# @return [void]
#
def
inspector_started_query
(
_
,
inspector
)
UI
.
puts
"Looking for related issues on
#{
inspector
.
repo_owner
}
/
#{
inspector
.
repo_name
}
..."
end
# Called once the inspector has recieved a report with more than one issue.
def
inspector_successfully_recieved_report
(
report
,
inspector
)
# Called once the inspector has recieved a report with more than one issue,
# showing the top 3 issues, and offering a link to see more.
#
# @param [GhInspector::InspectionReport] report
# Report a list of the issues
#
# @param [GhInspector::Inspector] inspector
# The current inspector
#
# @return [void]
#
def
inspector_successfully_recieved_report
(
report
,
_
)
report
.
issues
[
0
..
2
].
each
{
|
issue
|
print_issue_full
(
issue
)
}
if
report
.
issues
.
count
>
3
...
...
@@ -21,15 +40,36 @@ module Pod
end
# Called once the report has been recieved, but when there are no issues found.
def
inspector_recieved_empty_report
(
report
,
inspector
)
UI
.
puts
"Found no similar issues. To create a new issue, please visit:"
#
# @param [GhInspector::InspectionReport] report
# An empty report
#
# @param [GhInspector::Inspector] inspector
# The current inspector
#
# @return [void]
#
def
inspector_recieved_empty_report
(
_
,
inspector
)
UI
.
puts
'Found no similar issues. To create a new issue, please visit:'
UI
.
puts
"https://github.com/
#{
inspector
.
repo_owner
}
/
#{
inspector
.
repo_name
}
/issues/new"
end
# Called when there have been networking issues in creating the report.
#
# @param [Error] error
# The error returned during networking
#
# @param [String] query
# The original search query
#
# @param [GhInspector::Inspector] inspector
# The current inspector
#
# @return [void]
#
def
inspector_could_not_create_report
(
error
,
query
,
inspector
)
safe_query
=
URI
.
escape
query
UI
.
puts
"Could not access the GitHub API, you may have better luck via the website."
UI
.
puts
'Could not access the GitHub API, you may have better luck via the website.'
UI
.
puts
"https://github.com/
#{
inspector
.
repo_owner
}
/
#{
inspector
.
repo_name
}
/search?q=
#{
safe_query
}
&type=Issues&utf8=✓"
UI
.
puts
"Error:
#{
error
.
name
}
"
end
...
...
@@ -41,7 +81,7 @@ module Pod
UI
.
puts
" -
#{
issue
.
title
}
"
UI
.
puts
"
#{
safe_url
}
[
#{
issue
.
state
}
] [
#{
issue
.
comments
}
comment
#{
issue
.
comments
==
1
?
''
:
's'
}
]"
UI
.
puts
"
#{
pretty_date
(
issue
.
updated_at
)
}
"
UI
.
puts
""
UI
.
puts
''
end
# Taken from http://stackoverflow.com/questions/195740/how-do-you-do-relative-time-in-rails
...
...
@@ -61,10 +101,9 @@ module Pod
when
172_001
..
518_400
then
((
a
+
800
)
/
(
60
*
60
*
24
)).
to_i
.
to_s
+
' days ago'
when
518_400
..
1_036_800
then
'a week ago'
when
1_036_801
..
4_147_204
then
((
a
+
180_000
)
/
(
60
*
60
*
24
*
7
)).
to_i
.
to_s
+
' weeks ago'
else
date
.
strftime
(
"%d %b %Y"
)
else
date
.
strftime
(
'%d %b %Y'
)
end
end
end
end
end
spec/unit/user_interface/error_report_spec.rb
View file @
f4f115c8
...
...
@@ -111,15 +111,15 @@ EOS
message
.
should
==
'[!] at -'
end
it
"handles inspector_successfully_recieved_report"
do
it
'handles inspector_successfully_recieved_report'
do
time
=
Time
.
new
(
2016
,
5
,
13
)
Time
.
stubs
(
:now
).
returns
(
time
)
url
=
'https://api.github.com/search/issues?q=Testing+repo:cocoapods/cocoapods'
fixture_json_text
=
File
.
read
SpecHelper
.
fixture
(
"github_search_response.json"
)
fixture_json_text
=
File
.
read
SpecHelper
.
fixture
(
'github_search_response.json'
)
GhInspector
::
Sidekick
.
any_instance
.
expects
(
:get_api_results
).
with
(
url
).
returns
(
JSON
.
parse
(
fixture_json_text
))
error
=
NameError
.
new
(
"Testing"
,
"orta"
)
error
=
NameError
.
new
(
'Testing'
,
'orta'
)
@report
.
search_for_exceptions
error
result
=
<<-
EOS
Looking for related issues on cocoapods/cocoapods...
...
...
@@ -140,7 +140,6 @@ https://github.com/cocoapods/cocoapods/search?q=Testing&type=Issues&utf8=✓
EOS
UI
.
output
.
should
==
result
end
end
end
end
spec/unit/user_interface/inspector_reporter_spec.rb
View file @
f4f115c8
...
...
@@ -16,30 +16,28 @@ end
module
Pod
describe
UserInterface
::
InspectorReporter
do
it
"handles inspector_started_query"
do
inspector
=
GhInspector
::
Inspector
.
new
"cocoapods"
,
"cocoapods"
it
'handles inspector_started_query'
do
inspector
=
GhInspector
::
Inspector
.
new
'cocoapods'
,
'cocoapods'
reporter
=
UserInterface
::
InspectorReporter
.
new
reporter
.
inspector_started_query
(
"query"
,
inspector
)
reporter
.
inspector_started_query
(
'query'
,
inspector
)
UI
.
output
.
should
.
match
/Looking for related issues on cocoapods\/cocoapods/
UI
.
output
.
should
.
match
%r{Looking for related issues on cocoapods
\/
cocoapods}
end
it
"handles inspector_successfully_recieved_report"
do
it
'handles inspector_successfully_recieved_report'
do
url
=
'https://api.github.com/search/issues?q=Testing+repo:cocoapods/cocoapods'
fixture_json_text
=
File
.
read
SpecHelper
.
fixture
(
"github_search_response.json"
)
fixture_json_text
=
File
.
read
SpecHelper
.
fixture
(
'github_search_response.json'
)
GhInspector
::
Sidekick
.
any_instance
.
expects
(
:get_api_results
).
with
(
url
).
returns
(
JSON
.
parse
(
fixture_json_text
))
inspector
=
GhInspector
::
Inspector
.
new
"cocoapods"
,
"cocoapods"
inspector
=
GhInspector
::
Inspector
.
new
'cocoapods'
,
'cocoapods'
report
=
inspector
.
search_query
'Testing'
,
SilentEvidence
.
new
reporter
=
UserInterface
::
InspectorReporter
.
new
reporter
.
inspector_successfully_recieved_report
(
report
,
inspector
)
UI
.
output
.
should
.
match
/Travis CI with Ruby 1.9.x fails for recent pull requests/
UI
.
output
.
should
.
match
/https:\/\/github.com\/CocoaPods\/CocoaPods\/issues\/646 \[closed\] \[8 comments\]/
UI
.
output
.
should
.
match
%r{https:
\/\/
github.com
\/
CocoaPods
\/
CocoaPods
\/
issues
\/
646
\[
closed
\]
\[
8 comments
\]
}
UI
.
output
.
should
.
match
/pod search --full chokes on cocos2d.podspec/
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