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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15b721f9ad9493eb807bfebfa9c505a3dbb0d27c
4
- data.tar.gz: f6a90ea5358918fafde09f6e2fbdc1b6f794d91c
3
+ metadata.gz: 1d3535ba8d583c5ce95324d1e7ddef3a00006cb0
4
+ data.tar.gz: 006fdd96275923939dd7ead9c24a3f149a248174
5
5
  SHA512:
6
- metadata.gz: 21a49fc9e21c0764850a9c01cf08b251c1a047ca9aed6320d52120433f7be46693f8648f5bf2d277418980b71a94181907487dc82f8ccdbed1dd670a918179ac
7
- data.tar.gz: 3b94df361e45e15c39e33e1e7c0c1edd79424577664a3d1035ed6ffb20822c75216fbf9d06c504445a4d5acff22c665b9c66d55fa4ff922967190cceded55e70
6
+ metadata.gz: acd2466fd4d5ba6704b1cae1b1ceb374334115e67bf93ff4753a451e9630b7f6d84f4d525d12a0efc99af9d7aca2c48521b376e52f4bfa4bd52058efdec6eb30
7
+ data.tar.gz: fc61891a91651f0bc848e643245658c3ae9be10cc61b0fde27f27be5df7c6752d998745b8b644f0b803e8e081b963cf9930755429e12228e18a23516b8c8f4cf
data/Gemfile.lock CHANGED
@@ -9,7 +9,7 @@ GIT
9
9
  PATH
10
10
  remote: .
11
11
  specs:
12
- cocoapods-packager (0.3.0)
12
+ cocoapods-packager (0.5.0)
13
13
 
14
14
  GEM
15
15
  remote: https://rubygems.org/
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
- This is useful for distributing closed source libraries or for providing alternative integrations for people who do not use Pods.
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}/*.a").reject { |e| e =~ /libPods\.a$/ }
127
+ Dir.glob("#{@sandbox_root}/#{build_dir}/libPods-*.a")
128
128
  end
129
129
 
130
130
  def xcodebuild(defines = '', args = '', build_dir = 'build')
@@ -50,7 +50,7 @@ module Framework
50
50
  @root_path = Pathname.new(@platform)
51
51
 
52
52
  if @embedded
53
- @root_path += Pathname.new(@name + '.embeddedframwork')
53
+ @root_path += Pathname.new(@name + '.embeddedframework')
54
54
  end
55
55
 
56
56
  @root_path.mkpath unless @root_path.exist?
@@ -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
- all_syms = []
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 + "=Pod#{pod_name}_" + 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
- module_function :mangle_for_pod_dependencies
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
@@ -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
- fwk_base = platform.name.to_s + '/' + @spec.name + '.framework'
10
- <<SPEC
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).each do |attribute|
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
@@ -1,5 +1,5 @@
1
1
  module Pod
2
2
  module Packager
3
- VERSION = '0.4.0'
3
+ VERSION = '0.5.0'
4
4
  end
5
5
  end
@@ -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'
@@ -63,7 +63,7 @@ module Pod
63
63
  end
64
64
 
65
65
  def build_package
66
- builder = SpecBuilder.new(@spec, @source)
66
+ builder = SpecBuilder.new(@spec, @source, @embedded)
67
67
  newspec = builder.spec_metadata
68
68
 
69
69
  @spec.available_platforms.each do |platform|
@@ -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 PodsDummy_Pods_NikeKit }
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.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-07-22 00:00:00.000000000 Z
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: