cocoapods-packager 0.4.0 → 0.5.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 +1 -1
- data/README.md +28 -1
- data/lib/{builder.rb → cocoapods-packager/builder.rb} +1 -1
- data/lib/{framework.rb → cocoapods-packager/framework.rb} +1 -1
- data/lib/{mangle.rb → cocoapods-packager/mangle.rb} +10 -3
- data/lib/{pod_utils.rb → cocoapods-packager/pod_utils.rb} +0 -0
- data/lib/{spec_builder.rb → cocoapods-packager/spec_builder.rb} +27 -4
- data/lib/{symbols.rb → cocoapods-packager/symbols.rb} +0 -0
- data/lib/cocoapods_packager.rb +1 -1
- data/lib/cocoapods_plugin.rb +6 -6
- data/lib/pod/command/package.rb +1 -1
- data/spec/command/package_spec.rb +1 -1
- data/spec/fixtures/Builder.podspec +21 -0
- data/spec/specification/builder_spec.rb +56 -0
- metadata +12 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d3535ba8d583c5ce95324d1e7ddef3a00006cb0
|
4
|
+
data.tar.gz: 006fdd96275923939dd7ead9c24a3f149a248174
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acd2466fd4d5ba6704b1cae1b1ceb374334115e67bf93ff4753a451e9630b7f6d84f4d525d12a0efc99af9d7aca2c48521b376e52f4bfa4bd52058efdec6eb30
|
7
|
+
data.tar.gz: fc61891a91651f0bc848e643245658c3ae9be10cc61b0fde27f27be5df7c6752d998745b8b644f0b803e8e081b963cf9930755429e12228e18a23516b8c8f4cf
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -3,10 +3,37 @@
|
|
3
3
|
[![Build Status](https://travis-ci.org/CocoaPods/cocoapods-packager.png?branch=master)](https://travis-ci.org/CocoaPods/cocoapods-packager)
|
4
4
|
|
5
5
|
CocoaPods plugin which allows you to generate a framework or static library from a podspec.
|
6
|
-
|
6
|
+
|
7
|
+
This plugin is for CocoaPods *developers*, who need to distribute their Pods not only via CocoaPods, but also as frameworks or static libraries for people who do not use Pods.
|
8
|
+
|
9
|
+
## Why should I use Pods if I'm targeting developers who don't use Pods?
|
10
|
+
|
11
|
+
There are still a number of advantages to developing against a `podspec`, even if your public distribution is closed-source:
|
12
|
+
|
13
|
+
1. You can easily use the Pod in-house in an open-source style. This makes step-by-step debugging and multi-project development a breeze.
|
14
|
+
2. You can pull in third-party dependencies using CocoaPods. (CocoaPods Packager is even capable of mangling symbols to improve compatibility with any symbols that might appear in the integrating app.)
|
15
|
+
3. You can declaratively specify build settings (e.g. frameworks, compiler flags) in your `podspec`. This is easier to maintain and replicate than build settings embedded in your Xcode project.
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
```sh
|
20
|
+
$ gem install cocoapods-packager
|
21
|
+
```
|
22
|
+
|
23
|
+
or add a line to your Gemfile:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
gem "cocoapods-packager"
|
27
|
+
```
|
28
|
+
|
29
|
+
then run `bundle install`.
|
30
|
+
|
31
|
+
This installs Packager as a CocoaPods plugin.
|
7
32
|
|
8
33
|
## Usage
|
9
34
|
|
10
35
|
```bash
|
11
36
|
$ pod package KFData.podspec
|
12
37
|
```
|
38
|
+
|
39
|
+
See also `pod --help`.
|
@@ -124,7 +124,7 @@ module Pod
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def static_libs_in_sandbox(build_dir='build')
|
127
|
-
Dir.glob("#{@sandbox_root}/#{build_dir}
|
127
|
+
Dir.glob("#{@sandbox_root}/#{build_dir}/libPods-*.a")
|
128
128
|
end
|
129
129
|
|
130
130
|
def xcodebuild(defines = '', args = '', build_dir = 'build')
|
@@ -8,19 +8,26 @@ module Symbols
|
|
8
8
|
# - put defines into `GCC_PREPROCESSOR_DEFINITIONS` for passing to Xcode
|
9
9
|
#
|
10
10
|
def mangle_for_pod_dependencies(pod_name, sandbox_root)
|
11
|
+
pod_name = pod_name.gsub!('-', '_')
|
12
|
+
|
11
13
|
pod_libs = Dir.glob("#{sandbox_root}/build/libPods-*.a").select do
|
12
14
|
|file| file !~ /#{pod_name}/
|
13
15
|
end
|
14
16
|
|
15
|
-
|
17
|
+
dummy_alias = alias_symbol "PodsDummy_Pods_#{pod_name}", pod_name
|
18
|
+
all_syms = [dummy_alias]
|
16
19
|
|
17
20
|
pod_libs.each do |pod_lib|
|
18
21
|
syms = Symbols.symbols_from_library(pod_lib)
|
19
|
-
all_syms += syms.map! { |sym| sym
|
22
|
+
all_syms += syms.map! { |sym| alias_symbol sym, pod_name }
|
20
23
|
end
|
21
24
|
|
22
25
|
"GCC_PREPROCESSOR_DEFINITIONS='${inherited} #{all_syms.uniq.join(' ')}'"
|
23
26
|
end
|
24
27
|
|
25
|
-
|
28
|
+
def alias_symbol(sym, pod_name)
|
29
|
+
sym + "=Pod#{pod_name}_" + sym
|
30
|
+
end
|
31
|
+
|
32
|
+
module_function :mangle_for_pod_dependencies, :alias_symbol
|
26
33
|
end
|
File without changes
|
@@ -1,19 +1,41 @@
|
|
1
1
|
module Pod
|
2
2
|
class SpecBuilder
|
3
|
-
def initialize(spec, source)
|
3
|
+
def initialize(spec, source, embedded)
|
4
4
|
@spec = spec
|
5
5
|
@source = source.nil? ? '{}' : source
|
6
|
+
@embedded = embedded
|
7
|
+
end
|
8
|
+
|
9
|
+
def framework_path
|
10
|
+
if @embedded
|
11
|
+
@spec.name + '.embeddedframework' + '/' + @spec.name + '.framework'
|
12
|
+
else
|
13
|
+
@spec.name + '.framework'
|
14
|
+
end
|
6
15
|
end
|
7
16
|
|
8
17
|
def spec_platform(platform)
|
9
|
-
|
10
|
-
|
18
|
+
|
19
|
+
fwk_base = platform.name.to_s + '/' + framework_path
|
20
|
+
spec = <<SPEC
|
11
21
|
s.#{platform.name}.platform = :#{platform.symbolic_name}, '#{platform.deployment_target}'
|
12
22
|
s.#{platform.name}.preserve_paths = '#{fwk_base}'
|
13
23
|
s.#{platform.name}.public_header_files = '#{fwk_base}/Versions/A/Headers/*.h'
|
14
24
|
s.#{platform.name}.resource = '#{fwk_base}/Versions/A/Resources/**/*'
|
15
25
|
s.#{platform.name}.vendored_frameworks = '#{fwk_base}'
|
16
26
|
SPEC
|
27
|
+
|
28
|
+
%w(frameworks libraries requires_arc xcconfig).each do |attribute|
|
29
|
+
attributes_hash = @spec.attributes_hash[platform.name.to_s]
|
30
|
+
next if attributes_hash.nil?
|
31
|
+
value = attributes_hash[attribute]
|
32
|
+
next if value.nil?
|
33
|
+
|
34
|
+
value = "'#{value}'" if value.class == String
|
35
|
+
spec += " s.#{platform.name}.#{attribute} = #{value}\n"
|
36
|
+
end
|
37
|
+
|
38
|
+
spec
|
17
39
|
end
|
18
40
|
|
19
41
|
def spec_metadata
|
@@ -32,7 +54,8 @@ SPEC
|
|
32
54
|
spec = "Pod::Spec.new do |s|\n"
|
33
55
|
|
34
56
|
%w(name version summary license authors homepage description social_media_url
|
35
|
-
docset_url documentation_url screenshots
|
57
|
+
docset_url documentation_url screenshots frameworks libraries requires_arc
|
58
|
+
deployment_target xcconfig).each do |attribute|
|
36
59
|
value = @spec.attributes_hash[attribute]
|
37
60
|
next if value.nil?
|
38
61
|
|
File without changes
|
data/lib/cocoapods_packager.rb
CHANGED
data/lib/cocoapods_plugin.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'pod/command/package'
|
2
|
-
require 'builder'
|
3
|
-
require 'framework'
|
4
|
-
require 'mangle'
|
5
|
-
require 'pod_utils'
|
6
|
-
require 'spec_builder'
|
7
|
-
require 'symbols'
|
2
|
+
require 'cocoapods-packager/builder'
|
3
|
+
require 'cocoapods-packager/framework'
|
4
|
+
require 'cocoapods-packager/mangle'
|
5
|
+
require 'cocoapods-packager/pod_utils'
|
6
|
+
require 'cocoapods-packager/spec_builder'
|
7
|
+
require 'cocoapods-packager/symbols'
|
data/lib/pod/command/package.rb
CHANGED
@@ -37,7 +37,7 @@ module Pod
|
|
37
37
|
lib = Dir.glob("NikeKit-*/ios/NikeKit.framework/NikeKit").first
|
38
38
|
symbols = Symbols.symbols_from_library(lib).uniq.sort.reject { |e| e =~ /PodNikeKit/ }
|
39
39
|
symbols.should == %w{ BBUNikePlusActivity BBUNikePlusSessionManager
|
40
|
-
BBUNikePlusTag
|
40
|
+
BBUNikePlusTag }
|
41
41
|
end
|
42
42
|
|
43
43
|
it "does not mangle symbols if option --no-mangle is specified" do
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Pod::Spec.new do |s|
|
2
|
+
s.name = 'Builder'
|
3
|
+
s.version = '0.0.1'
|
4
|
+
s.summary = 'Yo'
|
5
|
+
s.homepage = 'https://github.com/CocoaPods/cocoapods-packager'
|
6
|
+
s.license = {:type => 'MIT'}
|
7
|
+
s.authors = { 'Boris Bügling' => 'http://buegling.com' }
|
8
|
+
s.source = { :git => 'https://github.com/CocoaPods/cocoapods-packager.git',
|
9
|
+
:tag => s.version.to_s }
|
10
|
+
|
11
|
+
s.libraries = 'xml2'
|
12
|
+
s.requires_arc = true
|
13
|
+
s.xcconfig = { 'OTHER_LDFLAGS' => '-lObjC' }
|
14
|
+
|
15
|
+
s.ios.frameworks = 'Foundation'
|
16
|
+
s.ios.deployment_target = '8.0'
|
17
|
+
|
18
|
+
s.osx.frameworks = 'AppKit'
|
19
|
+
s.osx.requires_arc = false
|
20
|
+
s.osx.xcconfig = { 'CFLAGS' => '-I.' }
|
21
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
describe SpecBuilder do
|
5
|
+
def compare_attributes(first_spec, second_spec, attribute_name)
|
6
|
+
first_spec.attributes_hash[attribute_name].should ==
|
7
|
+
second_spec.attributes_hash[attribute_name]
|
8
|
+
|
9
|
+
%w(ios osx).each do |platform|
|
10
|
+
first_spec.attributes_hash[platform][attribute_name].should ==
|
11
|
+
second_spec.attributes_hash[platform][attribute_name]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def specification_from_builder(builder)
|
16
|
+
spec_string = builder.spec_metadata
|
17
|
+
spec_string += builder.spec_platform(Platform.ios)
|
18
|
+
spec_string += builder.spec_platform(Platform.osx)
|
19
|
+
spec_string += builder.spec_close
|
20
|
+
|
21
|
+
return Specification.from_string(spec_string, 'Builder.podspec')
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'Preserve attributes from source specification' do
|
25
|
+
before do
|
26
|
+
@spec = Specification.from_file('spec/fixtures/Builder.podspec')
|
27
|
+
@builder = SpecBuilder.new(@spec, nil, false)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "preserves platform.frameworks" do
|
31
|
+
spec = specification_from_builder(@builder)
|
32
|
+
compare_attributes(spec, @spec, 'frameworks')
|
33
|
+
end
|
34
|
+
|
35
|
+
it "preserves platform.libraries" do
|
36
|
+
spec = specification_from_builder(@builder)
|
37
|
+
compare_attributes(spec, @spec, 'libraries')
|
38
|
+
end
|
39
|
+
|
40
|
+
it "preserves platform.requires_arc" do
|
41
|
+
spec = specification_from_builder(@builder)
|
42
|
+
compare_attributes(spec, @spec, 'requires_arc')
|
43
|
+
end
|
44
|
+
|
45
|
+
it "preserves platform.deployment_target" do
|
46
|
+
spec = specification_from_builder(@builder)
|
47
|
+
compare_attributes(spec, @spec, 'deployment_target')
|
48
|
+
end
|
49
|
+
|
50
|
+
it "preserves platform.xcconfig" do
|
51
|
+
spec = specification_from_builder(@builder)
|
52
|
+
compare_attributes(spec, @spec, 'xcconfig')
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
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.5.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-
|
11
|
+
date: 2014-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -54,21 +54,23 @@ files:
|
|
54
54
|
- README.md
|
55
55
|
- Rakefile
|
56
56
|
- cocoapods-packager.gemspec
|
57
|
-
- lib/builder.rb
|
57
|
+
- lib/cocoapods-packager/builder.rb
|
58
|
+
- lib/cocoapods-packager/framework.rb
|
59
|
+
- lib/cocoapods-packager/mangle.rb
|
60
|
+
- lib/cocoapods-packager/pod_utils.rb
|
61
|
+
- lib/cocoapods-packager/spec_builder.rb
|
62
|
+
- lib/cocoapods-packager/symbols.rb
|
58
63
|
- lib/cocoapods_packager.rb
|
59
64
|
- lib/cocoapods_plugin.rb
|
60
|
-
- lib/framework.rb
|
61
|
-
- lib/mangle.rb
|
62
65
|
- lib/pod/command/package.rb
|
63
|
-
- lib/pod_utils.rb
|
64
|
-
- lib/spec_builder.rb
|
65
|
-
- lib/symbols.rb
|
66
66
|
- scripts/lstconst.sh
|
67
67
|
- scripts/lstsym.sh
|
68
68
|
- spec/command/package_spec.rb
|
69
|
+
- spec/fixtures/Builder.podspec
|
69
70
|
- spec/fixtures/KFData.podspec
|
70
71
|
- spec/fixtures/NikeKit.podspec
|
71
72
|
- spec/spec_helper.rb
|
73
|
+
- spec/specification/builder_spec.rb
|
72
74
|
homepage: https://github.com/CocoaPods/cocoapods-packager
|
73
75
|
licenses:
|
74
76
|
- MIT
|
@@ -95,7 +97,9 @@ specification_version: 4
|
|
95
97
|
summary: ''
|
96
98
|
test_files:
|
97
99
|
- spec/command/package_spec.rb
|
100
|
+
- spec/fixtures/Builder.podspec
|
98
101
|
- spec/fixtures/KFData.podspec
|
99
102
|
- spec/fixtures/NikeKit.podspec
|
100
103
|
- spec/spec_helper.rb
|
104
|
+
- spec/specification/builder_spec.rb
|
101
105
|
has_rdoc:
|