cocoapods-packager 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -9
- data/Gemfile.lock +1 -1
- data/LICENSE +2 -2
- data/README.md +3 -8
- data/lib/builder.rb +134 -0
- data/lib/cocoapods_packager.rb +1 -1
- data/lib/cocoapods_plugin.rb +3 -0
- data/lib/framework.rb +59 -0
- data/lib/pod/command/package.rb +57 -116
- data/lib/pod_utils.rb +48 -0
- data/lib/spec_builder.rb +27 -20
- data/spec/command/package_spec.rb +6 -6
- metadata +5 -3
- data/TODO.md +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8df03ad86ad928333cc4578359f12d6c612fd87
|
4
|
+
data.tar.gz: 5f4c6f64a84f37bd46b0d040c39a5a296a451e40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ed207f02e0bbb29cb420425f8ac495f1a0c2f90eab3ddccbc7c5a3b35bc87c7d6caeef4d00215265c66da4503f691fc307bf65c4111fd901601f0baf74d29c6
|
7
|
+
data.tar.gz: 9169c857cca5088618398fb56f0a7004eb685ac2792ecc0b84b887948d8906e7dc864f6e4e98b38ed147a34daf1f45ec0168334e4908794d6312021c4b78a608
|
data/.travis.yml
CHANGED
@@ -1,11 +1,4 @@
|
|
1
1
|
language: objective-c
|
2
|
-
|
3
|
-
|
4
|
-
- RVM_RUBY_VERSION=system NOEXEC_DISABLE=1 RUBY_VERSION_SPECIFIC='sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2' SSL_CERT_FILE=/usr/local/share/cacert.pem GIT_AUTHOR_NAME=CocoaPods GIT_AUTHOR_EMAIL=cocoapods@example.com PYTHONPATH=/usr/local/lib/python2.7/site-packages
|
5
|
-
- RVM_RUBY_VERSION=2.0.0-p247 NOEXEC_DISABLE=1 RUBY_VERSION_SPECIFIC='sudo gem install bundler --no-ri --no-rdoc' GIT_AUTHOR_NAME=CocoaPods GIT_AUTHOR_EMAIL=cocoapods@example.com PYTHONPATH=/usr/local/lib/python2.7/site-packages
|
6
|
-
before_install:
|
7
|
-
- curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem
|
8
|
-
- source ~/.rvm/scripts/rvm && rvm use $RVM_RUBY_VERSION
|
9
|
-
- sudo gem install bundler
|
10
|
-
install: eval $RUBY_VERSION_SPECIFIC && rake bootstrap[use_bundle_dir]
|
2
|
+
cache: bundler
|
3
|
+
before_install: bundle install
|
11
4
|
script: bundle exec rake specs
|
data/Gemfile.lock
CHANGED
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
This project is licensed under the MIT license.
|
2
2
|
|
3
|
-
|
3
|
+
Copyright (c) 2014 Kyle Fuller, Boris Bügling and CocoaPods Dev Team
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
6
6
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -2,16 +2,11 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/CocoaPods/cocoapods-packager.png?branch=master)](https://travis-ci.org/CocoaPods/cocoapods-packager)
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
eye on the status. :warning::warning:
|
8
|
-
|
9
|
-
CocoaPods plugin which allows you to generate a static library from a podspec.
|
10
|
-
This is useful for distributing your podspec as a static library.
|
5
|
+
CocoaPods plugin which allows you to generate a framework or static library from a podspec.
|
6
|
+
This is useful for distributing closed source libraries or for providing alternative integrations for people who do not use Pods.
|
11
7
|
|
12
8
|
## Usage
|
13
9
|
|
14
10
|
```bash
|
15
|
-
$ pod package KFData
|
11
|
+
$ pod package KFData.podspec
|
16
12
|
```
|
17
|
-
|
data/lib/builder.rb
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
module Pod
|
2
|
+
class Builder
|
3
|
+
def initialize(source_dir, sandbox_root, public_headers_root, spec, embedded, mangle)
|
4
|
+
@source_dir = source_dir
|
5
|
+
@sandbox_root = sandbox_root
|
6
|
+
@public_headers_root = public_headers_root
|
7
|
+
@spec = spec
|
8
|
+
@embedded = embedded
|
9
|
+
@mangle = mangle
|
10
|
+
end
|
11
|
+
|
12
|
+
def build(platform, library)
|
13
|
+
if library
|
14
|
+
build_static_library(platform)
|
15
|
+
else
|
16
|
+
build_framework(platform)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def build_static_library(platform)
|
21
|
+
UI.puts('Building static library')
|
22
|
+
|
23
|
+
defines = compile
|
24
|
+
platform_path = Pathname.new(platform.name.to_s)
|
25
|
+
platform_path.mkdir unless platform_path.exist?
|
26
|
+
build_library(platform, defines, platform_path + Pathname.new("lib#{@spec.name}.a"))
|
27
|
+
end
|
28
|
+
|
29
|
+
def build_framework(platform)
|
30
|
+
UI.puts('Building framework')
|
31
|
+
|
32
|
+
defines = compile
|
33
|
+
create_framework(platform.name.to_s)
|
34
|
+
copy_headers
|
35
|
+
build_library(platform, defines, @fwk.versions_path + Pathname.new(@spec.name))
|
36
|
+
copy_license
|
37
|
+
copy_resources(platform)
|
38
|
+
end
|
39
|
+
|
40
|
+
def link_embedded_resources
|
41
|
+
target_path = @fwk.root_path + Pathname.new('Resources')
|
42
|
+
target_path.mkdir unless target_path.exist?
|
43
|
+
|
44
|
+
Dir.glob(@fwk.resources_path.to_s + '/*').each do |resource|
|
45
|
+
resource = Pathname.new(resource).relative_path_from(target_path)
|
46
|
+
`ln -sf #{resource} #{target_path}`
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
:private
|
51
|
+
|
52
|
+
def build_library(platform, defines, output)
|
53
|
+
static_libs = static_libs_in_sandbox
|
54
|
+
|
55
|
+
if platform.name == :ios
|
56
|
+
build_static_lib_for_ios(static_libs, defines, output)
|
57
|
+
else
|
58
|
+
build_static_lib_for_mac(static_libs, output)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def build_static_lib_for_ios(static_libs, defines, output)
|
63
|
+
`libtool -static -o #{@sandbox_root}/build/package.a #{static_libs.join(' ')}`
|
64
|
+
|
65
|
+
xcodebuild(defines, '-sdk iphonesimulator', 'build-sim')
|
66
|
+
sim_libs = static_libs.map { |path| "#{@sandbox_root}/build-sim/#{File.basename(path)}" }
|
67
|
+
`libtool -static -o #{@sandbox_root}/build-sim/package.a #{sim_libs.join(' ')}`
|
68
|
+
|
69
|
+
`lipo #{@sandbox_root}/build/package.a #{@sandbox_root}/build-sim/libPods.a -create -output #{output}`
|
70
|
+
end
|
71
|
+
|
72
|
+
def build_static_lib_for_mac(static_libs, output)
|
73
|
+
`libtool -static -o #{output} #{static_libs.join(' ')}`
|
74
|
+
end
|
75
|
+
|
76
|
+
def build_with_mangling
|
77
|
+
UI.puts 'Mangling symbols'
|
78
|
+
defines = Symbols.mangle_for_pod_dependencies(@spec.name, @sandbox_root)
|
79
|
+
UI.puts 'Building mangled framework'
|
80
|
+
xcodebuild(defines)
|
81
|
+
return defines
|
82
|
+
end
|
83
|
+
|
84
|
+
def compile
|
85
|
+
xcodebuild
|
86
|
+
|
87
|
+
if @spec.dependencies.count > 0 && @mangle
|
88
|
+
return build_with_mangling
|
89
|
+
end
|
90
|
+
|
91
|
+
''
|
92
|
+
end
|
93
|
+
|
94
|
+
def copy_headers
|
95
|
+
headers_source_root = "#{@public_headers_root}/#{@spec.name}"
|
96
|
+
|
97
|
+
Dir.glob("#{headers_source_root}/**/*.h").
|
98
|
+
each { |h| `ditto #{h} #{@fwk.headers_path}/#{h.sub(headers_source_root, '')}` }
|
99
|
+
end
|
100
|
+
|
101
|
+
def copy_license
|
102
|
+
license_file = @spec.license[:file]
|
103
|
+
license_file = 'LICENSE' unless license_file
|
104
|
+
`cp "#{@sandbox_root}/#{@spec.name}/#{license_file}" .`
|
105
|
+
end
|
106
|
+
|
107
|
+
def copy_resources(platform)
|
108
|
+
`cp -rp #{@sandbox_root}/build/*.bundle #{@fwk.resources_path} 2>&1`
|
109
|
+
|
110
|
+
resources = expand_paths(@spec.consumer(platform).resources)
|
111
|
+
return if resources.count == 0
|
112
|
+
`cp -rp #{resources.join(' ')} #{@fwk.resources_path}`
|
113
|
+
end
|
114
|
+
|
115
|
+
def create_framework(platform)
|
116
|
+
@fwk = Framework::Tree.new(@spec.name, platform, @embedded)
|
117
|
+
@fwk.make
|
118
|
+
end
|
119
|
+
|
120
|
+
def expand_paths(path_specs)
|
121
|
+
path_specs.map do |path_spec|
|
122
|
+
Dir.glob(File.join(@source_dir, path_spec))
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def static_libs_in_sandbox
|
127
|
+
Dir.glob("#{@sandbox_root}/build/*.a").reject { |e| e =~ /libPods\.a$/ }
|
128
|
+
end
|
129
|
+
|
130
|
+
def xcodebuild(defines = '', args = '', build_dir = 'build')
|
131
|
+
`xcodebuild #{defines} CONFIGURATION_BUILD_DIR=#{build_dir} clean build #{args} -configuration Release -target Pods -project #{@sandbox_root}/Pods.xcodeproj 2>&1`
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
data/lib/cocoapods_packager.rb
CHANGED
data/lib/cocoapods_plugin.rb
CHANGED
data/lib/framework.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
module Framework
|
2
|
+
class Tree
|
3
|
+
attr_reader :headers_path
|
4
|
+
attr_reader :resources_path
|
5
|
+
attr_reader :root_path
|
6
|
+
attr_reader :versions_path
|
7
|
+
|
8
|
+
def initialize(name, platform, embedded)
|
9
|
+
@name = name
|
10
|
+
@platform = platform
|
11
|
+
@embedded = embedded
|
12
|
+
end
|
13
|
+
|
14
|
+
def make
|
15
|
+
make_root
|
16
|
+
make_framework
|
17
|
+
make_headers
|
18
|
+
make_resources
|
19
|
+
make_current_version
|
20
|
+
end
|
21
|
+
|
22
|
+
:private
|
23
|
+
|
24
|
+
def make_current_version
|
25
|
+
current_version_path = @versions_path + Pathname.new('../Current')
|
26
|
+
`ln -sf A #{current_version_path}`
|
27
|
+
`ln -sf Versions/Current/Headers #{@fwk_path}/`
|
28
|
+
`ln -sf Versions/Current/Resources #{@fwk_path}/`
|
29
|
+
`ln -sf Versions/Current/#{@name} #{@fwk_path}/`
|
30
|
+
end
|
31
|
+
|
32
|
+
def make_framework
|
33
|
+
@fwk_path = @root_path + Pathname.new(@name + '.framework')
|
34
|
+
@fwk_path.mkdir unless @fwk_path.exist?
|
35
|
+
|
36
|
+
@versions_path = @fwk_path + Pathname.new('Versions/A')
|
37
|
+
end
|
38
|
+
|
39
|
+
def make_headers
|
40
|
+
@headers_path = @versions_path + Pathname.new('Headers')
|
41
|
+
@headers_path.mkpath unless @headers_path.exist?
|
42
|
+
end
|
43
|
+
|
44
|
+
def make_resources
|
45
|
+
@resources_path = @versions_path + Pathname.new('Resources')
|
46
|
+
@resources_path.mkpath unless @resources_path.exist?
|
47
|
+
end
|
48
|
+
|
49
|
+
def make_root
|
50
|
+
@root_path = Pathname.new(@platform)
|
51
|
+
|
52
|
+
if @embedded
|
53
|
+
@root_path += Pathname.new(@name + '.embeddedframwork')
|
54
|
+
end
|
55
|
+
|
56
|
+
@root_path.mkpath unless @root_path.exist?
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/pod/command/package.rb
CHANGED
@@ -8,15 +8,22 @@ module Pod
|
|
8
8
|
|
9
9
|
def self.options
|
10
10
|
[
|
11
|
-
['--force',
|
11
|
+
['--force', 'Overwrite existing files.'],
|
12
|
+
['--no-mangle', 'Do not mangle symbols of depedendant Pods.'],
|
13
|
+
['--embedded', 'Generate embedded frameworks.'],
|
14
|
+
['--library', 'Generate static libraries.']
|
12
15
|
]
|
13
16
|
end
|
14
17
|
|
15
18
|
def initialize(argv)
|
19
|
+
@embedded = argv.flag?('embedded')
|
16
20
|
@force = argv.flag?('force')
|
21
|
+
@library = argv.flag?('library')
|
22
|
+
@mangle = argv.flag?('mangle', true)
|
17
23
|
@name = argv.shift_argument
|
18
24
|
@source = argv.shift_argument
|
19
25
|
|
26
|
+
@source_dir = Dir.pwd
|
20
27
|
@spec = spec_with_path(@name)
|
21
28
|
@spec = spec_with_name(@name) unless @spec
|
22
29
|
super
|
@@ -28,58 +35,18 @@ module Pod
|
|
28
35
|
end
|
29
36
|
|
30
37
|
def run
|
31
|
-
if @spec
|
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)
|
50
|
-
newspec = builder.spec_metadata
|
51
|
-
|
52
|
-
@spec.available_platforms.each do |platform|
|
53
|
-
build_in_sandbox(platform)
|
54
|
-
|
55
|
-
newspec += builder.spec_platform(platform)
|
56
|
-
end
|
57
|
-
|
58
|
-
newspec += builder.spec_close
|
59
|
-
File.open(@spec.name + '.podspec', 'w') { |file| file.write(newspec) }
|
60
|
-
|
61
|
-
`mv #{work_dir} #{target_dir}`
|
62
|
-
else
|
38
|
+
if @path.nil? || @spec.nil?
|
63
39
|
help! 'Unable to find a podspec with path or name.'
|
40
|
+
return
|
64
41
|
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def spec_with_name(name)
|
68
|
-
return unless !name.nil?
|
69
42
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
end
|
43
|
+
target_dir, work_dir = create_working_directory
|
44
|
+
return if target_dir.nil?
|
45
|
+
build_package
|
46
|
+
`mv #{work_dir} #{target_dir}`
|
75
47
|
end
|
76
48
|
|
77
|
-
|
78
|
-
if !path.nil? && Pathname.new(path).exist?
|
79
|
-
@path = path
|
80
|
-
Specification.from_file(path)
|
81
|
-
end
|
82
|
-
end
|
49
|
+
:private
|
83
50
|
|
84
51
|
def build_in_sandbox(platform)
|
85
52
|
config.sandbox_root = 'Pods'
|
@@ -88,90 +55,64 @@ module Pod
|
|
88
55
|
|
89
56
|
sandbox = install_pod(platform.name)
|
90
57
|
|
91
|
-
|
92
|
-
xcodebuild
|
93
|
-
UI.puts 'Mangling symbols'
|
94
|
-
defines = Symbols.mangle_for_pod_dependencies(@spec.name, config.sandbox_root)
|
95
|
-
UI.puts 'Building mangled framework'
|
96
|
-
xcodebuild(defines)
|
97
|
-
|
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$/ }
|
105
|
-
|
106
|
-
if platform.name == :ios
|
107
|
-
`libtool -static -o #{config.sandbox_root}/build/package.a #{static_libs.join(' ')}`
|
108
|
-
|
109
|
-
xcodebuild(defines, '-sdk iphonesimulator', 'build-sim')
|
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}`
|
114
|
-
else
|
115
|
-
`libtool -static -o #{versions_path}/#{@spec.name} #{static_libs.join(' ')}`
|
116
|
-
end
|
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}" .`
|
58
|
+
perform_build(platform, sandbox)
|
124
59
|
|
125
60
|
Pathname.new(config.sandbox_root).rmtree
|
126
61
|
Pathname.new('Podfile.lock').delete
|
127
62
|
end
|
128
63
|
|
129
|
-
def
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
def create_framework_tree(platform)
|
134
|
-
Pathname.new(platform).mkdir
|
135
|
-
root_path = Pathname.new(platform + '/' + @spec.name + '.framework')
|
136
|
-
root_path.mkdir unless root_path.exist?
|
64
|
+
def build_package
|
65
|
+
builder = SpecBuilder.new(@spec, @source)
|
66
|
+
newspec = builder.spec_metadata
|
137
67
|
|
138
|
-
|
68
|
+
@spec.available_platforms.each do |platform|
|
69
|
+
build_in_sandbox(platform)
|
139
70
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
resources_path = versions_path + Pathname.new('Resources')
|
144
|
-
resources_path.mkpath unless resources_path.exist?
|
145
|
-
|
146
|
-
current_version_path = versions_path + Pathname.new('../Current')
|
147
|
-
`ln -sf A #{current_version_path}`
|
148
|
-
`ln -sf Versions/Current/Headers #{root_path}/`
|
149
|
-
`ln -sf Versions/Current/#{@spec.name} #{root_path}/`
|
71
|
+
newspec += builder.spec_platform(platform)
|
72
|
+
end
|
150
73
|
|
151
|
-
|
74
|
+
newspec += builder.spec_close
|
75
|
+
File.open(@spec.name + '.podspec', 'w') { |file| file.write(newspec) }
|
152
76
|
end
|
153
77
|
|
154
|
-
def
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
if path
|
160
|
-
pod name, :podspec => path
|
78
|
+
def create_target_directory
|
79
|
+
target_dir = "#{@source_dir}/#{@spec.name}-#{@spec.version}"
|
80
|
+
if File.exist? target_dir
|
81
|
+
if @force
|
82
|
+
Pathname.new(target_dir).rmtree
|
161
83
|
else
|
162
|
-
|
84
|
+
UI.puts "Target directory '#{target_dir}' already exists."
|
85
|
+
return nil
|
163
86
|
end
|
164
87
|
end
|
165
|
-
|
88
|
+
target_dir
|
89
|
+
end
|
90
|
+
|
91
|
+
def create_working_directory
|
92
|
+
target_dir = create_target_directory
|
93
|
+
return if target_dir.nil?
|
94
|
+
|
95
|
+
work_dir = Dir.tmpdir + '/cocoapods-' + Array.new(8) { rand(36).to_s(36) }.join
|
96
|
+
Pathname.new(work_dir).mkdir
|
97
|
+
`cp #{@path} #{work_dir}`
|
98
|
+
Dir.chdir(work_dir)
|
99
|
+
|
100
|
+
[target_dir, work_dir]
|
166
101
|
end
|
167
102
|
|
168
|
-
def
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
103
|
+
def perform_build(platform, sandbox)
|
104
|
+
builder = Pod::Builder.new(
|
105
|
+
@source_dir,
|
106
|
+
config.sandbox_root,
|
107
|
+
sandbox.public_headers.root,
|
108
|
+
@spec,
|
109
|
+
@embedded,
|
110
|
+
@mangle)
|
111
|
+
|
112
|
+
builder.build(platform, @library)
|
173
113
|
|
174
|
-
|
114
|
+
return unless @embedded
|
115
|
+
builder.link_embedded_resources
|
175
116
|
end
|
176
117
|
end
|
177
118
|
end
|
data/lib/pod_utils.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class Package < Command
|
4
|
+
:private
|
5
|
+
|
6
|
+
def install_pod(platform_name)
|
7
|
+
podfile = podfile_from_spec(
|
8
|
+
File.basename(@path),
|
9
|
+
@spec.name,
|
10
|
+
platform_name,
|
11
|
+
@spec.deployment_target(platform_name))
|
12
|
+
|
13
|
+
sandbox = Sandbox.new(config.sandbox_root)
|
14
|
+
installer = Installer.new(sandbox, podfile)
|
15
|
+
installer.install!
|
16
|
+
|
17
|
+
sandbox
|
18
|
+
end
|
19
|
+
|
20
|
+
def podfile_from_spec(path, spec_name, platform_name, deployment_target)
|
21
|
+
Pod::Podfile.new do
|
22
|
+
platform(platform_name, deployment_target)
|
23
|
+
if path
|
24
|
+
pod spec_name, :podspec => path
|
25
|
+
else
|
26
|
+
pod spec_name, :path => '.'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def spec_with_name(name)
|
32
|
+
return if name.nil?
|
33
|
+
|
34
|
+
set = SourcesManager.search(Dependency.new(name))
|
35
|
+
return nil if set.nil?
|
36
|
+
|
37
|
+
set.specification.root
|
38
|
+
end
|
39
|
+
|
40
|
+
def spec_with_path(path)
|
41
|
+
return if path.nil? || !Pathname.new(path).exist?
|
42
|
+
|
43
|
+
@path = path
|
44
|
+
Specification.from_file(path)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/spec_builder.rb
CHANGED
@@ -11,39 +11,46 @@ module Pod
|
|
11
11
|
s.#{platform.name}.platform = :#{platform.symbolic_name}, '#{platform.deployment_target}'
|
12
12
|
s.#{platform.name}.preserve_paths = '#{fwk_base}'
|
13
13
|
s.#{platform.name}.public_header_files = '#{fwk_base}/Versions/A/Headers/*.h'
|
14
|
-
s.#{platform.name}.resource = '#{fwk_base}/Versions/A/Resources
|
14
|
+
s.#{platform.name}.resource = '#{fwk_base}/Versions/A/Resources/**/*'
|
15
15
|
s.#{platform.name}.vendored_frameworks = '#{fwk_base}'
|
16
|
-
|
17
16
|
SPEC
|
18
17
|
end
|
19
18
|
|
20
19
|
def spec_metadata
|
21
|
-
spec =
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
s.summary = "#{@spec.summary}"
|
26
|
-
s.license = #{@spec.license}
|
27
|
-
s.authors = #{@spec.authors}
|
28
|
-
s.homepage = "#{@spec.homepage}"
|
29
|
-
s.source = #{@source}
|
20
|
+
spec = spec_header
|
21
|
+
spec += spec_single_platform_fix
|
22
|
+
spec
|
23
|
+
end
|
30
24
|
|
31
|
-
|
25
|
+
def spec_close
|
26
|
+
"end\n"
|
27
|
+
end
|
32
28
|
|
33
|
-
|
34
|
-
platform = @spec.available_platforms.first
|
29
|
+
:private
|
35
30
|
|
36
|
-
|
37
|
-
|
31
|
+
def spec_header
|
32
|
+
spec = "Pod::Spec.new do |s|\n"
|
38
33
|
|
39
|
-
|
34
|
+
%w(name version summary license authors homepage description social_media_url
|
35
|
+
docset_url documentation_url screenshots).each do |attribute|
|
36
|
+
value = @spec.attributes_hash[attribute]
|
37
|
+
next if value.nil?
|
38
|
+
|
39
|
+
value = "'#{value}'" if value.class == String
|
40
|
+
spec += " s.#{attribute} = #{value}\n"
|
40
41
|
end
|
41
42
|
|
42
|
-
spec
|
43
|
+
spec + " s.source = '#{@source}'\n\n"
|
43
44
|
end
|
44
45
|
|
45
|
-
def
|
46
|
-
'
|
46
|
+
def spec_single_platform_fix
|
47
|
+
return '' if @spec.available_platforms.length > 1
|
48
|
+
|
49
|
+
platform = @spec.available_platforms.first
|
50
|
+
|
51
|
+
<<SPEC
|
52
|
+
s.platform = :#{platform.symbolic_name}, '#{platform.deployment_target}'
|
53
|
+
SPEC
|
47
54
|
end
|
48
55
|
end
|
49
56
|
end
|
@@ -7,7 +7,7 @@ module Pod
|
|
7
7
|
Command.parse(%w{ package }).should.be.instance_of Command::Package
|
8
8
|
end
|
9
9
|
|
10
|
-
it 'presents the help if no spec is
|
10
|
+
it 'presents the help if no spec is provided' do
|
11
11
|
command = Command.parse(%w{ package })
|
12
12
|
should.raise CLAide::Help do
|
13
13
|
command.validate!
|
@@ -32,12 +32,12 @@ module Pod
|
|
32
32
|
true.should == true # To make the test pass without any shoulds
|
33
33
|
end
|
34
34
|
|
35
|
-
it "runs with a spec in the master repository" do
|
36
|
-
|
37
|
-
|
35
|
+
#it "runs with a spec in the master repository" do
|
36
|
+
# command = Command.parse(%w{ package KFData })
|
37
|
+
# command.run
|
38
38
|
|
39
|
-
|
40
|
-
end
|
39
|
+
# true.should == true # To make the test pass without any shoulds
|
40
|
+
#end
|
41
41
|
end
|
42
42
|
end
|
43
43
|
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.3.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-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -53,12 +53,14 @@ files:
|
|
53
53
|
- LICENSE
|
54
54
|
- README.md
|
55
55
|
- Rakefile
|
56
|
-
- TODO.md
|
57
56
|
- cocoapods-packager.gemspec
|
57
|
+
- lib/builder.rb
|
58
58
|
- lib/cocoapods_packager.rb
|
59
59
|
- lib/cocoapods_plugin.rb
|
60
|
+
- lib/framework.rb
|
60
61
|
- lib/mangle.rb
|
61
62
|
- lib/pod/command/package.rb
|
63
|
+
- lib/pod_utils.rb
|
62
64
|
- lib/spec_builder.rb
|
63
65
|
- lib/symbols.rb
|
64
66
|
- scripts/lstconst.sh
|