Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: CocoaPods/CocoaPods
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.9.1
Choose a base ref
...
head repository: CocoaPods/CocoaPods
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.9.2
Choose a head ref
  • 8 commits
  • 11 files changed
  • 5 contributors

Commits on Jul 14, 2012

  1. When generating the PodsDummy class, make that class unique to each t…

    …arget by using the Target Definition's label.
    dlvenable committed Jul 14, 2012
    Copy the full SHA
    c3d1e83 View commit details

Commits on Jul 15, 2012

  1. Copy the full SHA
    695509f View commit details
  2. Merge pull request #402 from dlvenable/unique-dummy

    Make PodsDummy class unique to each target
    alloy committed Jul 15, 2012
    Copy the full SHA
    09ebfb1 View commit details
  3. Merge pull request #403 from siuying/validate_platform

    raise informative error message when user supplied invalid platform
    siuying committed Jul 15, 2012
    Copy the full SHA
    cae31b0 View commit details

Commits on Jul 16, 2012

  1. Copy the full SHA
    99cd1a5 View commit details
  2. Update bundle.

    alloy committed Jul 16, 2012
    Copy the full SHA
    9aa88e0 View commit details
  3. [CHANGELOG] Update for 0.9.2

    alloy committed Jul 16, 2012
    Copy the full SHA
    ca0d363 View commit details
  4. Release 0.9.2

    alloy committed Jul 16, 2012
    Copy the full SHA
    0920c42 View commit details
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## 0.9.2

