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
60caa667
Commit
60caa667
authored
Sep 19, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug that would copy Pods.xcodeproj dir into existing one.
parent
78f52d3c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
9 deletions
+64
-9
Rakefile
Rakefile
+8
-0
cocoapods.rb
lib/cocoapods.rb
+1
-1
install.rb
lib/cocoapods/command/install.rb
+3
-3
project.rb
lib/cocoapods/xcode/project.rb
+5
-3
integration_spec.rb
spec/integration_spec.rb
+29
-2
command_spec.rb
spec/unit/command_spec.rb
+18
-0
No files found.
Rakefile
View file @
60caa667
...
...
@@ -10,3 +10,11 @@ task :clean do
sh
"rm -f lib/**/*.rbo"
sh
"rm -f *.gem"
end
desc
"Install a gem version of the current code"
task
:install
do
require
'lib/cocoapods'
sh
"gem build cocoapods.gemspec"
sh
"sudo macgem install cocoapods-
#{
Pod
::
VERSION
}
.gem"
sh
"sudo macgem compile cocoapods"
end
lib/cocoapods.rb
View file @
60caa667
module
Pod
VERSION
=
'0.0.
2
'
VERSION
=
'0.0.
3
'
class
Informative
<
StandardError
end
...
...
lib/cocoapods/command/install.rb
View file @
60caa667
...
...
@@ -32,13 +32,13 @@ module Pod
if
@podspec
.
exist?
spec
=
Specification
.
from_podspec
(
@podspec
)
else
raise
Help
,
"The specified podspec `
#{
@podspec
}
' doesn't exist."
raise
Informative
,
"The specified podspec `
#{
@podspec
}
' doesn't exist."
end
else
if
config
.
project_podfile
.
exist?
if
config
.
project_podfile
spec
=
Specification
.
from_podfile
(
config
.
project_podfile
)
else
raise
Help
,
"No Podfile found in
current working directory."
raise
Informative
,
"No `Podfile' or `.podspec' file found in the
current working directory."
end
end
Installer
.
new
(
spec
).
install!
...
...
lib/cocoapods/xcode/project.rb
View file @
60caa667
...
...
@@ -3,6 +3,8 @@ framework 'Foundation'
module
Pod
module
Xcode
class
Project
include
Pod
::
Config
::
Mixin
# TODO this is a workaround for an issue with MacRuby with compiled files
# that makes the use of __FILE__ impossible.
#
...
...
@@ -62,10 +64,10 @@ module Pod
end
def
create_in
(
pods_root
)
@template_dir
.
children
.
each
do
|
child
|
FileUtils
.
cp_r
(
child
,
pods_root
+
child
.
relative_path_from
(
@template_dir
))
end
puts
" * Copying contents of template directory `
#{
@template_dir
}
' to `
#{
pods_root
}
'"
if
config
.
verbose?
FileUtils
.
cp_r
(
"
#{
@template_dir
}
/."
,
pods_root
)
pbxproj
=
pods_root
+
template_file
puts
" * Writing Xcode project file to `
#{
pbxproj
}
'"
if
config
.
verbose?
@template
.
writeToFile
(
pbxproj
.
to_s
,
atomically
:true
)
end
...
...
spec/integration_spec.rb
View file @
60caa667
...
...
@@ -31,8 +31,14 @@ else
Pod
::
Source
.
reset!
Pod
::
Spec
::
Set
.
reset!
fixture
(
'spec-repos/master'
)
# ensure the archive is unpacked
config
.
project_pods_root
=
temporary_directory
+
'Pods'
config
.
repos_dir
=
fixture
(
'spec-repos'
)
config
.
project_pods_root
=
temporary_directory
+
'Pods'
FileUtils
.
cp_r
(
fixture
(
'integration/.'
),
config
.
project_pods_root
)
Dir
.
chdir
(
config
.
project_pods_root
.
to_s
)
do
FileUtils
.
mv
(
'ASIHTTPRequest'
,
'ASIHTTPRequest-1.8.1'
)
FileUtils
.
mv
(
'JSONKit'
,
'JSONKit-1.4'
)
FileUtils
.
mv
(
'SSZipArchive'
,
'SSZipArchive-1.0'
)
end
end
after
do
...
...
@@ -40,9 +46,10 @@ else
config
.
repos_dir
=
SpecHelper
.
tmp_repos_path
end
# TODO add a simple source file which uses the compiled lib to check that it really really works
it
"should activate required pods and create a working static library xcode project"
do
spec
=
Pod
::
Spec
.
new
do
dependency
'ASIWebPageRequest'
,
'
<
1.8.1'
dependency
'ASIWebPageRequest'
,
'
>=
1.8.1'
dependency
'JSONKit'
,
'>= 1.0'
dependency
'SSZipArchive'
,
'< 2'
end
...
...
@@ -79,5 +86,25 @@ else
(
config
.
project_pods_root
+
'Reachability.podspec'
).
should
.
exist
(
config
.
project_pods_root
+
'ASIHTTPRequest.podspec'
).
should
.
not
.
exist
end
# TODO we need to do more cleaning and/or add a --prune task
it
"overwrites an existing project.pbxproj file"
do
spec
=
Pod
::
Spec
.
new
do
dependency
'JSONKit'
end
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
.
install!
Pod
::
Source
.
reset!
Pod
::
Spec
::
Set
.
reset!
spec
=
Pod
::
Spec
.
new
do
dependency
'SSZipArchive'
end
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
.
install!
project
=
Pod
::
Xcode
::
Project
.
new
(
config
.
project_pods_root
)
project
.
source_files
.
sort
.
should
==
Pod
::
Installer
.
new
(
spec
).
source_files
.
sort
end
end
end
spec/unit/command_spec.rb
View file @
60caa667
...
...
@@ -24,3 +24,21 @@ describe "Pod::Command::Repo" do
lambda
{
Pod
::
Command
::
Repo
.
new
(
argv
(
'something'
))
}.
should
.
raise
Pod
::
Command
::
Help
end
end
describe
"Pod::Command::Install"
do
it
"tells the user that the specified podspec file doesn't exist"
do
command
=
Pod
::
Command
::
Install
.
new
(
argv
(
'/does/not/exist/Some.podspec'
))
exception
=
lambda
{
command
.
run
}.
should
.
raise
Pod
::
Informative
exception
.
message
.
should
.
include
"The specified podspec `/does/not/exist/Some.podspec' doesn't exist."
end
it
"tells the user that no Podfile or podspec was found in the current working dir"
do
command
=
Pod
::
Command
::
Install
.
new
(
argv
)
exception
=
lambda
{
command
.
run
}.
should
.
raise
Pod
::
Informative
exception
.
message
.
should
.
include
"No `Podfile' or `.podspec' file found in the current working directory."
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