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
e297e2ee
Commit
e297e2ee
authored
Jul 17, 2012
by
Francis Chong
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #408 from CocoaPods/informative
Add Pod::Podfile::Informative error which show lines in Podfile
parents
0920c423
7e14b9c0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
podfile.rb
lib/cocoapods/podfile.rb
+15
-1
podfile_spec.rb
spec/unit/podfile_spec.rb
+8
-1
No files found.
lib/cocoapods/podfile.rb
View file @
e297e2ee
module
Pod
class
Podfile
class
Informative
<
::
Pod
::
Informative
def
podfile_line
@podfile_line
||=
self
.
backtrace
.
find
{
|
t
|
t
=~
/Podfile/
}
end
def
message
if
podfile_line
super
+
" (
#{
podfile_line
}
)
\n
"
.
red
else
super
end
end
end
class
UserProject
include
Config
::
Mixin
...
...
@@ -200,7 +214,7 @@ module Pod
when
:osx
target
=
'10.6'
else
raise
Informative
,
"Unsupported platform: platform must be one of [:ios, :osx]"
raise
::
Pod
::
Podfile
::
Informative
,
"Unsupported platform: platform must be one of [:ios, :osx]"
end
end
@target_definition
.
platform
=
Platform
.
new
(
name
,
target
)
...
...
spec/unit/podfile_spec.rb
View file @
e297e2ee
...
...
@@ -19,7 +19,14 @@ describe "Pod::Podfile" do
it
"raise error if unsupported platform is supplied"
do
lambda
{
Pod
::
Podfile
.
new
{
platform
:iOS
}
}.
should
.
raise
(
StandardError
,
"Unsupported platform"
)
}.
should
.
raise
Pod
::
Podfile
::
Informative
begin
Pod
::
Podfile
.
new
{
platform
:iOS
}
rescue
Pod
::
Podfile
::
Informative
=>
e
e
.
stubs
(
:podfile_line
).
returns
(
"./podfile_spec.rb:1"
)
e
.
message
.
should
.
be
=~
/podfile_spec\.rb:1/
end
end
it
"adds dependencies"
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