[CocoaPods](http://git.io/AVlRKg)[Xcodeproj](http://git.io/xHbc0w)

###### Bug fixes

- When generating the PodsDummy class, make that class unique to each target. [#402](http://git.io/NntYiQ)
- Raise an informative error message when the platform in the `Podfile` is omitted or incorrect. [#403](http://git.io/k5EcUQ)


## 0.9.1

[CocoaPods](http://git.io/_kqAbw)

###### Bug fixes

- CocoaPods 0.9.x needs Xcodeproj 0.3.0.


## 0.9.0

[CocoaPods](http://git.io/kucJQw)[Xcodeproj](http://git.io/5eLL8g)
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
GIT
remote: git://github.com/CocoaPods/Xcodeproj.git
revision: d7806ab0513b90d7f285a4af78e7bf19e4fb1481
revision: e5e7bdf8acb0363042adc78feca8d6136950f7d7
specs:
xcodeproj (0.3.0)
xcodeproj (0.3.1)
activesupport (~> 3.2.6)

PATH
remote: .
specs:
cocoapods (0.9.0)
cocoapods (0.9.1)
activesupport (~> 3.2.6)
colored (~> 1.2)
escape (~> 0.0.4)
2 changes: 1 addition & 1 deletion lib/cocoapods.rb
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
end

module Pod
VERSION = '0.9.1'
VERSION = '0.9.2'

class PlainInformative < StandardError
end
2 changes: 1 addition & 1 deletion lib/cocoapods/command/spec.rb
Original file line number Diff line number Diff line change
@@ -257,7 +257,7 @@ def podfile_from_spec
podspec = file.realpath.to_s
platform = @platform
podfile = Pod::Podfile.new do
platform(platform)
platform(platform.to_sym, platform.deployment_target)
pod name, :podspec => podspec
end
podfile
11 changes: 9 additions & 2 deletions lib/cocoapods/generator/dummy_source.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
module Pod
module Generator
class DummySource
attr_reader :class_name

def initialize(class_name_identifier)
validated_class_name_identifier = class_name_identifier.gsub(/[^0-9a-z_]/i, '_')
@class_name = "PodsDummy_#{validated_class_name_identifier}"
end

def save_as(pathname)
pathname.open('w') do |source|
source.puts "@interface PodsDummy : NSObject"
source.puts "@interface #{class_name} : NSObject"
source.puts "@end"
source.puts "@implementation PodsDummy"
source.puts "@implementation #{class_name}"
source.puts "@end"
end
end
14 changes: 7 additions & 7 deletions lib/cocoapods/installer.rb
Original file line number Diff line number Diff line change
@@ -107,10 +107,10 @@ def install!
acknowledgements_path = target_installer.target_definition.acknowledgements_path
Generator::Acknowledgements.new(target_installer.target_definition,
pods_for_target).save_as(acknowledgements_path)
generate_dummy_source(target_installer)
end

generate_lock_file!(specifications)
generate_dummy_source

puts "- Running post install hooks" if config.verbose?
# Post install hooks run _before_ saving of project, so that they can alter it before saving.
@@ -172,17 +172,17 @@ def generate_lock_file!(specs)
end
end

def generate_dummy_source
filename = "PodsDummy.m"
def generate_dummy_source(target_installer)
class_name_identifier = target_installer.target_definition.label
dummy_source = Generator::DummySource.new(class_name_identifier)
filename = "#{dummy_source.class_name}.m"
pathname = Pathname.new(sandbox.root + filename)
Generator::DummySource.new.save_as(pathname)
dummy_source.save_as(pathname)

project_file = project.files.new('path' => filename)
project.group("Targets Support Files") << project_file

target_installers.each do |target_installer|
target_installer.target.source_build_phases.first << project_file
end
target_installer.target.source_build_phases.first << project_file
end

def specs_by_target
2 changes: 2 additions & 0 deletions lib/cocoapods/podfile.rb
Original file line number Diff line number Diff line change
@@ -199,6 +199,8 @@ def platform(name, target = nil)
target = '4.3'
when :osx
target = '10.6'
else
raise Informative, "Unsupported platform: platform must be one of [:ios, :osx]"
end
end
@target_definition.platform = Platform.new(name, target)
27 changes: 25 additions & 2 deletions spec/integration_spec.rb
Original file line number Diff line number Diff line change
@@ -114,8 +114,31 @@ def should_xcodebuild(target_definition)
installer = SpecHelper::Installer.new(podfile)
installer.install!

dummy = (config.project_pods_root + 'PodsDummy.m').read
dummy.should.include?('@implementation PodsDummy')
dummy = (config.project_pods_root + 'PodsDummy_Pods.m').read
dummy.should.include?('@implementation PodsDummy_Pods')
end

it "installs a dummy source file unique to the target" do
create_config!
podfile = Pod::Podfile.new do
self.platform :ios
xcodeproj 'dummy'
pod 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
target :AnotherTarget do
pod 'ASIHTTPRequest'
end
end

installer = SpecHelper::Installer.new(podfile)
installer.install!

dummy = (config.project_pods_root + 'PodsDummy_Pods_AnotherTarget.m').read
dummy.should.include?('@implementation PodsDummy_Pods_AnotherTarget')
end

it "installs a library with a podspec defined inline" do
4 changes: 2 additions & 2 deletions spec/unit/command/spec_spec.rb
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ def stub_podspec(pattern = nil, replacement = nil)
linter.warnings.should.not.be.empty
end

it "validates in lenient mode if there are no erros but there are warnings" do
it "validates in lenient mode if there are no errors but there are warnings" do
spec, file = write_podspec(stub_podspec(/.*license.*/, ""))
linter = Pod::Command::Spec::Linter.new(spec)
linter.lenient, linter.quick = true, true
@@ -107,7 +107,7 @@ def stub_podspec(pattern = nil, replacement = nil)
linter.errors.join(' | ').should.include "The resources did not match any file"
end

it "Uses the deployment target of the specification" do
it "uses the deployment target of the specification" do
spec, file = write_podspec(stub_podspec)
spec.stubs(:available_platforms).returns([Pod::Platform.new(:ios, "5.0")])
linter = Pod::Command::Spec::Linter.new(spec)
21 changes: 17 additions & 4 deletions spec/unit/generator/dummy_source_spec.rb
Original file line number Diff line number Diff line change
@@ -11,15 +11,28 @@
teardown_temporary_directory
end

it "generates a dummy sourcefile with the appropriate class" do
generator = Pod::Generator::DummySource.new
it "generates a dummy sourcefile with the appropriate class for the class name identifier" do
generator = Pod::Generator::DummySource.new('SomeIdentification')
file = temporary_directory + 'PodsDummy.m'
generator.save_as(file)
file.read.should == <<-EOS
@interface PodsDummy : NSObject
@interface PodsDummy_SomeIdentification : NSObject
@end
@implementation PodsDummy
@implementation PodsDummy_SomeIdentification
@end
EOS
end

it "generates a dummy sourcefile with the appropriate class, replacing non-alphanumeric characters with underscores" do
generator = Pod::Generator::DummySource.new('This!has_non-alphanumeric+characters in it.0123456789')
file = temporary_directory + 'PodsDummy.m'
generator.save_as(file)
file.read.should == <<-EOS
@interface PodsDummy_This_has_non_alphanumeric_characters_in_it_0123456789 : NSObject
@end
@implementation PodsDummy_This_has_non_alphanumeric_characters_in_it_0123456789
@end
EOS
end

end
6 changes: 6 additions & 0 deletions spec/unit/podfile_spec.rb
Original file line number Diff line number Diff line change
@@ -16,6 +16,12 @@
podfile.target_definitions[:default].platform.deployment_target.should == Pod::Version.new('4.3')
end

it "raise error if unsupported platform is supplied" do
lambda {
Pod::Podfile.new { platform :iOS }
}.should.raise(StandardError, "Unsupported platform")
end

it "adds dependencies" do
podfile = Pod::Podfile.new { pod 'ASIHTTPRequest'; pod 'SSZipArchive', '>= 0.1' }
podfile.dependencies.size.should == 2