cocoapods-packager 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.rubocop-cocoapods.yml +70 -0
- data/.rubocop.yml +16 -0
- data/.travis.yml +11 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +71 -0
- data/LICENSE +22 -0
- data/README.md +17 -0
- data/Rakefile +12 -0
- data/TODO.md +8 -0
- data/cocoapods-packager.gemspec +21 -0
- data/lib/cocoapods_packager.rb +5 -0
- data/lib/cocoapods_plugin.rb +4 -0
- data/lib/mangle.rb +26 -0
- data/lib/pod/command/package.rb +125 -0
- data/lib/spec_builder.rb +37 -0
- data/lib/symbols.rb +35 -0
- data/scripts/lstconst.sh +9 -0
- data/scripts/lstsym.sh +8 -0
- data/spec/command/package_spec.rb +43 -0
- data/spec/fixtures/KFData.podspec +64 -0
- data/spec/spec_helper.rb +47 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8fe83f612365b4245d11ad2f1590e5bbe9ca7e41
|
4
|
+
data.tar.gz: e81a6d18d6b3e1fee1bf5858ea33821c45822f5f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c9d4ed1a0bdf51c68394d7ceab1903a3c2b89377a78d962ea60f7cfce7de99a60ac76e28411ca388fe6278645334f302ca185d5164617a5b5cdf613bc6ac2559
|
7
|
+
data.tar.gz: 50099b6e992d865d6ca0b017a075ec40864fa4216add39620909301d487865ec41450f63e14e51d6859204eb8b1c9aca521636ff56d30cfa9a555fbd41efbccc
|
data/.gitignore
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
AllCops:
|
2
|
+
Include:
|
3
|
+
- Rakefile
|
4
|
+
- Gemfile
|
5
|
+
- ./*.gemspec
|
6
|
+
Exclude:
|
7
|
+
- spec/fixtures/**/*
|
8
|
+
|
9
|
+
# At the moment not ready to be used
|
10
|
+
# https://github.com/bbatsov/rubocop/issues/947
|
11
|
+
Documentation:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
#- CocoaPods -----------------------------------------------------------------#
|
15
|
+
|
16
|
+
# We adopted raise instead of fail.
|
17
|
+
SignalException:
|
18
|
+
EnforcedStyle: only_raise
|
19
|
+
|
20
|
+
# They are idiomatic
|
21
|
+
AssignmentInCondition:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
# Allow backticks
|
25
|
+
AsciiComments:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
# Indentation clarifies logic branches in implementations
|
29
|
+
IfUnlessModifier:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
# No enforced convention here.
|
33
|
+
SingleLineBlockParams:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
# We only add the comment when needed.
|
37
|
+
Encoding:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
#- CocoaPods support for Ruby 1.8.7 ------------------------------------------#
|
41
|
+
|
42
|
+
HashSyntax:
|
43
|
+
EnforcedStyle: hash_rockets
|
44
|
+
|
45
|
+
Lambda:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
DotPosition:
|
49
|
+
EnforcedStyle: trailing
|
50
|
+
|
51
|
+
#- CocoaPods specs -----------------------------------------------------------#
|
52
|
+
|
53
|
+
# Allow for `should.match /regexp/`.
|
54
|
+
AmbiguousRegexpLiteral:
|
55
|
+
Exclude:
|
56
|
+
- spec/**/*
|
57
|
+
|
58
|
+
# Allow `object.should == object` syntax.
|
59
|
+
Void:
|
60
|
+
Exclude:
|
61
|
+
- spec/**/*
|
62
|
+
|
63
|
+
ClassAndModuleChildren:
|
64
|
+
Exclude:
|
65
|
+
- spec/**/*
|
66
|
+
|
67
|
+
UselessComparison:
|
68
|
+
Exclude:
|
69
|
+
- spec/**/*
|
70
|
+
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
inherit_from:
|
2
|
+
- .rubocop-cocoapods.yml
|
3
|
+
|
4
|
+
#- Core -----------------------------------------------------------------------
|
5
|
+
|
6
|
+
AllCops:
|
7
|
+
Exclude:
|
8
|
+
- spec/**/*
|
9
|
+
- spec/fixtures/**/*
|
10
|
+
|
11
|
+
Style/Tab:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
LineLength:
|
15
|
+
Enabled: false
|
16
|
+
|
data/.travis.yml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
language: objective-c
|
2
|
+
env:
|
3
|
+
# This is what 10.8.x comes with and we want to support that.
|
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]
|
11
|
+
script: bundle exec rake specs
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/irrationalfab/PrettyBacon.git
|
3
|
+
revision: eaf7e6c786fd5ccc6fb88e943bf7c5e6c27569a3
|
4
|
+
branch: master
|
5
|
+
specs:
|
6
|
+
prettybacon (0.0.1)
|
7
|
+
bacon (~> 1.2)
|
8
|
+
|
9
|
+
PATH
|
10
|
+
remote: .
|
11
|
+
specs:
|
12
|
+
cocoapods-packager (0.1.0)
|
13
|
+
|
14
|
+
GEM
|
15
|
+
remote: https://rubygems.org/
|
16
|
+
specs:
|
17
|
+
activesupport (3.2.16)
|
18
|
+
i18n (~> 0.6, >= 0.6.4)
|
19
|
+
multi_json (~> 1.0)
|
20
|
+
bacon (1.2.0)
|
21
|
+
claide (0.4.0)
|
22
|
+
cocoapods (0.29.0)
|
23
|
+
activesupport (>= 3.2.15, < 4)
|
24
|
+
claide (~> 0.4.0)
|
25
|
+
cocoapods-core (= 0.29.0)
|
26
|
+
cocoapods-downloader (~> 0.3.0)
|
27
|
+
cocoapods-try-release-fix (~> 0.1.1)
|
28
|
+
colored (~> 1.2)
|
29
|
+
escape (~> 0.0.4)
|
30
|
+
json_pure (~> 1.8)
|
31
|
+
nap (~> 0.5)
|
32
|
+
open4 (~> 1.3)
|
33
|
+
xcodeproj (~> 0.14.1)
|
34
|
+
cocoapods-core (0.29.0)
|
35
|
+
activesupport (>= 3.2.15, < 4)
|
36
|
+
fuzzy_match (~> 2.0.4)
|
37
|
+
json_pure (~> 1.8)
|
38
|
+
nap (~> 0.5)
|
39
|
+
cocoapods-downloader (0.3.0)
|
40
|
+
cocoapods-try-release-fix (0.1.1)
|
41
|
+
colored (1.2)
|
42
|
+
escape (0.0.4)
|
43
|
+
fuzzy_match (2.0.4)
|
44
|
+
i18n (0.6.9)
|
45
|
+
json_pure (1.8.1)
|
46
|
+
metaclass (0.0.2)
|
47
|
+
mocha (0.11.4)
|
48
|
+
metaclass (~> 0.0.1)
|
49
|
+
mocha-on-bacon (0.2.1)
|
50
|
+
mocha (>= 0.9.8)
|
51
|
+
multi_json (1.8.4)
|
52
|
+
nap (0.6.0)
|
53
|
+
open4 (1.3.0)
|
54
|
+
rake (10.1.1)
|
55
|
+
xcodeproj (0.14.1)
|
56
|
+
activesupport (~> 3.0)
|
57
|
+
colored (~> 1.2)
|
58
|
+
rake
|
59
|
+
|
60
|
+
PLATFORMS
|
61
|
+
ruby
|
62
|
+
|
63
|
+
DEPENDENCIES
|
64
|
+
bacon
|
65
|
+
bundler (~> 1.3)
|
66
|
+
cocoapods
|
67
|
+
cocoapods-packager!
|
68
|
+
mocha (~> 0.11.4)
|
69
|
+
mocha-on-bacon
|
70
|
+
prettybacon!
|
71
|
+
rake
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Kyle Fuller
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# CocoaPods Packager
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/CocoaPods/cocoapods-packager.png?branch=master)](https://travis-ci.org/CocoaPods/cocoapods-packager)
|
4
|
+
|
5
|
+
:warning::warning: This isn't ready for consumption just yet, follow [this
|
6
|
+
issue](https://github.com/CocoaPods/cocoapods-packager/issues/1) to keep an
|
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.
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
```bash
|
15
|
+
$ pod package KFData
|
16
|
+
```
|
17
|
+
|
data/Rakefile
ADDED
data/TODO.md
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
[ ] Handle license file in generated podspec
|
2
|
+
[ ] Handle frameworks in generated podspec
|
3
|
+
[ ] Handle resources
|
4
|
+
[ ] Write tests
|
5
|
+
[ ] Implement various commandline options
|
6
|
+
[ ] Make symbol aliasing configurable
|
7
|
+
[ ] Pods with only one platform lead to lint errors
|
8
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cocoapods_packager.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cocoapods-packager'
|
8
|
+
spec.version = Pod::Packager::VERSION
|
9
|
+
spec.authors = ['Kyle Fuller']
|
10
|
+
spec.summary = ''
|
11
|
+
spec.homepage = 'https://github.com/CocoaPods/cocoapods-packager'
|
12
|
+
spec.license = 'MIT'
|
13
|
+
spec.files = `git ls-files`.split($/)
|
14
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
|
+
spec.require_paths = ["lib"]
|
17
|
+
|
18
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
19
|
+
spec.add_development_dependency "rake"
|
20
|
+
end
|
21
|
+
|
data/lib/mangle.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module Symbols
|
2
|
+
#
|
3
|
+
# performs symbol aliasing
|
4
|
+
#
|
5
|
+
# for each dependency:
|
6
|
+
# - determine symbols for classes and global constants
|
7
|
+
# - alias each symbol to Pod#{pod_name}_#{symbol}
|
8
|
+
# - put defines into `GCC_PREPROCESSOR_DEFINITIONS` for passing to Xcode
|
9
|
+
#
|
10
|
+
def mangle_for_pod_dependencies(pod_name, sandbox_root)
|
11
|
+
pod_libs = Dir.glob("#{sandbox_root}/build/libPods-*.a").select do
|
12
|
+
|file| file !~ /#{pod_name}/
|
13
|
+
end
|
14
|
+
|
15
|
+
all_syms = []
|
16
|
+
|
17
|
+
pod_libs.each do |pod_lib|
|
18
|
+
syms = Symbols.symbols_from_library(pod_lib)
|
19
|
+
all_syms += syms.map! { |sym| sym + "=Pod#{pod_name}_" + sym }
|
20
|
+
end
|
21
|
+
|
22
|
+
"GCC_PREPROCESSOR_DEFINITIONS='${inherited} #{all_syms.join(' ')}'"
|
23
|
+
end
|
24
|
+
|
25
|
+
module_function :mangle_for_pod_dependencies
|
26
|
+
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class Package < Command
|
4
|
+
self.summary = 'Package a podspec into a static library.'
|
5
|
+
self.arguments = [['NAME', :required]]
|
6
|
+
|
7
|
+
def initialize(argv)
|
8
|
+
@name = argv.shift_argument
|
9
|
+
@spec = spec_with_path(@name)
|
10
|
+
@spec = spec_with_name(@name) unless @spec
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def validate!
|
15
|
+
super
|
16
|
+
help! 'A podspec name or path is required.' unless @spec
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
if @spec
|
21
|
+
builder = SpecBuilder.new(@spec)
|
22
|
+
newspec = builder.spec_metadata
|
23
|
+
|
24
|
+
@spec.available_platforms.each do |platform|
|
25
|
+
build_in_sandbox(platform)
|
26
|
+
|
27
|
+
newspec += builder.spec_platform(platform)
|
28
|
+
end
|
29
|
+
|
30
|
+
newspec += builder.spec_close
|
31
|
+
File.open(@spec.name + '.podspec', 'w') { |file| file.write(newspec) }
|
32
|
+
else
|
33
|
+
help! 'Unable to find a podspec with path or name.'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def spec_with_name(name)
|
38
|
+
return unless !name.nil?
|
39
|
+
|
40
|
+
set = SourcesManager.search(Dependency.new(name))
|
41
|
+
|
42
|
+
if set
|
43
|
+
set.specification.root
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def spec_with_path(path)
|
48
|
+
if !path.nil? && Pathname.new(path).exist?
|
49
|
+
@path = path
|
50
|
+
Specification.from_file(path)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def build_in_sandbox(platform)
|
55
|
+
config.sandbox_root = 'Pods'
|
56
|
+
config.integrate_targets = false
|
57
|
+
config.skip_repo_update = true
|
58
|
+
|
59
|
+
sandbox = install_pod(platform.name)
|
60
|
+
|
61
|
+
UI.puts 'Building framework'
|
62
|
+
xcodebuild
|
63
|
+
defines = Symbols.mangle_for_pod_dependencies(@spec.name, config.sandbox_root)
|
64
|
+
xcodebuild(defines)
|
65
|
+
|
66
|
+
versions_path, headers_path = create_framework_tree(platform.name.to_s)
|
67
|
+
`cp #{sandbox.public_headers.root}/#{@spec.name}/*.h #{headers_path}`
|
68
|
+
|
69
|
+
if platform.name == :ios
|
70
|
+
xcodebuild(defines, '-sdk iphonesimulator', 'build-sim')
|
71
|
+
`lipo #{config.sandbox_root}/build/libPods.a #{config.sandbox_root}/build-sim/libPods.a -create -output #{versions_path}/#{@spec.name}`
|
72
|
+
else
|
73
|
+
`cp #{config.sandbox_root}/build/libPods.a #{versions_path}/#{@spec.name}`
|
74
|
+
end
|
75
|
+
|
76
|
+
Pathname.new(config.sandbox_root).rmtree
|
77
|
+
Pathname.new('Podfile.lock').delete
|
78
|
+
end
|
79
|
+
|
80
|
+
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`
|
82
|
+
end
|
83
|
+
|
84
|
+
def create_framework_tree(platform)
|
85
|
+
root_path = Pathname.new(@spec.name + '-' + platform + '.framework')
|
86
|
+
root_path.mkdir unless root_path.exist?
|
87
|
+
|
88
|
+
versions_path = root_path + Pathname.new('Versions/A')
|
89
|
+
|
90
|
+
headers_path = versions_path + Pathname.new('Headers')
|
91
|
+
headers_path.mkpath unless headers_path.exist?
|
92
|
+
|
93
|
+
current_version_path = versions_path + Pathname.new('../Current')
|
94
|
+
`ln -sf A #{current_version_path}`
|
95
|
+
`ln -sf Versions/Current/Headers #{root_path}/`
|
96
|
+
`ln -sf Versions/Current/#{@spec.name} #{root_path}/`
|
97
|
+
|
98
|
+
return versions_path, headers_path
|
99
|
+
end
|
100
|
+
|
101
|
+
def podfile_from_spec(platform_name, deployment_target)
|
102
|
+
name = @spec.name
|
103
|
+
path = @path
|
104
|
+
podfile = Pod::Podfile.new do
|
105
|
+
platform(platform_name, deployment_target)
|
106
|
+
if path
|
107
|
+
pod name, :podspec => path
|
108
|
+
else
|
109
|
+
pod name, :path => '.'
|
110
|
+
end
|
111
|
+
end
|
112
|
+
podfile
|
113
|
+
end
|
114
|
+
|
115
|
+
def install_pod(platform_name)
|
116
|
+
podfile = podfile_from_spec(platform_name, @spec.deployment_target(platform_name))
|
117
|
+
sandbox = Sandbox.new(config.sandbox_root)
|
118
|
+
installer = Installer.new(sandbox, podfile)
|
119
|
+
installer.install!
|
120
|
+
|
121
|
+
sandbox
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
data/lib/spec_builder.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
module Pod
|
2
|
+
class SpecBuilder
|
3
|
+
def initialize(spec)
|
4
|
+
@spec = spec
|
5
|
+
end
|
6
|
+
|
7
|
+
def spec_platform(platform)
|
8
|
+
fwk_base = @spec.name + '-' + platform.name.to_s + '.framework'
|
9
|
+
<<SPEC
|
10
|
+
s.#{platform.name}.platform = :#{platform.symbolic_name}, '#{platform.deployment_target}'
|
11
|
+
s.#{platform.name}.preserve_paths = '#{fwk_base}'
|
12
|
+
s.#{platform.name}.public_header_files = '#{fwk_base}/Versions/A/Headers/*.h'
|
13
|
+
#s.#{platform.name}.resource = '#{fwk_base}/Versions/A/Resources/#{fwk_base}.bundle'
|
14
|
+
s.#{platform.name}.vendored_frameworks = '#{fwk_base}'
|
15
|
+
|
16
|
+
SPEC
|
17
|
+
end
|
18
|
+
|
19
|
+
def spec_metadata
|
20
|
+
<<SPEC
|
21
|
+
Pod::Spec.new do |s|
|
22
|
+
s.name = "#{@spec.name}"
|
23
|
+
s.version = "#{@spec.version}"
|
24
|
+
s.summary = "#{@spec.summary}"
|
25
|
+
s.license = #{@spec.license}
|
26
|
+
s.authors = #{@spec.authors}
|
27
|
+
s.homepage = "#{@spec.homepage}"
|
28
|
+
s.source = #{@spec.source}
|
29
|
+
|
30
|
+
SPEC
|
31
|
+
end
|
32
|
+
|
33
|
+
def spec_close
|
34
|
+
'end'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/symbols.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
module Symbols
|
2
|
+
def symbols_from_library(library)
|
3
|
+
syms = `nm #{library}`.split("\n")
|
4
|
+
|
5
|
+
result = classes_from_symbols(syms)
|
6
|
+
result + constants_from_symbols(syms)
|
7
|
+
end
|
8
|
+
|
9
|
+
module_function :symbols_from_library
|
10
|
+
|
11
|
+
:private
|
12
|
+
|
13
|
+
def classes_from_symbols(syms)
|
14
|
+
classes = syms.select { |klass| klass[/OBJC_CLASS_\$_/] }
|
15
|
+
classes = classes.select { |klass| klass !~ /_NS|_UI/ }
|
16
|
+
classes = classes.uniq
|
17
|
+
classes.map! { |klass| klass.gsub(/^.*\$_/, '') }
|
18
|
+
end
|
19
|
+
|
20
|
+
def constants_from_symbols(syms)
|
21
|
+
consts = syms.select { |const| const[/ S /] }
|
22
|
+
consts = consts.select { |const| const !~ /OBJC|\.eh/ }
|
23
|
+
consts = consts.uniq
|
24
|
+
consts = consts.map! { |const| const.gsub(/^.*_/, '') }
|
25
|
+
|
26
|
+
other_consts = syms.select { |const| const[/ T /] }
|
27
|
+
other_consts = other_consts.uniq
|
28
|
+
other_consts = other_consts.map! { |const| const.gsub(/^.*_/, '') }
|
29
|
+
|
30
|
+
consts + other_consts
|
31
|
+
end
|
32
|
+
|
33
|
+
module_function :classes_from_symbols
|
34
|
+
module_function :constants_from_symbols
|
35
|
+
end
|
data/scripts/lstconst.sh
ADDED
data/scripts/lstsym.sh
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
describe Command::Spec::Package do
|
5
|
+
describe 'CLAide' do
|
6
|
+
it 'registers itself' do
|
7
|
+
Command.parse(%w{ package }).should.be.instance_of Command::Package
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'presents the help if no spec is provide' do
|
11
|
+
command = Command.parse(%w{ package })
|
12
|
+
should.raise CLAide::Help do
|
13
|
+
command.validate!
|
14
|
+
end.message.should.match /required/
|
15
|
+
end
|
16
|
+
|
17
|
+
it "errors if it cannot find a spec" do
|
18
|
+
SourcesManager.stubs(:search).returns(nil)
|
19
|
+
|
20
|
+
command = Command.parse(%w{ package KFData })
|
21
|
+
should.raise CLAide::Help do
|
22
|
+
command.run
|
23
|
+
end.message.should.match /Unable to find/
|
24
|
+
end
|
25
|
+
|
26
|
+
it "runs with a path to a spec" do
|
27
|
+
SourcesManager.stubs(:search).returns(nil)
|
28
|
+
|
29
|
+
command = Command.parse(%w{ package spec/fixtures/KFData.podspec })
|
30
|
+
command.run
|
31
|
+
|
32
|
+
true.should == true # To make the test pass without any shoulds
|
33
|
+
end
|
34
|
+
|
35
|
+
it "runs with a spec in the master repository" do
|
36
|
+
command = Command.parse(%w{ package KFData })
|
37
|
+
command.run
|
38
|
+
|
39
|
+
true.should == true # To make the test pass without any shoulds
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
Pod::Spec.new do |s|
|
2
|
+
s.name = 'KFData'
|
3
|
+
s.version = '1.0.1'
|
4
|
+
s.license = 'BSD'
|
5
|
+
s.summary = 'Lightweight Core Data wrapper.'
|
6
|
+
s.homepage = 'https://github.com/kylef/KFData'
|
7
|
+
s.authors = { 'Kyle Fuller' => 'inbox@kylefuller.co.uk' }
|
8
|
+
s.social_media_url = 'https://twitter.com/kylefuller'
|
9
|
+
s.source = { :git => 'https://github.com/kylef/KFData.git', :tag => s.version.to_s }
|
10
|
+
|
11
|
+
s.requires_arc = true
|
12
|
+
|
13
|
+
s.osx.deployment_target = '10.7'
|
14
|
+
s.ios.deployment_target = '5.0'
|
15
|
+
|
16
|
+
s.default_subspec = 'Essentials'
|
17
|
+
s.header_dir = 'KFData'
|
18
|
+
|
19
|
+
s.subspec 'Attribute' do |attribute_spec|
|
20
|
+
attribute_spec.ios.source_files = 'KFData/Attribute/*.{h,m}'
|
21
|
+
attribute_spec.osx.source_files = 'KFData/Attribute/*.{h,m}'
|
22
|
+
end
|
23
|
+
|
24
|
+
s.subspec 'Core' do |corespec|
|
25
|
+
corespec.ios.frameworks = 'CoreData'
|
26
|
+
corespec.ios.source_files = 'KFData/KFData.h', 'KFData/Core/*.{h,m}'
|
27
|
+
|
28
|
+
corespec.osx.frameworks = 'CoreData'
|
29
|
+
corespec.osx.source_files = 'KFData/Core/*.{h,m}'
|
30
|
+
end
|
31
|
+
|
32
|
+
s.subspec 'Store' do |storespec|
|
33
|
+
storespec.ios.frameworks = 'CoreData'
|
34
|
+
storespec.ios.source_files = 'KFData/Store/*.{h,m}'
|
35
|
+
storespec.ios.public_header_files = 'KFData/Store/KFDataStore.h'
|
36
|
+
storespec.ios.private_header_files = 'KFData/Store/KFDataStoreInternal.h'
|
37
|
+
|
38
|
+
storespec.osx.frameworks = 'CoreData'
|
39
|
+
storespec.osx.source_files = 'KFData/Store/*.{h,m}'
|
40
|
+
storespec.osx.public_header_files = 'KFData/Store/KFDataStore.h'
|
41
|
+
storespec.osx.private_header_files = 'KFData/Store/KFDataStoreInternal.h'
|
42
|
+
end
|
43
|
+
|
44
|
+
s.subspec 'UI' do |uispec|
|
45
|
+
uispec.dependency 'KFData/Essentials'
|
46
|
+
uispec.platform = :ios
|
47
|
+
uispec.ios.frameworks = 'UIKit'
|
48
|
+
uispec.ios.source_files = 'KFData/UI/*.{h,m}'
|
49
|
+
end
|
50
|
+
|
51
|
+
s.subspec 'Essentials' do |essentialsspec|
|
52
|
+
essentialsspec.dependency 'KFData/Core'
|
53
|
+
essentialsspec.dependency 'KFData/Store'
|
54
|
+
essentialsspec.dependency 'KFData/Attribute'
|
55
|
+
essentialsspec.ios.dependency 'KFData/UI'
|
56
|
+
end
|
57
|
+
|
58
|
+
s.subspec 'Compatibility' do |cspec|
|
59
|
+
cspec.dependency 'KFData/Core'
|
60
|
+
cspec.header_dir = 'KFData/Compatibility'
|
61
|
+
cspec.source_files = 'KFData/Compatibility/*.{h,m}'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
|
3
|
+
$:.unshift((ROOT + 'lib').to_s)
|
4
|
+
$:.unshift((ROOT + 'spec').to_s)
|
5
|
+
|
6
|
+
require 'bundler/setup'
|
7
|
+
require 'bacon'
|
8
|
+
require 'mocha-on-bacon'
|
9
|
+
require 'pretty_bacon'
|
10
|
+
require 'cocoapods'
|
11
|
+
|
12
|
+
require 'cocoapods_plugin'
|
13
|
+
|
14
|
+
#-----------------------------------------------------------------------------#
|
15
|
+
|
16
|
+
module Pod
|
17
|
+
|
18
|
+
# Disable the wrapping so the output is deterministic in the tests.
|
19
|
+
#
|
20
|
+
UI.disable_wrap = true
|
21
|
+
|
22
|
+
# Redirects the messages to an internal store.
|
23
|
+
#
|
24
|
+
module UI
|
25
|
+
@output = ''
|
26
|
+
@warnings = ''
|
27
|
+
|
28
|
+
class << self
|
29
|
+
attr_accessor :output
|
30
|
+
attr_accessor :warnings
|
31
|
+
|
32
|
+
def puts(message = '')
|
33
|
+
@output << "#{message}\n"
|
34
|
+
end
|
35
|
+
|
36
|
+
def warn(message = '', actions = [])
|
37
|
+
@warnings << "#{message}\n"
|
38
|
+
end
|
39
|
+
|
40
|
+
def print(message)
|
41
|
+
@output << message
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
#-----------------------------------------------------------------------------#
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-packager
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kyle Fuller
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- ".gitignore"
|
48
|
+
- ".rubocop-cocoapods.yml"
|
49
|
+
- ".rubocop.yml"
|
50
|
+
- ".travis.yml"
|
51
|
+
- Gemfile
|
52
|
+
- Gemfile.lock
|
53
|
+
- LICENSE
|
54
|
+
- README.md
|
55
|
+
- Rakefile
|
56
|
+
- TODO.md
|
57
|
+
- cocoapods-packager.gemspec
|
58
|
+
- lib/cocoapods_packager.rb
|
59
|
+
- lib/cocoapods_plugin.rb
|
60
|
+
- lib/mangle.rb
|
61
|
+
- lib/pod/command/package.rb
|
62
|
+
- lib/spec_builder.rb
|
63
|
+
- lib/symbols.rb
|
64
|
+
- scripts/lstconst.sh
|
65
|
+
- scripts/lstsym.sh
|
66
|
+
- spec/command/package_spec.rb
|
67
|
+
- spec/fixtures/KFData.podspec
|
68
|
+
- spec/spec_helper.rb
|
69
|
+
homepage: https://github.com/CocoaPods/cocoapods-packager
|
70
|
+
licenses:
|
71
|
+
- MIT
|
72
|
+
metadata: {}
|
73
|
+
post_install_message:
|
74
|
+
rdoc_options: []
|
75
|
+
require_paths:
|
76
|
+
- lib
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
requirements: []
|
88
|
+
rubyforge_project:
|
89
|
+
rubygems_version: 2.0.14
|
90
|
+
signing_key:
|
91
|
+
specification_version: 4
|
92
|
+
summary: ''
|
93
|
+
test_files:
|
94
|
+
- spec/command/package_spec.rb
|
95
|
+
- spec/fixtures/KFData.podspec
|
96
|
+
- spec/spec_helper.rb
|
97
|
+
has_rdoc:
|