cocoapods-packager 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +23 -23
- data/TODO.md +0 -2
- data/lib/cocoapods_packager.rb +1 -1
- data/lib/mangle.rb +1 -1
- data/lib/pod/command/package.rb +62 -9
- data/lib/spec_builder.rb +17 -5
- data/lib/symbols.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 724330a00e775b6a876548b7163b4fd578ac247f
|
4
|
+
data.tar.gz: 0d6073a5069e1f2943f5bad83ea610dc575a73df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09cff1c8012595848b4e3fa270cf34e6e634774e8236cbf987339218e624edf4ec944bc977f2fdb11fdb2d1c55b389ddd93df3962e231b4caa6596722889e190
|
7
|
+
data.tar.gz: 273ba43f82ae0d9807c45455db9db0c37ca699ed93a45d56db2d9075b56d2ec6e856df95df35ea67007c3ae2604740e0bada22a10fd64e158776884622fe6d75
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
GIT
|
2
2
|
remote: https://github.com/irrationalfab/PrettyBacon.git
|
3
|
-
revision:
|
3
|
+
revision: 1eeb06f7d381acd65414b86b42fdf3538faae01c
|
4
4
|
branch: master
|
5
5
|
specs:
|
6
|
-
prettybacon (0.0.
|
6
|
+
prettybacon (0.0.2)
|
7
7
|
bacon (~> 1.2)
|
8
8
|
|
9
9
|
PATH
|
@@ -14,48 +14,48 @@ PATH
|
|
14
14
|
GEM
|
15
15
|
remote: https://rubygems.org/
|
16
16
|
specs:
|
17
|
-
activesupport (3.2.
|
17
|
+
activesupport (3.2.19)
|
18
18
|
i18n (~> 0.6, >= 0.6.4)
|
19
19
|
multi_json (~> 1.0)
|
20
20
|
bacon (1.2.0)
|
21
|
-
claide (0.
|
22
|
-
cocoapods (0.
|
21
|
+
claide (0.6.1)
|
22
|
+
cocoapods (0.33.1)
|
23
23
|
activesupport (>= 3.2.15, < 4)
|
24
|
-
claide (~> 0.
|
25
|
-
cocoapods-core (= 0.
|
26
|
-
cocoapods-downloader (~> 0.
|
27
|
-
cocoapods-
|
24
|
+
claide (~> 0.6.1)
|
25
|
+
cocoapods-core (= 0.33.1)
|
26
|
+
cocoapods-downloader (~> 0.6.1)
|
27
|
+
cocoapods-plugins (~> 0.2.0)
|
28
28
|
colored (~> 1.2)
|
29
29
|
escape (~> 0.0.4)
|
30
30
|
json_pure (~> 1.8)
|
31
|
-
nap (~> 0.
|
31
|
+
nap (~> 0.7)
|
32
32
|
open4 (~> 1.3)
|
33
|
-
xcodeproj (~> 0.
|
34
|
-
cocoapods-core (0.
|
35
|
-
activesupport (>= 3.2.15
|
33
|
+
xcodeproj (~> 0.17.0)
|
34
|
+
cocoapods-core (0.33.1)
|
35
|
+
activesupport (>= 3.2.15)
|
36
36
|
fuzzy_match (~> 2.0.4)
|
37
37
|
json_pure (~> 1.8)
|
38
38
|
nap (~> 0.5)
|
39
|
-
cocoapods-downloader (0.
|
40
|
-
cocoapods-
|
39
|
+
cocoapods-downloader (0.6.1)
|
40
|
+
cocoapods-plugins (0.2.0)
|
41
|
+
nap
|
41
42
|
colored (1.2)
|
42
43
|
escape (0.0.4)
|
43
44
|
fuzzy_match (2.0.4)
|
44
|
-
i18n (0.6.
|
45
|
+
i18n (0.6.11)
|
45
46
|
json_pure (1.8.1)
|
46
|
-
metaclass (0.0.
|
47
|
+
metaclass (0.0.4)
|
47
48
|
mocha (0.11.4)
|
48
49
|
metaclass (~> 0.0.1)
|
49
50
|
mocha-on-bacon (0.2.1)
|
50
51
|
mocha (>= 0.9.8)
|
51
|
-
multi_json (1.
|
52
|
-
nap (0.
|
53
|
-
open4 (1.3.
|
54
|
-
rake (10.
|
55
|
-
xcodeproj (0.
|
52
|
+
multi_json (1.10.1)
|
53
|
+
nap (0.8.0)
|
54
|
+
open4 (1.3.4)
|
55
|
+
rake (10.3.2)
|
56
|
+
xcodeproj (0.17.0)
|
56
57
|
activesupport (~> 3.0)
|
57
58
|
colored (~> 1.2)
|
58
|
-
rake
|
59
59
|
|
60
60
|
PLATFORMS
|
61
61
|
ruby
|
data/TODO.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
[ ] Handle license file in generated podspec
|
2
|
-
[ ] Handle frameworks in generated podspec
|
3
2
|
[ ] Handle resources
|
4
3
|
[ ] Write tests
|
5
4
|
[ ] Implement various commandline options
|
6
5
|
[ ] Make symbol aliasing configurable
|
7
|
-
[ ] Pods with only one platform lead to lint errors
|
8
6
|
|
data/lib/cocoapods_packager.rb
CHANGED
data/lib/mangle.rb
CHANGED
@@ -19,7 +19,7 @@ module Symbols
|
|
19
19
|
all_syms += syms.map! { |sym| sym + "=Pod#{pod_name}_" + sym }
|
20
20
|
end
|
21
21
|
|
22
|
-
"GCC_PREPROCESSOR_DEFINITIONS='${inherited} #{all_syms.join(' ')}'"
|
22
|
+
"GCC_PREPROCESSOR_DEFINITIONS='${inherited} #{all_syms.uniq.join(' ')}'"
|
23
23
|
end
|
24
24
|
|
25
25
|
module_function :mangle_for_pod_dependencies
|
data/lib/pod/command/package.rb
CHANGED
@@ -1,11 +1,22 @@
|
|
1
|
+
require 'tmpdir'
|
2
|
+
|
1
3
|
module Pod
|
2
4
|
class Command
|
3
5
|
class Package < Command
|
4
6
|
self.summary = 'Package a podspec into a static library.'
|
5
|
-
self.arguments = [['NAME', :required]]
|
7
|
+
self.arguments = [['NAME', :required], ['SOURCE']]
|
8
|
+
|
9
|
+
def self.options
|
10
|
+
[
|
11
|
+
['--force', 'Overwrite existing files.']
|
12
|
+
]
|
13
|
+
end
|
6
14
|
|
7
15
|
def initialize(argv)
|
16
|
+
@force = argv.flag?('force')
|
8
17
|
@name = argv.shift_argument
|
18
|
+
@source = argv.shift_argument
|
19
|
+
|
9
20
|
@spec = spec_with_path(@name)
|
10
21
|
@spec = spec_with_name(@name) unless @spec
|
11
22
|
super
|
@@ -18,7 +29,24 @@ module Pod
|
|
18
29
|
|
19
30
|
def run
|
20
31
|
if @spec
|
21
|
-
|
32
|
+
target_dir = "#{Dir.pwd}/#{@spec.name}-#{@spec.version}"
|
33
|
+
if File.exist? target_dir
|
34
|
+
if @force
|
35
|
+
Pathname.new(target_dir).rmtree
|
36
|
+
else
|
37
|
+
UI.puts "Target directory '#{target_dir}' already exists."
|
38
|
+
return
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
work_dir = Dir.tmpdir + '/cocoapods-' + Array.new(8) { rand(36).to_s(36) }.join
|
43
|
+
|
44
|
+
UI.puts 'Using build directory ' + work_dir
|
45
|
+
Pathname.new(work_dir).mkdir
|
46
|
+
`cp #{@path} #{work_dir}`
|
47
|
+
Dir.chdir(work_dir)
|
48
|
+
|
49
|
+
builder = SpecBuilder.new(@spec, @source)
|
22
50
|
newspec = builder.spec_metadata
|
23
51
|
|
24
52
|
@spec.available_platforms.each do |platform|
|
@@ -29,6 +57,8 @@ module Pod
|
|
29
57
|
|
30
58
|
newspec += builder.spec_close
|
31
59
|
File.open(@spec.name + '.podspec', 'w') { |file| file.write(newspec) }
|
60
|
+
|
61
|
+
`mv #{work_dir} #{target_dir}`
|
32
62
|
else
|
33
63
|
help! 'Unable to find a podspec with path or name.'
|
34
64
|
end
|
@@ -60,29 +90,49 @@ module Pod
|
|
60
90
|
|
61
91
|
UI.puts 'Building framework'
|
62
92
|
xcodebuild
|
93
|
+
UI.puts 'Mangling symbols'
|
63
94
|
defines = Symbols.mangle_for_pod_dependencies(@spec.name, config.sandbox_root)
|
95
|
+
UI.puts 'Building mangled framework'
|
64
96
|
xcodebuild(defines)
|
65
97
|
|
66
|
-
versions_path, headers_path = create_framework_tree(platform.name.to_s)
|
67
|
-
|
98
|
+
versions_path, headers_path, resources_path = create_framework_tree(platform.name.to_s)
|
99
|
+
headers_source_root = "#{sandbox.public_headers.root}/#{@spec.name}"
|
100
|
+
Dir.glob("#{headers_source_root}/**/*.h").
|
101
|
+
each { |h| `ditto #{h} #{headers_path}/#{h.sub(headers_source_root, '')}` }
|
102
|
+
`cp -rp #{config.sandbox_root}/build/*.bundle #{resources_path} 2>&1`
|
103
|
+
|
104
|
+
static_libs = Dir.glob("#{config.sandbox_root}/build/*.a").reject { |e| e =~ /libPods\.a$/ }
|
68
105
|
|
69
106
|
if platform.name == :ios
|
107
|
+
`libtool -static -o #{config.sandbox_root}/build/package.a #{static_libs.join(' ')}`
|
108
|
+
|
70
109
|
xcodebuild(defines, '-sdk iphonesimulator', 'build-sim')
|
71
|
-
|
110
|
+
sim_libs = static_libs.map { |path| "#{config.sandbox_root}/build-sim/#{File.basename(path)}" }
|
111
|
+
`libtool -static -o #{config.sandbox_root}/build-sim/package.a #{sim_libs.join(' ')}`
|
112
|
+
|
113
|
+
`lipo #{config.sandbox_root}/build/package.a #{config.sandbox_root}/build-sim/libPods.a -create -output #{versions_path}/#{@spec.name}`
|
72
114
|
else
|
73
|
-
`
|
115
|
+
`libtool -static -o #{versions_path}/#{@spec.name} #{static_libs.join(' ')}`
|
74
116
|
end
|
75
117
|
|
118
|
+
#bundle_path = resources_path + Pathname.new("#{spec.name}.bundle")
|
119
|
+
#bundle_path.mkpath unless bundle_path.exist?
|
120
|
+
|
121
|
+
license_file = @spec.license[:file]
|
122
|
+
license_file = 'LICENSE' unless license_file
|
123
|
+
`cp "#{config.sandbox_root}/#{@spec.name}/#{license_file}" .`
|
124
|
+
|
76
125
|
Pathname.new(config.sandbox_root).rmtree
|
77
126
|
Pathname.new('Podfile.lock').delete
|
78
127
|
end
|
79
128
|
|
80
129
|
def xcodebuild(defines = '', args = '', build_dir = 'build')
|
81
|
-
`xcodebuild #{defines} CONFIGURATION_BUILD_DIR=#{build_dir} clean build #{args} -project #{config.sandbox_root}/Pods.xcodeproj 2>&1`
|
130
|
+
`xcodebuild #{defines} CONFIGURATION_BUILD_DIR=#{build_dir} clean build #{args} -configuration Release -target Pods -project #{config.sandbox_root}/Pods.xcodeproj 2>&1`
|
82
131
|
end
|
83
132
|
|
84
133
|
def create_framework_tree(platform)
|
85
|
-
|
134
|
+
Pathname.new(platform).mkdir
|
135
|
+
root_path = Pathname.new(platform + '/' + @spec.name + '.framework')
|
86
136
|
root_path.mkdir unless root_path.exist?
|
87
137
|
|
88
138
|
versions_path = root_path + Pathname.new('Versions/A')
|
@@ -90,12 +140,15 @@ module Pod
|
|
90
140
|
headers_path = versions_path + Pathname.new('Headers')
|
91
141
|
headers_path.mkpath unless headers_path.exist?
|
92
142
|
|
143
|
+
resources_path = versions_path + Pathname.new('Resources')
|
144
|
+
resources_path.mkpath unless resources_path.exist?
|
145
|
+
|
93
146
|
current_version_path = versions_path + Pathname.new('../Current')
|
94
147
|
`ln -sf A #{current_version_path}`
|
95
148
|
`ln -sf Versions/Current/Headers #{root_path}/`
|
96
149
|
`ln -sf Versions/Current/#{@spec.name} #{root_path}/`
|
97
150
|
|
98
|
-
return versions_path, headers_path
|
151
|
+
return versions_path, headers_path, resources_path
|
99
152
|
end
|
100
153
|
|
101
154
|
def podfile_from_spec(platform_name, deployment_target)
|
data/lib/spec_builder.rb
CHANGED
@@ -1,23 +1,24 @@
|
|
1
1
|
module Pod
|
2
2
|
class SpecBuilder
|
3
|
-
def initialize(spec)
|
3
|
+
def initialize(spec, source)
|
4
4
|
@spec = spec
|
5
|
+
@source = source.nil? ? '{}' : source
|
5
6
|
end
|
6
7
|
|
7
8
|
def spec_platform(platform)
|
8
|
-
fwk_base =
|
9
|
+
fwk_base = platform.name.to_s + '/' + @spec.name + '.framework'
|
9
10
|
<<SPEC
|
10
11
|
s.#{platform.name}.platform = :#{platform.symbolic_name}, '#{platform.deployment_target}'
|
11
12
|
s.#{platform.name}.preserve_paths = '#{fwk_base}'
|
12
13
|
s.#{platform.name}.public_header_files = '#{fwk_base}/Versions/A/Headers/*.h'
|
13
|
-
|
14
|
+
s.#{platform.name}.resource = '#{fwk_base}/Versions/A/Resources/*.bundle'
|
14
15
|
s.#{platform.name}.vendored_frameworks = '#{fwk_base}'
|
15
16
|
|
16
17
|
SPEC
|
17
18
|
end
|
18
19
|
|
19
20
|
def spec_metadata
|
20
|
-
<<SPEC
|
21
|
+
spec = <<SPEC
|
21
22
|
Pod::Spec.new do |s|
|
22
23
|
s.name = "#{@spec.name}"
|
23
24
|
s.version = "#{@spec.version}"
|
@@ -25,9 +26,20 @@ Pod::Spec.new do |s|
|
|
25
26
|
s.license = #{@spec.license}
|
26
27
|
s.authors = #{@spec.authors}
|
27
28
|
s.homepage = "#{@spec.homepage}"
|
28
|
-
s.source = #{@
|
29
|
+
s.source = #{@source}
|
30
|
+
|
31
|
+
SPEC
|
32
|
+
|
33
|
+
if @spec.available_platforms.length == 1
|
34
|
+
platform = @spec.available_platforms.first
|
35
|
+
|
36
|
+
spec += <<SPEC
|
37
|
+
s.platform = :#{platform.symbolic_name}, '#{platform.deployment_target}'
|
29
38
|
|
30
39
|
SPEC
|
40
|
+
end
|
41
|
+
|
42
|
+
spec
|
31
43
|
end
|
32
44
|
|
33
45
|
def spec_close
|
data/lib/symbols.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Symbols
|
2
2
|
def symbols_from_library(library)
|
3
|
-
syms = `nm #{library}`.split("\n")
|
3
|
+
syms = `nm -g #{library}`.split("\n")
|
4
4
|
|
5
5
|
result = classes_from_symbols(syms)
|
6
6
|
result + constants_from_symbols(syms)
|
@@ -21,11 +21,11 @@ module Symbols
|
|
21
21
|
consts = syms.select { |const| const[/ S /] }
|
22
22
|
consts = consts.select { |const| const !~ /OBJC|\.eh/ }
|
23
23
|
consts = consts.uniq
|
24
|
-
consts = consts.map! { |const| const.gsub(/^.*_/, '') }
|
24
|
+
consts = consts.map! { |const| const.gsub(/^.* _/, '') }
|
25
25
|
|
26
26
|
other_consts = syms.select { |const| const[/ T /] }
|
27
27
|
other_consts = other_consts.uniq
|
28
|
-
other_consts = other_consts.map! { |const| const.gsub(/^.*_/, '') }
|
28
|
+
other_consts = other_consts.map! { |const| const.gsub(/^.* _/, '') }
|
29
29
|
|
30
30
|
consts + other_consts
|
31
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-packager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Fuller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|