cocoapods-archive 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.gitmodules +3 -0
- data/.travis.yml +9 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +111 -0
- data/LICENSE.txt +22 -0
- data/README.md +34 -0
- data/Rakefile +73 -0
- data/cocoapods_archive.gemspec +37 -0
- data/lib/camelizable/string.rb +7 -0
- data/lib/cocoapods_archive.rb +3 -0
- data/lib/cocoapods_plugin.rb +2 -0
- data/lib/pod/command/lib/archive.rb +212 -0
- data/spec/functional/cocoapods-archive_spec.rb +46 -0
- data/spec/spec_helper.rb +71 -0
- data/spec/unit/camelizable/string_spec.rb +16 -0
- data/spec/unit/pod/command/lib/archive_spec.rb +32 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3fd142bee060a5aa7ea28b80bb37be67e2e3b8a1
|
4
|
+
data.tar.gz: 6eb054d02dd0de971020b7012aa57b8208fb2827
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0db69a3aca99319a53401719b2bc6b8f7f3deb956c5fba52253269c342844f00413fdc04c4cf8d15b83c2d9b599b19667c80ddd370b072686462ebc0bd702187
|
7
|
+
data.tar.gz: 37110b352bbdba422c23f35ad8573a9c923f8ffc8b6bb157cedf5b046194e9f57e7990ebdbdd2b6e154dab5c388a818090aa047edef29651fc8e775a15472f97
|
data/.gitignore
ADDED
data/.gitmodules
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,9 @@
|
|
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 gem update --system && sudo gem install bundler --no-ri --no-rdoc' GIT_AUTHOR_NAME=CocoaPods GIT_AUTHOR_EMAIL=cocoapods@example.com
|
5
|
+
- RVM_RUBY_VERSION=1.9.3-p392 NOEXEC_DISABLE=1 RUBY_VERSION_SPECIFIC='sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2 && curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem' SSL_CERT_FILE=/usr/local/share/cacert.pem GIT_AUTHOR_NAME=CocoaPods GIT_AUTHOR_EMAIL=cocoapods@example.com
|
6
|
+
before_install:
|
7
|
+
- source ~/.rvm/scripts/rvm && rvm use $RVM_RUBY_VERSION
|
8
|
+
install: eval $RUBY_VERSION_SPECIFIC && rake bootstrap[use_bundle_dir]
|
9
|
+
script: bundle exec rake spec
|
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
group :development do
|
6
|
+
gem 'cocoapods', :git => "https://github.com/CocoaPods/CocoaPods.git", :branch => 'master'
|
7
|
+
gem 'claide', :git => "https://github.com/CocoaPods/CLAide.git", :branch => 'master'
|
8
|
+
gem 'pry'
|
9
|
+
|
10
|
+
if RUBY_VERSION >= '1.9.3'
|
11
|
+
gem 'rubocop'
|
12
|
+
end
|
13
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/CocoaPods/CLAide.git
|
3
|
+
revision: 91250b958b8a000e76fc5850032563de75283902
|
4
|
+
branch: master
|
5
|
+
specs:
|
6
|
+
claide (0.6.1)
|
7
|
+
|
8
|
+
GIT
|
9
|
+
remote: https://github.com/CocoaPods/CocoaPods.git
|
10
|
+
revision: c5c61f7622c1bf4d10125525ddbf8b0cf1170fb9
|
11
|
+
branch: master
|
12
|
+
specs:
|
13
|
+
cocoapods (0.33.1)
|
14
|
+
activesupport (>= 3.2.15, < 4)
|
15
|
+
claide (~> 0.6.1)
|
16
|
+
cocoapods-core (= 0.33.1)
|
17
|
+
cocoapods-downloader (~> 0.6.1)
|
18
|
+
cocoapods-plugins (~> 0.2.0)
|
19
|
+
cocoapods-trunk (~> 0.1.1)
|
20
|
+
cocoapods-try (~> 0.3.0)
|
21
|
+
colored (~> 1.2)
|
22
|
+
escape (~> 0.0.4)
|
23
|
+
json_pure (~> 1.8)
|
24
|
+
nap (~> 0.7)
|
25
|
+
open4 (~> 1.3)
|
26
|
+
xcodeproj (~> 0.17.0)
|
27
|
+
|
28
|
+
PATH
|
29
|
+
remote: .
|
30
|
+
specs:
|
31
|
+
cocoapods-archive (0.0.1)
|
32
|
+
|
33
|
+
GEM
|
34
|
+
remote: https://rubygems.org/
|
35
|
+
specs:
|
36
|
+
activesupport (3.2.19)
|
37
|
+
i18n (~> 0.6, >= 0.6.4)
|
38
|
+
multi_json (~> 1.0)
|
39
|
+
ast (2.0.0)
|
40
|
+
cocoapods-core (0.33.1)
|
41
|
+
activesupport (>= 3.2.15)
|
42
|
+
fuzzy_match (~> 2.0.4)
|
43
|
+
json_pure (~> 1.8)
|
44
|
+
nap (~> 0.5)
|
45
|
+
cocoapods-downloader (0.6.1)
|
46
|
+
cocoapods-plugins (0.2.0)
|
47
|
+
nap
|
48
|
+
cocoapods-trunk (0.1.4)
|
49
|
+
json_pure (~> 1.8)
|
50
|
+
nap (>= 0.6)
|
51
|
+
netrc
|
52
|
+
cocoapods-try (0.3.0)
|
53
|
+
coderay (1.1.0)
|
54
|
+
colored (1.2)
|
55
|
+
diff-lcs (1.2.5)
|
56
|
+
escape (0.0.4)
|
57
|
+
fuzzy_match (2.0.4)
|
58
|
+
i18n (0.6.11)
|
59
|
+
json (1.8.1)
|
60
|
+
json_pure (1.8.1)
|
61
|
+
method_source (0.8.2)
|
62
|
+
multi_json (1.10.1)
|
63
|
+
nap (0.8.0)
|
64
|
+
netrc (0.7.7)
|
65
|
+
open4 (1.3.4)
|
66
|
+
parser (2.2.0.pre.3)
|
67
|
+
ast (>= 1.1, < 3.0)
|
68
|
+
slop (~> 3.4, >= 3.4.5)
|
69
|
+
powerpack (0.0.9)
|
70
|
+
pry (0.10.0)
|
71
|
+
coderay (~> 1.1.0)
|
72
|
+
method_source (~> 0.8.1)
|
73
|
+
slop (~> 3.4)
|
74
|
+
rainbow (2.0.0)
|
75
|
+
rake (10.3.2)
|
76
|
+
rspec (3.0.0)
|
77
|
+
rspec-core (~> 3.0.0)
|
78
|
+
rspec-expectations (~> 3.0.0)
|
79
|
+
rspec-mocks (~> 3.0.0)
|
80
|
+
rspec-core (3.0.2)
|
81
|
+
rspec-support (~> 3.0.0)
|
82
|
+
rspec-expectations (3.0.2)
|
83
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
84
|
+
rspec-support (~> 3.0.0)
|
85
|
+
rspec-mocks (3.0.2)
|
86
|
+
rspec-support (~> 3.0.0)
|
87
|
+
rspec-support (3.0.2)
|
88
|
+
rubocop (0.24.1)
|
89
|
+
json (>= 1.7.7, < 2)
|
90
|
+
parser (>= 2.2.0.pre.3, < 3.0)
|
91
|
+
powerpack (~> 0.0.6)
|
92
|
+
rainbow (>= 1.99.1, < 3.0)
|
93
|
+
ruby-progressbar (~> 1.4)
|
94
|
+
ruby-progressbar (1.5.1)
|
95
|
+
slop (3.5.0)
|
96
|
+
xcodeproj (0.17.0)
|
97
|
+
activesupport (~> 3.0)
|
98
|
+
colored (~> 1.2)
|
99
|
+
|
100
|
+
PLATFORMS
|
101
|
+
ruby
|
102
|
+
|
103
|
+
DEPENDENCIES
|
104
|
+
bundler (~> 1.3)
|
105
|
+
claide!
|
106
|
+
cocoapods!
|
107
|
+
cocoapods-archive!
|
108
|
+
pry
|
109
|
+
rake
|
110
|
+
rspec
|
111
|
+
rubocop
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Braintree, a division of PayPal, Inc.
|
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,34 @@
|
|
1
|
+
cocoapods-archive
|
2
|
+
=================
|
3
|
+
|
4
|
+
A CocoaPods plugin that archives your pod into a .a file for distribution
|
5
|
+
|
6
|
+
This plugin is for CocoaPods *developers*, who need to distribute their Pods not only as CocoaPods, but also as static libraries. Some users just like it the good old fashioned way.
|
7
|
+
|
8
|
+
There are still a number of advantages to developing against a `podspec`, even if your public distribution is closed-source:
|
9
|
+
|
10
|
+
1. You can easily use the Pod in-house open-source, which makes step-by-step debugging a breeze.
|
11
|
+
2. You can pull in third-party dependencies using CocoaPods. (Note: Your static library could cause linker errors in certain projects, where duplicate symbols are present due to common dependencies.)
|
12
|
+
3. You can declaratively specify build settings (e.g. frameworks, compiler flags) in your `podspec`. This is easier to keep track of than build settings embedded in your Xcode project.
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
```sh
|
17
|
+
$ gem install cocoapods-archive
|
18
|
+
```
|
19
|
+
|
20
|
+
or add a line to your Gemfile:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
gem "cocoapods-archive"
|
24
|
+
```
|
25
|
+
|
26
|
+
then run `bundle install`.
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
```sh
|
31
|
+
$ cd YOUR_POD && pod lib archive
|
32
|
+
```
|
33
|
+
|
34
|
+
See also `pod lib archive --help`.
|
data/Rakefile
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
|
+
|
6
|
+
task :default => :spec
|
7
|
+
|
8
|
+
# Bootstrap task
|
9
|
+
#-----------------------------------------------------------------------------#
|
10
|
+
|
11
|
+
desc "Initializes your working copy to run the specs"
|
12
|
+
task :bootstrap, :use_bundle_dir? do |t, args|
|
13
|
+
title "Environment bootstrap"
|
14
|
+
|
15
|
+
puts "Updating submodules"
|
16
|
+
execute_command "git submodule update --init --recursive"
|
17
|
+
|
18
|
+
require 'rbconfig'
|
19
|
+
if RbConfig::CONFIG['prefix'] == '/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr'
|
20
|
+
# Workaround Apple's mess. See https://github.com/CocoaPods/Xcodeproj/issues/137
|
21
|
+
#
|
22
|
+
# TODO This is not as correct as actually fixing the issue, figure out if we
|
23
|
+
# can override these build flags:
|
24
|
+
#
|
25
|
+
# ENV['DLDFLAGS'] = '-undefined dynamic_lookup -multiply_defined suppress'
|
26
|
+
ENV['ARCHFLAGS'] = '-Wno-error=unused-command-line-argument-hard-error-in-future'
|
27
|
+
end
|
28
|
+
|
29
|
+
if system('which bundle')
|
30
|
+
puts "Installing gems"
|
31
|
+
if args[:use_bundle_dir?]
|
32
|
+
execute_command "env XCODEPROJ_BUILD=1 bundle install --path ./travis_bundle_dir"
|
33
|
+
else
|
34
|
+
execute_command "env XCODEPROJ_BUILD=1 bundle install"
|
35
|
+
end
|
36
|
+
else
|
37
|
+
$stderr.puts "\033[0;31m" \
|
38
|
+
"[!] Please install the bundler gem manually:\n" \
|
39
|
+
' $ [sudo] gem install bundler' \
|
40
|
+
"\e[0m"
|
41
|
+
exit 1
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Helpers
|
46
|
+
#-----------------------------------------------------------------------------#
|
47
|
+
|
48
|
+
def execute_command(command)
|
49
|
+
if ENV['VERBOSE']
|
50
|
+
sh(command)
|
51
|
+
else
|
52
|
+
output = `#{command} 2>&1`
|
53
|
+
raise output unless $?.success?
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def gem_version
|
58
|
+
require File.expand_path('../lib/cocoapods/gem_version.rb', __FILE__)
|
59
|
+
Pod::VERSION
|
60
|
+
end
|
61
|
+
|
62
|
+
def title(title)
|
63
|
+
cyan_title = "\033[0;36m#{title}\033[0m"
|
64
|
+
puts
|
65
|
+
puts "-" * 80
|
66
|
+
puts cyan_title
|
67
|
+
puts "-" * 80
|
68
|
+
puts
|
69
|
+
end
|
70
|
+
|
71
|
+
def red(string)
|
72
|
+
"\033[0;31m#{string}\e[0m"
|
73
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cocoapods_archive.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "cocoapods-archive"
|
8
|
+
spec.version = CocoapodsArchive::VERSION
|
9
|
+
spec.authors = ["Mickey Reiss"]
|
10
|
+
spec.email = ["mickey@venmo.com"]
|
11
|
+
spec.description = %q{"A CocoaPods plugin that enables you to archive your Pod as a static library"}
|
12
|
+
spec.summary = <<-EOF
|
13
|
+
|
14
|
+
Creates an archive containing everything one would need to integrate the CocoaPod in the current working directory without using CocoaPods:
|
15
|
+
|
16
|
+
- A `.a` static library
|
17
|
+
|
18
|
+
- A number of public `.h` headers
|
19
|
+
|
20
|
+
- An `.xcconfig` file with the appropriate integration configuration settings
|
21
|
+
|
22
|
+
- A README with integration instructions
|
23
|
+
|
24
|
+
This tool is useful if your primary distribution mechanism is CocoaPods but a significat portion of your userbase does not yet use dependency management. Instead, they receive a closed-source version with manual integration instructions.
|
25
|
+
EOF
|
26
|
+
spec.homepage = "https://github.com/braintreeps/cocoapods-archive"
|
27
|
+
spec.license = "MIT"
|
28
|
+
|
29
|
+
spec.files = `git ls-files`.split($/)
|
30
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
31
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
35
|
+
spec.add_development_dependency "rake"
|
36
|
+
spec.add_development_dependency "rspec"
|
37
|
+
end
|
@@ -0,0 +1,212 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'camelizable/string'
|
4
|
+
require 'cocoapods'
|
5
|
+
|
6
|
+
module Pod
|
7
|
+
class Command
|
8
|
+
class Lib
|
9
|
+
class Archive < Lib
|
10
|
+
using Camelizable
|
11
|
+
BUILD_ROOT = Pathname.new("/tmp/CocoaPods/Archive")
|
12
|
+
|
13
|
+
self.summary = "Archives your Pod as a static library"
|
14
|
+
|
15
|
+
self.description = <<-DESC
|
16
|
+
Creates an archive containing everything one would need to integrate the CocoaPod in the current working directory without using CocoaPods:
|
17
|
+
|
18
|
+
- A `.a` static library
|
19
|
+
|
20
|
+
- A number of public `.h` headers
|
21
|
+
|
22
|
+
- An `.xcconfig` file with the appropriate integration configuration settings
|
23
|
+
|
24
|
+
- A README with integration instructions
|
25
|
+
|
26
|
+
This tool is useful if your primary distribution mechanism is CocoaPods but a significat portion of your userbase does not yet use dependency management. Instead, they receive a closed-source version with manual integration instructions.
|
27
|
+
DESC
|
28
|
+
|
29
|
+
self.arguments = [
|
30
|
+
CLAide::Argument.new("[NAME]", :optional)
|
31
|
+
]
|
32
|
+
|
33
|
+
attr_accessor :spec
|
34
|
+
|
35
|
+
def initialize(argv)
|
36
|
+
@podspec_pathname = argv.shift_argument || Pathname.glob(Pathname.pwd + '*.podspec').first
|
37
|
+
super
|
38
|
+
end
|
39
|
+
|
40
|
+
def validate!
|
41
|
+
super
|
42
|
+
help! "Unable to find a podspec in the working directory" unless @podspec_pathname.try(:exist?)
|
43
|
+
end
|
44
|
+
|
45
|
+
def run
|
46
|
+
create_spec
|
47
|
+
|
48
|
+
UI.puts "Archiving #{spec.name} into #{BUILD_ROOT.to_s}"
|
49
|
+
|
50
|
+
create_sandbox
|
51
|
+
create_project
|
52
|
+
create_podfile
|
53
|
+
create_installer
|
54
|
+
@installer.install!
|
55
|
+
create_scheme
|
56
|
+
build_project
|
57
|
+
generate_readme
|
58
|
+
compress_project
|
59
|
+
|
60
|
+
UI.notice "Check #{output_pathname} for the compiled version of #{@spec.name}."
|
61
|
+
UI.notice "All Done 📬"
|
62
|
+
end
|
63
|
+
|
64
|
+
def create_spec
|
65
|
+
self.spec = Specification.from_file(@podspec_pathname)
|
66
|
+
end
|
67
|
+
|
68
|
+
def create_sandbox
|
69
|
+
FileUtils.rm_rf BUILD_ROOT if BUILD_ROOT.exist?
|
70
|
+
BUILD_ROOT.mkdir unless BUILD_ROOT.exist?
|
71
|
+
sandbox_pathname.mkdir
|
72
|
+
@sandbox = Sandbox.new(sandbox_pathname.to_s)
|
73
|
+
end
|
74
|
+
|
75
|
+
def create_project
|
76
|
+
@project = Xcodeproj::Project.new(@sandbox.project_path)
|
77
|
+
@project.save
|
78
|
+
@project
|
79
|
+
end
|
80
|
+
|
81
|
+
def create_podfile
|
82
|
+
podfile = {
|
83
|
+
"target_definitions" => [{
|
84
|
+
"name"=> spec.name,
|
85
|
+
"platform" => { "ios" => "7.1" },
|
86
|
+
"link_with_first_target" => true,
|
87
|
+
"user_project_path" => @sandbox.project_path,
|
88
|
+
"dependencies"=> [{ spec.name => [ { :path => @podspec_pathname.to_s } ] }]
|
89
|
+
}]
|
90
|
+
}
|
91
|
+
@podfile = Podfile.from_hash(podfile)
|
92
|
+
end
|
93
|
+
|
94
|
+
def create_installer
|
95
|
+
config.integrate_targets = false
|
96
|
+
@installer = Installer.new(@sandbox, @podfile)
|
97
|
+
@installer.update = false
|
98
|
+
@installer
|
99
|
+
end
|
100
|
+
|
101
|
+
def create_scheme
|
102
|
+
@scheme = Xcodeproj::XCScheme.new
|
103
|
+
@scheme.add_build_target(@installer.aggregate_targets.first.target, true)
|
104
|
+
@scheme.save_as(@sandbox.project_path, "Archive", true)
|
105
|
+
end
|
106
|
+
|
107
|
+
def build_project
|
108
|
+
output_pathname.mkdir
|
109
|
+
|
110
|
+
UI.message %x{cd #{@sandbox.root} && xcodebuild -sdk iphoneos && xcodebuild -sdk iphonesimulator}
|
111
|
+
platform_specific_static_libraries = Pathname.glob(@sandbox.root + "build" + "Release-*" + "**" + @installer.aggregate_targets.first.product_name)
|
112
|
+
UI.message %x{lipo -create #{platform_specific_static_libraries.join(" ")} -output #{output_static_library}}
|
113
|
+
UI.puts "Built static library file in #{output_pathname}"
|
114
|
+
|
115
|
+
headers = Pathname.glob(@spec.consumer(:ios).public_header_files)
|
116
|
+
headers.each do |header_pathname|
|
117
|
+
FileUtils.cp(header_pathname, output_pathname)
|
118
|
+
end
|
119
|
+
|
120
|
+
FileUtils.cp((sandbox_pathname + @installer.aggregate_targets.first.acknowledgements_basepath).to_path + ".markdown", output_pathname)
|
121
|
+
FileUtils.cp((sandbox_pathname + @installer.aggregate_targets.first.acknowledgements_basepath).to_path + ".plist", output_pathname)
|
122
|
+
|
123
|
+
FileUtils.cp((sandbox_pathname + @installer.aggregate_targets.first.xcconfig_path), output_pathname)
|
124
|
+
end
|
125
|
+
|
126
|
+
def generate_readme
|
127
|
+
readme = <<-EOF
|
128
|
+
# #{@spec.to_s}
|
129
|
+
|
130
|
+
This directory contains the [#{@spec.name}](#{@spec.homepage}) Pod compiled as a static library. Although CocoaPods is the recommended integration technique, you can use this package to vendor the library in your project statically.
|
131
|
+
|
132
|
+
## Manual Integration Instructions
|
133
|
+
|
134
|
+
1. Drag this folder into your Xcode Project.
|
135
|
+
2. Check the box next to your app's name under "Add to targets".
|
136
|
+
3. You may need to tweak your build settings, adding libraries, frameworks and custom build settings.
|
137
|
+
EOF
|
138
|
+
|
139
|
+
if @spec.consumer(:ios).frameworks.count > 0
|
140
|
+
readme << <<-EOF
|
141
|
+
|
142
|
+
* Add these frameworks:
|
143
|
+
|
144
|
+
```
|
145
|
+
#{@spec.consumer(:ios).frameworks.join("\n")}
|
146
|
+
```
|
147
|
+
EOF
|
148
|
+
end
|
149
|
+
|
150
|
+
if @spec.consumer(:ios).frameworks.count > 0
|
151
|
+
readme << <<-EOF
|
152
|
+
|
153
|
+
* Add these libraries:
|
154
|
+
|
155
|
+
```
|
156
|
+
#{@spec.consumer(:ios).libraries.join("\n")}
|
157
|
+
```
|
158
|
+
EOF
|
159
|
+
end
|
160
|
+
|
161
|
+
if @spec.consumer(:ios).xcconfig.count > 0
|
162
|
+
readme << <<-EOF
|
163
|
+
|
164
|
+
* Add these build settings:
|
165
|
+
|
166
|
+
```
|
167
|
+
#{@spec.consumer(:ios).xcconfig}
|
168
|
+
```
|
169
|
+
EOF
|
170
|
+
end
|
171
|
+
|
172
|
+
readme << <<-EOF
|
173
|
+
|
174
|
+
## CocoaPods Integration
|
175
|
+
|
176
|
+
If you'd like to use CocoaPods afterall, add this line to your `Podfile`:
|
177
|
+
|
178
|
+
```ruby
|
179
|
+
pod "#{@spec.name}"
|
180
|
+
```
|
181
|
+
|
182
|
+
## Note
|
183
|
+
|
184
|
+
This folder and README were generated by CocoaPods-Archive.
|
185
|
+
EOF
|
186
|
+
|
187
|
+
readme.strip!
|
188
|
+
|
189
|
+
(output_pathname + "README.md").write(readme)
|
190
|
+
end
|
191
|
+
|
192
|
+
def compress_project
|
193
|
+
UI.puts "Creating compressed archives"
|
194
|
+
UI.message %x{tar -cvzf "#{output_pathname.to_path + ".tar.gz"}" "#{output_pathname}" 2>&1}
|
195
|
+
UI.message %x{zip -r "#{output_pathname.to_path + ".zip"}" "#{output_pathname}" 2>&1}
|
196
|
+
end
|
197
|
+
|
198
|
+
def output_pathname
|
199
|
+
BUILD_ROOT + "#{spec.name}-#{spec.version}"
|
200
|
+
end
|
201
|
+
|
202
|
+
def sandbox_pathname
|
203
|
+
BUILD_ROOT + "sandbox"
|
204
|
+
end
|
205
|
+
|
206
|
+
def output_static_library
|
207
|
+
output_pathname + "lib#{spec.name.camelize}.a"
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'tmpdir'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
describe Command::Lib::Archive do
|
6
|
+
include SpecHelper::Command
|
7
|
+
|
8
|
+
it 'registers itself' do
|
9
|
+
expect(Command.parse(%w{ lib archive })).to be_instance_of(Command::Lib::Archive)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'shows help if no podspec is specified' do
|
13
|
+
expect { run_command('lib', 'archive') }.to raise_error(CLAide::Help)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'shows help if --help is specified' do
|
17
|
+
expect { run_command('lib', 'archive', '--help') }.to raise_error(CLAide::Help)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'shows an error if there is no podspec in the current working directory' do
|
21
|
+
Dir.mktmpdir do |empty_working_directory|
|
22
|
+
Dir.chdir(empty_working_directory) do
|
23
|
+
expect { run_command('lib', 'archive') }.to raise_error(CLAide::Help) { |error| expect(error.error_message).to eq('Unable to find a podspec in the working directory') }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'archives the specified Pod to the default destination' do
|
29
|
+
Dir.mktmpdir do |destination|
|
30
|
+
stub_const('Pod::Command::Lib::Archive::BUILD_ROOT', Pathname.new(destination))
|
31
|
+
Dir.chdir(SpecHelper::Fixture.default.path) do
|
32
|
+
|
33
|
+
run_command('lib', 'archive')
|
34
|
+
|
35
|
+
name = SpecHelper::Fixture.default.name
|
36
|
+
name_with_version = "#{name}-#{SpecHelper::Fixture.default.version}"
|
37
|
+
|
38
|
+
expect(Pathname.new(destination).entries.map(&:to_path)).to include("#{name_with_version}", "#{name_with_version}.tar.gz", "#{name_with_version}.zip")
|
39
|
+
|
40
|
+
@destination = destination
|
41
|
+
expect(Pathname.new(destination) + name_with_version + "lib#{name}.a").to exist
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,71 @@
|
|
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 'ostruct'
|
7
|
+
require 'bundler/setup'
|
8
|
+
require 'rspec'
|
9
|
+
require 'cocoapods'
|
10
|
+
|
11
|
+
require 'cocoapods_plugin'
|
12
|
+
|
13
|
+
module Pod
|
14
|
+
# Disable the wrapping so the output is deterministic in the tests.
|
15
|
+
#
|
16
|
+
UI.disable_wrap = true
|
17
|
+
|
18
|
+
# Redirects the messages to an internal store.
|
19
|
+
#
|
20
|
+
module UI
|
21
|
+
@output = ''
|
22
|
+
@warnings = ''
|
23
|
+
|
24
|
+
class << self
|
25
|
+
attr_accessor :output
|
26
|
+
attr_accessor :warnings
|
27
|
+
|
28
|
+
def puts(message = '')
|
29
|
+
@output << "#{message}\n"
|
30
|
+
end
|
31
|
+
|
32
|
+
def warn(message = '', actions = [])
|
33
|
+
@warnings << "#{message}\n"
|
34
|
+
end
|
35
|
+
|
36
|
+
def print(message)
|
37
|
+
@output << message
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
module SpecHelper
|
44
|
+
module Command
|
45
|
+
def argv(*argv)
|
46
|
+
CLAide::ARGV.new(argv)
|
47
|
+
end
|
48
|
+
|
49
|
+
def command(*argv)
|
50
|
+
argv << '--no-ansi'
|
51
|
+
Pod::Command.parse(argv)
|
52
|
+
end
|
53
|
+
|
54
|
+
def run_command(*args)
|
55
|
+
cmd = command(*args)
|
56
|
+
cmd.validate!
|
57
|
+
cmd.run
|
58
|
+
Pod::UI.output
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
module Fixture
|
63
|
+
def self.default
|
64
|
+
OpenStruct.new(
|
65
|
+
name: "AFNetworking",
|
66
|
+
version: "2.3.1",
|
67
|
+
path: "spec/fixtures/AFNetworking",
|
68
|
+
)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'camelizable/string'
|
2
|
+
|
3
|
+
using Camelizable
|
4
|
+
|
5
|
+
describe Camelizable do
|
6
|
+
describe '#camelize' do
|
7
|
+
it 'should camlelize a string' do
|
8
|
+
expect('FooBar'.camelize).to eq('FooBar')
|
9
|
+
expect('foo bar'.camelize).to eq('FooBar')
|
10
|
+
expect('foo-bar'.camelize).to eq('FooBar')
|
11
|
+
expect('foo_bar'.camelize).to eq('FooBar')
|
12
|
+
expect('Foo bar'.camelize).to eq('FooBar')
|
13
|
+
expect('foo Bar'.camelize).to eq('FooBar')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
require 'pod/command/lib/archive'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
describe Command::Lib::Archive do
|
6
|
+
describe '#output_static_library' do
|
7
|
+
it 'returns a static .a path name based on the spec name' do
|
8
|
+
archive = Command::Lib::Archive.new(CLAide::ARGV.new(%w(some-pod)))
|
9
|
+
|
10
|
+
allow(archive).to receive(:spec).and_return(OpenStruct.new(name: 'some-pod', version: '1.2.1'))
|
11
|
+
|
12
|
+
expect(archive.output_static_library.to_s).to eq('/tmp/CocoaPods/Archive/some-pod-1.2.1/libSomePod.a')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#sandbox_pathname' do
|
17
|
+
it 'returns a static .a path name based on the spec name' do
|
18
|
+
archive = Command::Lib::Archive.new(CLAide::ARGV.new(%w(some-pod)))
|
19
|
+
|
20
|
+
allow(archive).to receive(:spec).and_return(OpenStruct.new(name: 'some-pod'))
|
21
|
+
|
22
|
+
expect(archive.sandbox_pathname.to_s).to eq('/tmp/CocoaPods/Archive/sandbox')
|
23
|
+
end
|
24
|
+
|
25
|
+
describe 'BUILD_ROOT' do
|
26
|
+
it 'uses /tmp/CocoaPods/Archive as a default destination' do
|
27
|
+
expect(Command::Lib::Archive::BUILD_ROOT.to_path).to eq('/tmp/CocoaPods/Archive')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-archive
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mickey Reiss
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-18 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
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: '"A CocoaPods plugin that enables you to archive your Pod as a static
|
56
|
+
library"'
|
57
|
+
email:
|
58
|
+
- mickey@venmo.com
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".gitmodules"
|
65
|
+
- ".travis.yml"
|
66
|
+
- Gemfile
|
67
|
+
- Gemfile.lock
|
68
|
+
- LICENSE.txt
|
69
|
+
- README.md
|
70
|
+
- Rakefile
|
71
|
+
- cocoapods_archive.gemspec
|
72
|
+
- lib/camelizable/string.rb
|
73
|
+
- lib/cocoapods_archive.rb
|
74
|
+
- lib/cocoapods_plugin.rb
|
75
|
+
- lib/pod/command/lib/archive.rb
|
76
|
+
- spec/functional/cocoapods-archive_spec.rb
|
77
|
+
- spec/spec_helper.rb
|
78
|
+
- spec/unit/camelizable/string_spec.rb
|
79
|
+
- spec/unit/pod/command/lib/archive_spec.rb
|
80
|
+
homepage: https://github.com/braintreeps/cocoapods-archive
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
requirements: []
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 2.2.2
|
101
|
+
signing_key:
|
102
|
+
specification_version: 4
|
103
|
+
summary: 'Creates an archive containing everything one would need to integrate the
|
104
|
+
CocoaPod in the current working directory without using CocoaPods: - A `.a` static
|
105
|
+
library - A number of public `.h` headers - An `.xcconfig` file with the appropriate
|
106
|
+
integration configuration settings - A README with integration instructions This
|
107
|
+
tool is useful if your primary distribution mechanism is CocoaPods but a significat
|
108
|
+
portion of your userbase does not yet use dependency management. Instead, they receive
|
109
|
+
a closed-source version with manual integration instructions.'
|
110
|
+
test_files:
|
111
|
+
- spec/functional/cocoapods-archive_spec.rb
|
112
|
+
- spec/spec_helper.rb
|
113
|
+
- spec/unit/camelizable/string_spec.rb
|
114
|
+
- spec/unit/pod/command/lib/archive_spec.rb
|