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
d4dcab45
Commit
d4dcab45
authored
Aug 02, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Specification::DSL] Add prepare_command
Closes #1274
parent
b329ce0b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
3 deletions
+50
-3
CHANGELOG.md
CHANGELOG.md
+7
-3
pod_source_installer.rb
lib/cocoapods/installer/pod_source_installer.rb
+21
-0
pod_source_installer_spec.rb
spec/unit/installer/pod_source_installer_spec.rb
+22
-0
No files found.
CHANGELOG.md
View file @
d4dcab45
...
@@ -6,18 +6,22 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
...
@@ -6,18 +6,22 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
###### Enhancements
###### Enhancements
*
Added
support for resource bundles
.
*
Added
`resource_bundles`
attribute to Specification DSL
.
[
#743
](
https://github.com/CocoaPods/CocoaPods/issues/743
)
,
[
#743
](
https://github.com/CocoaPods/CocoaPods/issues/743
)
,
[
#1186
](
https://github.com/CocoaPods/CocoaPods/issues/1186
)
[
#1186
](
https://github.com/CocoaPods/CocoaPods/issues/1186
)
*
Added
support for bundled frameworks
.
*
Added
`vendored_frameworks`
attribute to Specification DSL
.
[
#809
](
https://github.com/CocoaPods/CocoaPods/issues/809
)
,
[
#809
](
https://github.com/CocoaPods/CocoaPods/issues/809
)
,
[
#1075
](
https://github.com/CocoaPods/CocoaPods/issues/1075
)
[
#1075
](
https://github.com/CocoaPods/CocoaPods/issues/1075
)
*
Added
support for bundled libraries
.
*
Added
`vendored_libraries`
attribute to Specification DSL
.
[
#809
](
https://github.com/CocoaPods/CocoaPods/issues/809
)
,
[
#809
](
https://github.com/CocoaPods/CocoaPods/issues/809
)
,
[
#1075
](
https://github.com/CocoaPods/CocoaPods/issues/1075
)
[
#1075
](
https://github.com/CocoaPods/CocoaPods/issues/1075
)
*
Added
`prepare_command`
attribute to Specification DSL. The prepare command
will replace the pre_install hook. The post_install hook has been deprecated.
[
#1247
](
https://github.com/CocoaPods/CocoaPods/issues/1247
)
*
Restructured
`.cocoapods`
folder to contain repos in a subdirectory.
*
Restructured
`.cocoapods`
folder to contain repos in a subdirectory.
[
#1150
](
https://github.com/CocoaPods/CocoaPods/issues/1150
)
[
#1150
](
https://github.com/CocoaPods/CocoaPods/issues/1150
)
[
Ian Ynda-Hummel
](
https://github.com/ianyh
)
[
Ian Ynda-Hummel
](
https://github.com/ianyh
)
...
...
lib/cocoapods/installer/pod_source_installer.rb
View file @
d4dcab45
require
'active_support/core_ext/string/strip'
module
Pod
module
Pod
class
Installer
class
Installer
...
@@ -60,6 +62,7 @@ module Pod
...
@@ -60,6 +62,7 @@ module Pod
#
#
def
install!
def
install!
download_source
unless
predownloaded?
||
local?
download_source
unless
predownloaded?
||
local?
run_prepare_command
end
end
# Cleans the installations if appropriate.
# Cleans the installations if appropriate.
...
@@ -106,6 +109,24 @@ module Pod
...
@@ -106,6 +109,24 @@ module Pod
end
end
end
end
extend
Executable
executable
:bash
# Runs the prepare command bash script of the spec.
#
# @return [void]
#
def
run_prepare_command
return
unless
root_spec
.
prepare_command
UI
.
section
(
" > Running prepare command"
,
''
,
1
)
do
Dir
.
chdir
(
root
)
do
prepare_command
=
root_spec
.
prepare_command
.
strip_heredoc
.
chomp
full_command
=
"
\n
set -e
\n
"
+
prepare_command
bash!
(
full_command
)
end
end
end
# Removes all the files not needed for the installation according to the
# Removes all the files not needed for the installation according to the
# specs by platform.
# specs by platform.
#
#
...
...
spec/unit/installer/pod_source_installer_spec.rb
View file @
d4dcab45
...
@@ -65,6 +65,28 @@ module Pod
...
@@ -65,6 +65,28 @@ module Pod
#--------------------------------------#
#--------------------------------------#
describe
"Prepare command"
do
it
"runs the prepare command if one has been declared in the spec"
do
@spec
.
prepare_command
=
"echo test"
@installer
.
expects
(
:bash!
).
once
@installer
.
install!
end
it
"doesn't run the prepare command if it hasn't been declared in the spec"
do
@installer
.
expects
(
:bash!
).
never
@installer
.
install!
end
it
"raises if the prepare command fails"
do
@spec
.
prepare_command
=
"missing_command"
should
.
raise
Informative
do
@installer
.
install!
end
.
message
.
should
.
match
/command not found/
end
end
#--------------------------------------#
describe
"Cleaning"
do
describe
"Cleaning"
do
it
"cleans the paths non used by the installation"
do
it
"cleans the paths non used by the installation"
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