Created
May 27, 2015 18:47
-
-
Save neonichu/e7d761c8293b62536176 to your computer and use it in GitHub Desktop.
Do a development Pod install and archive the corresponding framework via Carthage automatically.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'cocoapods' | |
require 'fileutils' | |
def podfile_from_spec(spec) | |
podfile = File.open('Podfile', 'w') | |
podfile.write(<<-EOF | |
platform :ios, '8.0' | |
use_frameworks! | |
EOF | |
) | |
spec.available_platforms.each do |platform| | |
podfile.write(<<-EOF | |
target '#{platform.name}' do | |
platform :#{platform.name}, '#{platform.deployment_target}' | |
pod '#{spec.name}', :path => '..' | |
end | |
EOF | |
) | |
end | |
podfile.close | |
end | |
TMPDIR = 'Zama'.freeze | |
spec = Pod::Specification.from_file(Dir.glob("*.podspec").first) | |
FileUtils.mkdir_p(TMPDIR) | |
Dir.chdir(TMPDIR) do | |
podfile_from_spec(spec) | |
puts `pod install --no-repo-update --no-integrate` | |
FileUtils.ln_sf('Pods/Pods.xcodeproj', '_.xcodeproj') | |
puts `carthage build --no-skip-current` | |
frameworks = Dir.glob('Carthage/**/*.framework').map { |f| Pathname.new(f).basename.sub_ext('') }.uniq | |
frameworks.each do |framework| | |
puts `carthage archive #{framework}` | |
FileUtils.mv("#{framework}.framework.zip", '..') | |
end | |
end | |
FileUtils.rm_rf(TMPDIR) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use
Pod::Executable
instead of backticks