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
c832f39b
Commit
c832f39b
authored
Jul 04, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Specification] Better support for heredocs.
parent
63c5e456
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
7 deletions
+40
-7
spec.rb
lib/cocoapods/command/spec.rb
+21
-4
specification.rb
lib/cocoapods/specification.rb
+19
-3
No files found.
lib/cocoapods/command/spec.rb
View file @
c832f39b
...
@@ -501,15 +501,32 @@ Pod::Spec.new do |s|
...
@@ -501,15 +501,32 @@ Pod::Spec.new do |s|
s.name = "
#{
data
[
:name
]
}
"
s.name = "
#{
data
[
:name
]
}
"
s.version = "
#{
data
[
:version
]
}
"
s.version = "
#{
data
[
:version
]
}
"
s.summary = "
#{
data
[
:summary
]
}
"
s.summary = "
#{
data
[
:summary
]
}
"
# s.description = 'An optional longer description of
#{
data
[
:name
]
}
.'
# s.description = <<-DESC
# An optional longer description of
#{
data
[
:name
]
}
#
# * Markdonw format.
# * Don't worry about the indent, we strip it!
# DESC
s.homepage = "
#{
data
[
:homepage
]
}
"
s.homepage = "
#{
data
[
:homepage
]
}
"
# Specify the license type. CocoaPods detects automatically the license file if it is named
# Specify the license type. CocoaPods detects automatically the license file if it is named
# `LICENSE*', however if the name is different, specify it.
# `LICENSE*.*', however if the name is different, specify it.
s.license = 'MIT (example)'
# s.license = { :type => 'MIT (example)', :file => 'FILE_LICENSE' }
#
# Only if no dedicated file is available include the full text of the license.
# Only if no dedicated file is available include the full text of the license.
#
#
s.license = 'MIT (example)'
# s.license = {
# s.license = { :type => 'MIT', :file => 'LICENSE', :text => 'Permission is hereby granted ...' }
# :type => 'MIT (example)',
# :text => <<-LICENSE
# Copyright (C) <year> <copyright holders>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# ...
# LICENSE
# }
# Specify the authors of the library, with email addresses. You can often find
# Specify the authors of the library, with email addresses. You can often find
# the email addresses of the authors by using the SCM log. E.g. $ git log
# the email addresses of the authors by using the SCM log. E.g. $ git log
...
...
lib/cocoapods/specification.rb
View file @
c832f39b
...
@@ -189,15 +189,31 @@ module Pod
...
@@ -189,15 +189,31 @@ module Pod
top_attr_accessor
:summary
top_attr_accessor
:summary
top_attr_accessor
:documentation
top_attr_accessor
:documentation
top_attr_accessor
:requires_arc
top_attr_accessor
:requires_arc
top_attr_accessor
:license
,
lambda
{
|
l
|
(
l
.
kind_of?
String
)
?
{
:
type
=>
l
}
:
l
}
top_attr_accessor
:version
,
lambda
{
|
v
|
Version
.
new
(
v
)
}
top_attr_accessor
:version
,
lambda
{
|
v
|
Version
.
new
(
v
)
}
top_attr_accessor
:license
,
lambda
{
|
l
|
parse_license
(
l
)
}
top_attr_accessor
:authors
,
lambda
{
|
a
|
parse_authors
(
a
)
}
top_attr_accessor
:authors
,
lambda
{
|
a
|
parse_authors
(
a
)
}
top_attr_reader
:description
,
lambda
{
|
instance
,
ivar
|
ivar
||
instance
.
summary
}
top_attr_reader
:description
,
lambda
{
|
instance
,
ivar
|
ivar
||
instance
.
summary
}
top_attr_writer
:description
top_attr_writer
:description
,
lambda
{
|
d
|
strip_heredoc
(
d
)
}
alias_method
:author
=
,
:authors
=
alias_method
:author
=
,
:authors
=
# Strips indentation in heredocs.
#
# @note Adapted from Ruby on Rails.
#
def
self
.
strip_heredoc
(
string
)
min_indent
=
string
.
scan
(
/^[ \t]*(?=\S)/
).
min
indent
=
min_indent
?
min_indent
.
size
:
0
string
.
gsub
(
/^[ \t]{
#{
indent
}
}/
,
''
)
end
def
self
.
parse_license
(
license
)
license
=
(
license
.
kind_of?
String
)
?
{
:
type
=>
license
}
:
license
license
[
:text
]
=
strip_heredoc
(
license
[
:text
])
if
license
[
:text
]
license
end
def
self
.
parse_authors
(
*
names_and_email_addresses
)
def
self
.
parse_authors
(
*
names_and_email_addresses
)
list
=
names_and_email_addresses
.
flatten
list
=
names_and_email_addresses
.
flatten
unless
list
.
first
.
is_a?
(
Hash
)
unless
list
.
first
.
is_a?
(
Hash
)
...
...
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