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
873fd971
Commit
873fd971
authored
Apr 16, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[spec create] Suggest sha instead of head if not tag is found
parent
2a21c651
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
12 deletions
+20
-12
spec.rb
lib/cocoapods/command/spec.rb
+20
-12
No files found.
lib/cocoapods/command/spec.rb
View file @
873fd971
...
@@ -69,34 +69,41 @@ module Pod
...
@@ -69,34 +69,41 @@ module Pod
puts
puts
end
end
def
suggest_tag_and_version
(
tags
)
def
suggested_ref_and_version
(
repo
)
tags
=
Octokit
.
tags
(
:username
=>
repo
[
'owner'
][
'login'
],
:repo
=>
repo
[
'name'
]).
map
{
|
tag
|
tag
.
name
}
versions_tags
=
{}
versions_tags
=
{}
tags
.
each
do
|
tag
|
tags
.
each
do
|
tag
|
clean_tag
=
tag
.
gsub
(
/^v(er)? ?/
,
''
)
clean_tag
=
tag
.
gsub
(
/^v(er)? ?/
,
''
)
versions_tags
[
Gem
::
Version
.
new
(
clean_tag
)]
=
tag
if
Gem
::
Version
.
correct?
(
clean_tag
)
versions_tags
[
Gem
::
Version
.
new
(
clean_tag
)]
=
tag
if
Gem
::
Version
.
correct?
(
clean_tag
)
end
end
version
=
versions_tags
.
keys
.
sort
.
last
||
'0.0.1'
version
=
versions_tags
.
keys
.
sort
.
last
||
'0.0.1'
tag
=
version
==
'0.0.1'
?
'HEAD'
:
versions_tags
[
version
]
data
=
{
:version
=>
version
}
[
tag
,
version
.
to_s
]
if
version
==
'0.0.1'
branches
=
Octokit
.
branches
(
:username
=>
repo
[
'owner'
][
'login'
],
:repo
=>
repo
[
'name'
])
master_name
=
repo
[
'master_branch'
]
||
'master'
master
=
branches
.
select
{
|
branch
|
branch
[
'name'
]
==
master_name
}.
first
data
[
:ref_type
]
=
':commit'
data
[
:ref
]
=
master
[
'commit'
][
'sha'
]
else
data
[
:ref_type
]
=
':tag'
data
[
:ref
]
=
versions_tags
[
version
]
end
data
end
end
def
github_data_for_template
(
repo_id
)
def
github_data_for_template
(
repo_id
)
repo
=
Octokit
.
repo
(
repo_id
)
repo
=
Octokit
.
repo
(
repo_id
)
user
=
Octokit
.
user
(
repo
[
'owner'
][
'login'
])
user
=
Octokit
.
user
(
repo
[
'owner'
][
'login'
])
tags
=
Octokit
.
tags
(
repo_id
).
map
{
|
tag
|
tag
.
name
}
tag
,
version
=
suggest_tag_and_version
(
tags
)
data
=
{}
data
=
{}
data
[
:name
]
=
repo
[
'name'
]
data
[
:name
]
=
repo
[
'name'
]
data
[
:version
]
=
version
data
[
:summary
]
=
repo
[
'description'
].
gsub
(
/["]/
,
'\"'
)
data
[
:summary
]
=
repo
[
'description'
].
gsub
(
/["]/
,
'\"'
)
data
[
:homepage
]
=
repo
[
'homepage'
]
!=
""
?
repo
[
'homepage'
]
:
repo
[
'html_url'
]
data
[
:homepage
]
=
repo
[
'homepage'
]
!=
""
?
repo
[
'homepage'
]
:
repo
[
'html_url'
]
data
[
:author_name
]
=
user
[
'name'
]
||
user
[
'login'
]
data
[
:author_name
]
=
user
[
'name'
]
||
user
[
'login'
]
data
[
:author_email
]
=
user
[
'email'
]
||
'email@address.com'
data
[
:author_email
]
=
user
[
'email'
]
||
'email@address.com'
data
[
:source_url
]
=
repo
[
'clone_url'
]
data
[
:source_url
]
=
repo
[
'clone_url'
]
data
[
:tag
]
=
tag
data
data
.
merge
suggested_ref_and_version
(
repo
)
end
end
def
default_data_for_template
(
name
)
def
default_data_for_template
(
name
)
...
@@ -108,7 +115,8 @@ module Pod
...
@@ -108,7 +115,8 @@ module Pod
data
[
:author_name
]
=
`git config --get user.name`
.
strip
data
[
:author_name
]
=
`git config --get user.name`
.
strip
data
[
:author_email
]
=
`git config --get user.email`
.
strip
data
[
:author_email
]
=
`git config --get user.email`
.
strip
data
[
:source_url
]
=
"http://EXAMPLE/
#{
name
}
.git"
data
[
:source_url
]
=
"http://EXAMPLE/
#{
name
}
.git"
data
[
:tag
]
=
'0.0.1'
data
[
:ref_type
]
=
':tag'
data
[
:ref
]
=
'0.0.1'
data
data
end
end
...
@@ -141,7 +149,7 @@ Pod::Spec.new do |s|
...
@@ -141,7 +149,7 @@ Pod::Spec.new do |s|
# Specify the location from where the source should be retreived.
# Specify the location from where the source should be retreived.
#
#
s.source = { :git => "
#{
data
[
:source_url
]
}
",
:tag => "
#{
data
[
:tag
]
}
" }
s.source = { :git => "
#{
data
[
:source_url
]
}
",
#{
data
[
:ref_type
]
}
=> "
#{
data
[
:ref
]
}
" }
# s.source = { :svn => 'http://EXAMPLE/
#{
data
[
:name
]
}
/tags/1.0.0' }
# s.source = { :svn => 'http://EXAMPLE/
#{
data
[
:name
]
}
/tags/1.0.0' }
# s.source = { :hg => 'http://EXAMPLE/
#{
data
[
:name
]
}
', :revision => '1.0.0' }
# s.source = { :hg => 'http://EXAMPLE/
#{
data
[
:name
]
}
', :revision => '1.0.0' }
...
...
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