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
0350fff6
Commit
0350fff6
authored
Aug 23, 2012
by
Eloy Durán
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve Podfile.lock version when the `:head` option is used.
parent
aad3fb48
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
14 deletions
+34
-14
lockfile.rb
lib/cocoapods/lockfile.rb
+7
-7
version.rb
lib/cocoapods/version.rb
+11
-7
version_spec.rb
spec/unit/version_spec.rb
+16
-0
No files found.
lib/cocoapods/lockfile.rb
View file @
0350fff6
...
@@ -99,17 +99,17 @@ module Pod
...
@@ -99,17 +99,17 @@ module Pod
# @example Strings examples
# @example Strings examples
# "libPusher"
# "libPusher"
# "libPusher (1.0)"
# "libPusher (1.0)"
# "libPusher (HEAD
from
1.0)"
# "libPusher (HEAD
based on
1.0)"
# "RestKit/JSON"
# "RestKit/JSON"
#
#
# @return [String, Version] The name and the version of a
# @return [String, Version] The name and the version of a
# pod.
# pod.
#
#
def
name_and_version_for_pod
(
string
)
def
name_and_version_for_pod
(
string
)
match_data
=
string
.
match
(
/(\S*) \((.*)\)/
)
match_data
=
string
.
match
(
/(\S*) \((.*)\)/
)
name
=
match_data
[
1
]
name
=
match_data
[
1
]
vers
=
Version
.
from_s
(
match_data
[
2
])
vers
=
Version
.
from_string
(
match_data
[
2
])
return
[
name
,
vers
]
[
name
,
vers
]
end
end
# @param [String] The string that describes a {Dependency} generated
# @param [String] The string that describes a {Dependency} generated
...
@@ -241,7 +241,7 @@ module Pod
...
@@ -241,7 +241,7 @@ module Pod
end
end
end
end
pod_and_deps
=
tmp
.
sort_by
(
&
:first
).
map
do
|
name
,
deps
|
pod_and_deps
=
tmp
.
sort_by
(
&
:first
).
map
do
|
name
,
deps
|
deps
.
empty?
?
name
:
{
name
=>
deps
}
deps
.
empty?
?
name
:
{
name
=>
deps
}
end
end
hash
[
"PODS"
]
=
pod_and_deps
hash
[
"PODS"
]
=
pod_and_deps
...
@@ -253,7 +253,7 @@ module Pod
...
@@ -253,7 +253,7 @@ module Pod
hash
[
"EXTERNAL SOURCES"
]
=
external_sources
unless
external_sources
.
empty?
hash
[
"EXTERNAL SOURCES"
]
=
external_sources
unless
external_sources
.
empty?
checksums
=
{}
checksums
=
{}
specs
.
select
{
|
spec
|
!
spec
.
defined_in_file
.
nil?
}.
each
do
|
spec
|
specs
.
select
{
|
spec
|
!
spec
.
defined_in_file
.
nil?
}.
each
do
|
spec
|
checksum
=
Digest
::
SHA1
.
hexdigest
(
File
.
read
(
spec
.
defined_in_file
))
checksum
=
Digest
::
SHA1
.
hexdigest
(
File
.
read
(
spec
.
defined_in_file
))
checksum
=
checksum
.
encode
(
'UTF-8'
)
if
checksum
.
respond_to?
(
:encode
)
checksum
=
checksum
.
encode
(
'UTF-8'
)
if
checksum
.
respond_to?
(
:encode
)
checksums
[
spec
.
name
]
=
checksum
checksums
[
spec
.
name
]
=
checksum
...
...
lib/cocoapods/version.rb
View file @
0350fff6
...
@@ -3,19 +3,23 @@ module Pod
...
@@ -3,19 +3,23 @@ module Pod
# @returns A Version described by its #to_s method.
# @returns A Version described by its #to_s method.
#
#
def
self
.
from_s
(
string
)
# @TODO The `from' part of the regexp should be remove before 1.0.0.
match
=
string
.
match
(
/HEAD from (.*)/
)
#
string
=
match
[
1
]
if
match
def
self
.
from_string
(
string
)
vers
=
Version
.
new
(
string
)
if
string
=~
/HEAD (based on|from) (.*)/
vers
.
head
=
true
if
match
v
=
Version
.
new
(
$2
)
vers
v
.
head
=
true
v
else
Version
.
new
(
string
)
end
end
end
attr_accessor
:head
attr_accessor
:head
alias_method
:head?
,
:head
alias_method
:head?
,
:head
def
to_s
def
to_s
head?
?
"HEAD
from
#{
super
}
"
:
super
head?
?
"HEAD
based on
#{
super
}
"
:
super
end
end
end
end
end
end
...
...
spec/unit/version_spec.rb
View file @
0350fff6
...
@@ -8,5 +8,21 @@ module Pod
...
@@ -8,5 +8,21 @@ module Pod
version
.
head
=
true
version
.
head
=
true
version
.
should
.
be
.
head
version
.
should
.
be
.
head
end
end
it
"serializes to and from a string"
do
version
=
Version
.
from_string
(
'1.2.3'
)
version
.
to_s
.
should
==
'1.2.3'
version
.
should
.
not
.
be
.
head
version
=
Version
.
from_string
(
'HEAD based on 1.2.3'
)
version
.
should
.
be
.
head
version
.
to_s
.
should
==
'HEAD based on 1.2.3'
end
it
"supports the previous way that a HEAD version was described"
do
version
=
Version
.
from_string
(
'HEAD from 1.2.3'
)
version
.
should
.
be
.
head
version
.
to_s
.
should
==
'HEAD based on 1.2.3'
end
end
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