Commit bc9ee744 authored by Francis Chong's avatar Francis Chong

add a dummy source file to Pod, so that in case no source files presented, the…

add a dummy source file to Pod, so that in case no source files presented, the pod lib would still compile
parent f9e77af9
......@@ -30,6 +30,7 @@ module Pod
autoload :BridgeSupport, 'cocoapods/generator/bridge_support'
autoload :CopyResourcesScript, 'cocoapods/generator/copy_resources_script'
autoload :Documentation, 'cocoapods/generator/documentation'
autoload :DummySource, 'cocoapods/generator/dummy_source'
end
end
......
module Pod
module Generator
class DummySource
def initialize(label)
@label = label
end
def save_as(pathname)
pathname.open('w') do |source|
source.puts "@interface #{@label}Dummy : NSObject"
source.puts "@end"
source.puts "@implementation #{@label}Dummy"
source.puts "@end"
end
end
end
end
end
......@@ -75,11 +75,11 @@ module Pod
support_files_group = @project.group("Targets Support Files").create_group(@target_definition.label)
support_files_group.create_files(target_support_files)
xcconfig_file = support_files_group.files.where(:path => @target_definition.xcconfig_name)
configure_build_configurations(xcconfig_file)
create_files(pods, sandbox)
@target.add_source_file(Pathname.new(@target_definition.dummy_source_name))
end
def configure_build_configurations(xcconfig_file)
......@@ -104,6 +104,8 @@ module Pod
save_prefix_header_as(sandbox.root + @target_definition.prefix_header_name, pods)
puts "* Generating copy resources script at `#{sandbox.root + @target_definition.copy_resources_script_name}'" if config.verbose?
copy_resources_script_for(pods).save_as(sandbox.root + @target_definition.copy_resources_script_name)
puts "* Generating dummy source at `#{sandbox.root + @target_definition.dummy_source_name}'" if config.verbose?
Generator::DummySource.new(@target_definition.label).save_as(Pathname.new(sandbox.root + @target_definition.dummy_source_name))
end
private
......
......@@ -94,6 +94,10 @@ module Pod
def prefix_header_name
"#{label}-prefix.pch"
end
def dummy_source_name
"#{label}Dummy.m"
end
def bridge_support_name
"#{label}.bridgesupport"
......
......@@ -118,6 +118,24 @@ else
'DEPENDENCIES' => ["Reachability (from `#{url}')"]
}
end
it "install a dummy source file" do
url = 'https://raw.github.com/gist/1349824/3ec6aa60c19113573fc48eac19d0fafd6a69e033/Reachability.podspec'
podfile = Pod::Podfile.new do
self.platform :ios
xcodeproj 'dummy'
dependency do |s|
s.name = 'JSONKit'
s.version = '1.2'
s.source = { :git => SpecHelper.fixture('integration/JSONKit').to_s, :tag => 'v1.2' }
s.source_files = 'JSONKit.*'
end
end
installer = SpecHelper::Installer.new(podfile)
installer.install!
end
it "installs a library with a podspec defined inline" do
podfile = Pod::Podfile.new do
......
require File.expand_path('../../../spec_helper', __FILE__)
describe Pod::Generator::DummySource do
it "generates a dummy sourcefile with the appropriate class"
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment