Skip to content

Commit

Permalink
Do not delete resource bundles when packaging.
Browse files Browse the repository at this point in the history
Fixes #34.
  • Loading branch information
neonichu committed Sep 18, 2014
1 parent 5853170 commit 69ede68
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/cocoapods-packager/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,18 @@ def copy_license
end

def copy_resources(platform)
bundles = Dir.glob("#{@sandbox_root}/build/*.bundle")
`cp -rp #{@sandbox_root}/build/*.bundle #{@fwk.resources_path} 2>&1`

resources = expand_paths(@spec.consumer(platform).resources)
if resources.count == 0
if resources.count == 0 && bundles.count == 0
@fwk.delete_resources
return
end
`cp -rp #{resources.join(' ')} #{@fwk.resources_path}`

if resources.count > 0
`cp -rp #{resources.join(' ')} #{@fwk.resources_path}`
end
end

def create_framework(platform)
Expand Down
9 changes: 9 additions & 0 deletions spec/command/error_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Pod
after do
Dir.glob("CPDColors-*").each { |dir| Pathname.new(dir).rmtree }
Dir.glob("layer-client-messaging-schema-*").each { |dir| Pathname.new(dir).rmtree }
Dir.glob("OpenSans-*").each { |dir| Pathname.new(dir).rmtree }
end

it 'presents the help if a directory is provided' do
Expand Down Expand Up @@ -39,5 +40,13 @@ module Pod

true.should == true # To make the test pass without any shoulds
end

it 'can package a podspec with resource bundles' do
command = Command.parse(%w{ package spec/fixtures/OpenSans.podspec })
command.run

bundles = Dir.glob('OpenSans-*/ios/OpenSans.framework/Versions/A/Resources/*.bundle')
bundles.count.should == 1
end
end
end
18 changes: 18 additions & 0 deletions spec/fixtures/OpenSans.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Pod::Spec.new do |spec|
spec.name = 'OpenSans'
spec.version = '1.0.3'
spec.summary = 'A podspec encapsulating OpenSans font for iOS'
spec.description = "Open Sans is a humanist sans serif typeface designed by Steve Matteson, Type Director of Ascender Corp. This version contains the complete 897 character set, which includes the standard ISO Latin 1, Latin CE, Greek and Cyrillic character sets. Open Sans was designed with an upright stress, open forms and a neutral, yet friendly appearance. It was optimized for print, web, and mobile interfaces, and has excellent legibility characteristics in its letterforms."
spec.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE.txt' }
spec.authors = { 'Kyle Fuller' => 'inbox@kylefuller.co.uk' }
spec.homepage = 'https://github.com/CocoaPods-Fonts/OpenSans'
spec.screenshot = 'http://f.cl.ly/items/2t2F032e3W0h2T1i0j1n/opensans-ios7-iphone5.png'
spec.social_media_url = 'https://twitter.com/kylefuller'
spec.platform = :ios
spec.source = { :git => 'https://github.com/CocoaPods-Fonts/OpenSans.git', :tag => spec.version.to_s }
spec.source_files = 'UIFont+OpenSans.{h,m}'
spec.resource_bundle = { 'OpenSans' => 'Fonts/*.ttf' }
spec.frameworks = 'UIKit', 'CoreText'
spec.requires_arc = true
end

0 comments on commit 69ede68

Please sign in to comment.