cocoapods 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
data/lib/cocoapods.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Pod
|
2
|
-
VERSION = '0.3.
|
2
|
+
VERSION = '0.3.3'
|
3
3
|
|
4
4
|
class Informative < StandardError
|
5
5
|
end
|
@@ -20,6 +20,11 @@ module Pod
|
|
20
20
|
|
21
21
|
autoload :Pathname, 'pathname'
|
22
22
|
autoload :FileList, 'cocoapods/file_list'
|
23
|
+
|
24
|
+
module Generator
|
25
|
+
autoload :BridgeSupport, 'cocoapods/generator/bridge_support'
|
26
|
+
autoload :CopyResourcesScript, 'cocoapods/generator/copy_resources_script'
|
27
|
+
end
|
23
28
|
end
|
24
29
|
|
25
30
|
module Xcodeproj
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
class BridgeSupport
|
4
|
+
include Config::Mixin
|
5
|
+
|
6
|
+
extend Executable
|
7
|
+
executable :gen_bridge_metadata
|
8
|
+
|
9
|
+
attr_reader :headers
|
10
|
+
|
11
|
+
def initialize(headers)
|
12
|
+
@headers = headers
|
13
|
+
end
|
14
|
+
|
15
|
+
def search_paths
|
16
|
+
@headers.map { |header| "-I '#{header.dirname}'" }.uniq
|
17
|
+
end
|
18
|
+
|
19
|
+
def save_as(pathname)
|
20
|
+
puts "==> Generating BridgeSupport metadata file at `#{pathname}'" unless config.silent?
|
21
|
+
gen_bridge_metadata %{-c "#{search_paths.join(' ')}" -o '#{pathname}' '#{headers.join("' '")}'}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
class CopyResourcesScript
|
4
|
+
CONTENT = <<EOS
|
5
|
+
#!/bin/sh
|
6
|
+
|
7
|
+
install_resource()
|
8
|
+
{
|
9
|
+
echo "cp -R ${SRCROOT}/Pods/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
10
|
+
cp -R ${SRCROOT}/Pods/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
|
11
|
+
}
|
12
|
+
EOS
|
13
|
+
|
14
|
+
attr_reader :resources
|
15
|
+
|
16
|
+
# A list of files relative to the project pods root.
|
17
|
+
def initialize(resources)
|
18
|
+
@resources = resources
|
19
|
+
end
|
20
|
+
|
21
|
+
def save_as(pathname)
|
22
|
+
pathname.open('w') do |script|
|
23
|
+
script.puts CONTENT
|
24
|
+
@resources.each do |resource|
|
25
|
+
script.puts "install_resource '#{resource}'"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
# TODO use File api
|
29
|
+
system("chmod +x '#{pathname}'")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/cocoapods/installer.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
|
3
1
|
module Pod
|
4
2
|
class Installer
|
5
3
|
module Shared
|
@@ -16,36 +14,6 @@ module Pod
|
|
16
14
|
end
|
17
15
|
end
|
18
16
|
|
19
|
-
class CopyResourcesScript
|
20
|
-
CONTENT = <<EOS
|
21
|
-
#!/bin/sh
|
22
|
-
|
23
|
-
install_resource()
|
24
|
-
{
|
25
|
-
echo "cp -R ${SRCROOT}/Pods/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
26
|
-
cp -R ${SRCROOT}/Pods/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
|
27
|
-
}
|
28
|
-
EOS
|
29
|
-
|
30
|
-
attr_reader :resources
|
31
|
-
|
32
|
-
# A list of files relative to the project pods root.
|
33
|
-
def initialize(resources)
|
34
|
-
@resources = resources
|
35
|
-
end
|
36
|
-
|
37
|
-
def save_as(pathname)
|
38
|
-
pathname.open('w') do |script|
|
39
|
-
script.puts CONTENT
|
40
|
-
@resources.each do |resource|
|
41
|
-
script.puts "install_resource '#{resource}'"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
# TODO use File api
|
45
|
-
system("chmod +x '#{pathname}'")
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
17
|
class TargetInstaller
|
50
18
|
include Config::Mixin
|
51
19
|
include Shared
|
@@ -72,7 +40,7 @@ EOS
|
|
72
40
|
end
|
73
41
|
|
74
42
|
def copy_resources_script
|
75
|
-
@copy_resources_script ||= CopyResourcesScript.new(build_specifications.map do |spec|
|
43
|
+
@copy_resources_script ||= Generator::CopyResourcesScript.new(build_specifications.map do |spec|
|
76
44
|
spec.expanded_resources
|
77
45
|
end.flatten)
|
78
46
|
end
|
@@ -82,7 +50,7 @@ EOS
|
|
82
50
|
end
|
83
51
|
|
84
52
|
def bridge_support_generator
|
85
|
-
|
53
|
+
Generator::BridgeSupport.new(build_specifications.map do |spec|
|
86
54
|
spec.header_files.map do |header|
|
87
55
|
config.project_pods_root + header
|
88
56
|
end
|
@@ -93,7 +61,7 @@ EOS
|
|
93
61
|
"#{@definition.lib_name}.bridgesupport"
|
94
62
|
end
|
95
63
|
|
96
|
-
# TODO move out
|
64
|
+
# TODO move out to Generator::PrefixHeader
|
97
65
|
def save_prefix_header_as(pathname)
|
98
66
|
pathname.open('w') do |header|
|
99
67
|
header.puts "#ifdef __OBJC__"
|
@@ -131,6 +99,12 @@ EOS
|
|
131
99
|
end
|
132
100
|
xcconfig.merge!('USER_HEADER_SEARCH_PATHS' => user_header_search_paths.sort.uniq.join(" "))
|
133
101
|
|
102
|
+
# Now that we have added all the source files and copy header phases,
|
103
|
+
# move the compile build phase to the end, so that headers are copied
|
104
|
+
# to the build products dir first, and thus Pod source files can enjoy
|
105
|
+
# the same namespacing of headers as the app would.
|
106
|
+
@target.move_compile_phase_to_end!
|
107
|
+
|
134
108
|
# Add all the target related support files to the group, even the copy
|
135
109
|
# resources script although the project doesn't actually use them.
|
136
110
|
support_files_group = @project.groups.find do |group|
|
@@ -261,6 +235,7 @@ EOS
|
|
261
235
|
# 3. Let the user specify the app target name as an extra argument, but this
|
262
236
|
# seems to be a less good version of the variation on #2.
|
263
237
|
def configure_project(projpath)
|
238
|
+
# TODO use more of Pathname’s API here
|
264
239
|
root = File.dirname(projpath)
|
265
240
|
xcworkspace = File.join(root, File.basename(projpath, '.xcodeproj') + '.xcworkspace')
|
266
241
|
workspace = Xcodeproj::Workspace.new_from_xcworkspace(xcworkspace)
|
@@ -293,6 +268,10 @@ EOS
|
|
293
268
|
app_project.targets.each { |target| target.buildPhases << copy_resources }
|
294
269
|
|
295
270
|
app_project.save_as(projpath)
|
271
|
+
|
272
|
+
unless config.silent?
|
273
|
+
puts "[!] From now on use `#{File.basename(xcworkspace)}' instead of `#{File.basename(projpath)}'."
|
274
|
+
end
|
296
275
|
end
|
297
276
|
end
|
298
277
|
end
|
@@ -12,10 +12,23 @@ module Xcodeproj
|
|
12
12
|
pods.groups.new('name' => name)
|
13
13
|
end
|
14
14
|
|
15
|
+
class PBXNativeTarget
|
16
|
+
def move_compile_phase_to_end!
|
17
|
+
reflection = self.class.reflection(:buildPhases)
|
18
|
+
uuids = send(reflection.uuids_getter)
|
19
|
+
phase = buildPhases.find { |phase| phase.is_a?(PBXSourcesBuildPhase) }
|
20
|
+
uuids.delete(phase.uuid)
|
21
|
+
uuids << phase.uuid
|
22
|
+
phase = buildPhases.find { |phase| phase.is_a?(PBXFrameworksBuildPhase) }
|
23
|
+
uuids.delete(phase.uuid)
|
24
|
+
uuids << phase.uuid
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
15
28
|
class PBXCopyFilesBuildPhase
|
16
29
|
def self.new_pod_dir(project, pod_name, path)
|
17
30
|
new(project, nil, {
|
18
|
-
"dstPath" => "
|
31
|
+
"dstPath" => "Pods/#{path}",
|
19
32
|
"name" => "Copy #{pod_name} Public Headers",
|
20
33
|
})
|
21
34
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 3
|
9
|
+
version: 0.3.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Eloy Duran
|
@@ -45,7 +45,6 @@ extensions: []
|
|
45
45
|
extra_rdoc_files: []
|
46
46
|
|
47
47
|
files:
|
48
|
-
- lib/cocoapods/bridge_support_generator.rb
|
49
48
|
- lib/cocoapods/command/install.rb
|
50
49
|
- lib/cocoapods/command/repo.rb
|
51
50
|
- lib/cocoapods/command/search.rb
|
@@ -57,6 +56,8 @@ files:
|
|
57
56
|
- lib/cocoapods/downloader.rb
|
58
57
|
- lib/cocoapods/executable.rb
|
59
58
|
- lib/cocoapods/file_list.rb
|
59
|
+
- lib/cocoapods/generator/bridge_support.rb
|
60
|
+
- lib/cocoapods/generator/copy_resources_script.rb
|
60
61
|
- lib/cocoapods/installer.rb
|
61
62
|
- lib/cocoapods/podfile.rb
|
62
63
|
- lib/cocoapods/resolver.rb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module Pod
|
2
|
-
class BridgeSupportGenerator
|
3
|
-
include Config::Mixin
|
4
|
-
|
5
|
-
extend Executable
|
6
|
-
executable :gen_bridge_metadata
|
7
|
-
|
8
|
-
attr_reader :headers
|
9
|
-
|
10
|
-
def initialize(headers)
|
11
|
-
@headers = headers
|
12
|
-
end
|
13
|
-
|
14
|
-
def search_paths
|
15
|
-
@headers.map { |header| "-I '#{header.dirname}'" }.uniq
|
16
|
-
end
|
17
|
-
|
18
|
-
def save_as(pathname)
|
19
|
-
puts "==> Generating BridgeSupport metadata file at `#{pathname}'" unless config.silent?
|
20
|
-
gen_bridge_metadata %{-c "#{search_paths.join(' ')}" -o '#{pathname}' '#{headers.join("' '")}'}
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|