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
75b072d6
Commit
75b072d6
authored
Nov 16, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move generator code from installer to cocoapods/generator/*
parent
fc033185
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
58 deletions
+68
-58
cocoapods.rb
lib/cocoapods.rb
+5
-0
bridge_support_generator.rb
lib/cocoapods/bridge_support_generator.rb
+0
-23
bridge_support.rb
lib/cocoapods/generator/bridge_support.rb
+25
-0
copy_resources_script.rb
lib/cocoapods/generator/copy_resources_script.rb
+33
-0
installer.rb
lib/cocoapods/installer.rb
+2
-32
bridge_support_spec.rb
spec/unit/generator/bridge_support_spec.rb
+3
-3
No files found.
lib/cocoapods.rb
View file @
75b072d6
...
@@ -20,6 +20,11 @@ module Pod
...
@@ -20,6 +20,11 @@ module Pod
autoload
:Pathname
,
'pathname'
autoload
:Pathname
,
'pathname'
autoload
:FileList
,
'cocoapods/file_list'
autoload
:FileList
,
'cocoapods/file_list'
module
Generator
autoload
:BridgeSupport
,
'cocoapods/generator/bridge_support'
autoload
:CopyResourcesScript
,
'cocoapods/generator/copy_resources_script'
end
end
end
module
Xcodeproj
module
Xcodeproj
...
...
lib/cocoapods/bridge_support_generator.rb
deleted
100644 → 0
View file @
fc033185
module
Pod
class
BridgeSupportGenerator
include
Config
::
Mixin
extend
Executable
executable
:gen_bridge_metadata
attr_reader
:headers
def
initialize
(
headers
)
@headers
=
headers
end
def
search_paths
@headers
.
map
{
|
header
|
"-I '
#{
header
.
dirname
}
'"
}.
uniq
end
def
save_as
(
pathname
)
puts
"==> Generating BridgeSupport metadata file at `
#{
pathname
}
'"
unless
config
.
silent?
gen_bridge_metadata
%{-c "#{search_paths.join(' ')}" -o '#{pathname}' '#{headers.join("' '")}'}
end
end
end
lib/cocoapods/generator/bridge_support.rb
0 → 100644
View file @
75b072d6
module
Pod
module
Generator
class
BridgeSupport
include
Config
::
Mixin
extend
Executable
executable
:gen_bridge_metadata
attr_reader
:headers
def
initialize
(
headers
)
@headers
=
headers
end
def
search_paths
@headers
.
map
{
|
header
|
"-I '
#{
header
.
dirname
}
'"
}.
uniq
end
def
save_as
(
pathname
)
puts
"==> Generating BridgeSupport metadata file at `
#{
pathname
}
'"
unless
config
.
silent?
gen_bridge_metadata
%{-c "#{search_paths.join(' ')}" -o '#{pathname}' '#{headers.join("' '")}'}
end
end
end
end
lib/cocoapods/generator/copy_resources_script.rb
0 → 100644
View file @
75b072d6
module
Pod
module
Generator
class
CopyResourcesScript
CONTENT
=
<<
EOS
#!/bin/sh
install_resource()
{
echo "cp -R ${SRCROOT}/Pods/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
cp -R ${SRCROOT}/Pods/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
}
EOS
attr_reader
:resources
# A list of files relative to the project pods root.
def
initialize
(
resources
)
@resources
=
resources
end
def
save_as
(
pathname
)
pathname
.
open
(
'w'
)
do
|
script
|
script
.
puts
CONTENT
@resources
.
each
do
|
resource
|
script
.
puts
"install_resource '
#{
resource
}
'"
end
end
# TODO use File api
system
(
"chmod +x '
#{
pathname
}
'"
)
end
end
end
end
lib/cocoapods/installer.rb
View file @
75b072d6
...
@@ -14,36 +14,6 @@ module Pod
...
@@ -14,36 +14,6 @@ module Pod
end
end
end
end
class
CopyResourcesScript
CONTENT
=
<<
EOS
#!/bin/sh
install_resource()
{
echo "cp -R ${SRCROOT}/Pods/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
cp -R ${SRCROOT}/Pods/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
}
EOS
attr_reader
:resources
# A list of files relative to the project pods root.
def
initialize
(
resources
)
@resources
=
resources
end
def
save_as
(
pathname
)
pathname
.
open
(
'w'
)
do
|
script
|
script
.
puts
CONTENT
@resources
.
each
do
|
resource
|
script
.
puts
"install_resource '
#{
resource
}
'"
end
end
# TODO use File api
system
(
"chmod +x '
#{
pathname
}
'"
)
end
end
class
TargetInstaller
class
TargetInstaller
include
Config
::
Mixin
include
Config
::
Mixin
include
Shared
include
Shared
...
@@ -70,7 +40,7 @@ EOS
...
@@ -70,7 +40,7 @@ EOS
end
end
def
copy_resources_script
def
copy_resources_script
@copy_resources_script
||=
CopyResourcesScript
.
new
(
build_specifications
.
map
do
|
spec
|
@copy_resources_script
||=
Generator
::
CopyResourcesScript
.
new
(
build_specifications
.
map
do
|
spec
|
spec
.
expanded_resources
spec
.
expanded_resources
end
.
flatten
)
end
.
flatten
)
end
end
...
@@ -80,7 +50,7 @@ EOS
...
@@ -80,7 +50,7 @@ EOS
end
end
def
bridge_support_generator
def
bridge_support_generator
BridgeSupportGenerator
.
new
(
build_specifications
.
map
do
|
spec
|
Generator
::
BridgeSupport
.
new
(
build_specifications
.
map
do
|
spec
|
spec
.
header_files
.
map
do
|
header
|
spec
.
header_files
.
map
do
|
header
|
config
.
project_pods_root
+
header
config
.
project_pods_root
+
header
end
end
...
...
spec/unit/
bridge_support_generator
_spec.rb
→
spec/unit/
generator/bridge_support
_spec.rb
View file @
75b072d6
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
require
File
.
expand_path
(
'../../
../
spec_helper'
,
__FILE__
)
describe
"Pod::
BridgeSupportGenerator
"
do
describe
"Pod::
Generator::BridgeSupport
"
do
it
"generates a metadata file with the appropriate search paths"
do
it
"generates a metadata file with the appropriate search paths"
do
headers
=
%w{ /some/dir/foo.h /some/dir/bar.h /some/other/dir/baz.h }
.
map
{
|
h
|
Pathname
.
new
(
h
)
}
headers
=
%w{ /some/dir/foo.h /some/dir/bar.h /some/other/dir/baz.h }
.
map
{
|
h
|
Pathname
.
new
(
h
)
}
generator
=
Pod
::
BridgeSupportGenerator
.
new
(
headers
)
generator
=
Pod
::
Generator
::
BridgeSupport
.
new
(
headers
)
def
generator
.
gen_bridge_metadata
(
command
)
def
generator
.
gen_bridge_metadata
(
command
)
@command
=
command
@command
=
command
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