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.6.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.7.0
Choose a head ref

Commits on May 21, 2012

  1. Unverified

    No user is associated with the committer email.
    Copy the full SHA
    5e3f797 View commit details
  2. [fix] small syntax error

    Sam Stewart committed May 21, 2012

    Unverified

    No user is associated with the committer email.
    Copy the full SHA
    2408e99 View commit details

Commits on Jun 26, 2012

  1. [fix] unit tests now passing

    Sam Stewart committed Jun 26, 2012

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    19ed7d8 View commit details
  2. Copy the full SHA
    4f92cc8 View commit details

Commits on Jul 2, 2012

  1. Copy the full SHA
    8bac42c View commit details
  2. Copy the full SHA
    366a98f View commit details

Commits on Jul 3, 2012

  1. Copy the full SHA
    439a791 View commit details
  2. Copy the full SHA
    a21d1e7 View commit details
  3. Copy the full SHA
    1fd90d2 View commit details
  4. [Spec#lint] Fix.

    fabiopelosin committed Jul 3, 2012
    Copy the full SHA
    81c1043 View commit details
  5. Array#flatten! returns nil if no modifications were made (i.e., array…

    … contains no subarrays.)
    
    
    We probably want just `flatten` rather than `flatten!`
    Jaym3s committed Jul 3, 2012
    Copy the full SHA
    8e9d2e9 View commit details
  6. Merge pull request #367 from Jaym3s/patch-1

    Array#flatten! returns nil if no modifications were made
    fabiopelosin committed Jul 3, 2012
    Copy the full SHA
    53ac9ff View commit details
  7. Copy the full SHA
    d95a27f View commit details
  8. Copy the full SHA
    aa1bea9 View commit details
  9. Copy the full SHA
    4b3756f View commit details
  10. Copy the full SHA
    b00b6e2 View commit details

Commits on Jul 4, 2012

  1. Copy the full SHA
    e42c614 View commit details
  2. Copy the full SHA
    63c5e45 View commit details
  3. Copy the full SHA
    449c64f View commit details
  4. Copy the full SHA
    c832f39 View commit details
  5. Copy the full SHA
    a64b8e2 View commit details
  6. Merge pull request #373 from jinthagerman/develop

    Handle extraction paths with spaces for http sources
    fabiopelosin committed Jul 4, 2012
    Copy the full SHA
    a90159d View commit details

Commits on Jul 6, 2012

  1. Merge branch 'develop' of github.com:CocoaPods/CocoaPods into develop

    * 'develop' of github.com:CocoaPods/CocoaPods:
      Handle extraction paths with spaces
    fabiopelosin committed Jul 6, 2012
    Copy the full SHA
    86f6424 View commit details
  2. Merge branch 'master' of https://github.com/playhaven/CocoaPods into …

    …playhaven-master
    
    * 'master' of https://github.com/playhaven/CocoaPods:
      [tweak] remove .to_a method since unnecessary with splat operator
      [fix] unit tests now passing
      [fix] small syntax error
      [add] ability to specify :branch in Podfiles and Podspecs
    
    Conflicts:
    	.gitignore
    	lib/cocoapods/downloader/git.rb
    	spec/fixtures/banana-lib.tar.gz
    	spec/functional/downloader_spec.rb
    fabiopelosin committed Jul 6, 2012
    Copy the full SHA
    b8e1080 View commit details
  3. 5
    Copy the full SHA
    f70d430 View commit details
  4. Copy the full SHA
    f3b6186 View commit details
  5. Update develop

    fabiopelosin committed Jul 6, 2012
    Copy the full SHA
    874a0ca View commit details
  6. Merge pull request #372 from CocoaPods/spec-heredocs

    Spec heredocs
    fabiopelosin committed Jul 6, 2012
    Copy the full SHA
    15a4276 View commit details
  7. Copy the full SHA
    1e50349 View commit details
  8. Copy the full SHA
    bf7faa8 View commit details
  9. Copy the full SHA
    bf956df View commit details
  10. [Specs] Minor fix.

    fabiopelosin committed Jul 6, 2012
    Copy the full SHA
    ef7dd7e View commit details
  11. Copy the full SHA
    a02cf0e View commit details
  12. Copy the full SHA
    5a0a496 View commit details
  13. Merge branch 'master' of github.com:CocoaPods/CocoaPods into develop

    * 'master' of github.com:CocoaPods/CocoaPods:
      Array#flatten! returns nil if no modifications were made (i.e., array contains no subarrays.)
    fabiopelosin committed Jul 6, 2012
    Copy the full SHA
    6318a0a View commit details
  14. Copy the full SHA
    26fb824 View commit details
  15. Merge branch 'develop' of github.com:CocoaPods/CocoaPods into develop

    * 'develop' of github.com:CocoaPods/CocoaPods:
      [Rakefile] Release from develop branch.
    
    Conflicts:
    	Rakefile
    fabiopelosin committed Jul 6, 2012
    Copy the full SHA
    84fccd6 View commit details
  16. Copy the full SHA
    cc14bd8 View commit details
  17. Release 0.7.0

    fabiopelosin committed Jul 6, 2012
    Copy the full SHA
    ae87f69 View commit details
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
## 0.7.0 (unreleased)

[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.6.1...develop) | [XcodeProj](https://github.com/CocoaPods/XcodeProj/compare/0.2.1...develop)

###### Features

- Added support for branches in git repos.
- Added support for linting remote files, i.e. `pod spec lint http://raw/file.podspec`.
- Improved `Spec create template`
- The indentation is automatically stripped for podspecs strings.

###### Bug fixes

- The default warnings of Xcode are not overriden anymore.
- Improvements to the detection of the license files.
- Improvements to `pod spec lint`.
- CocoaPods is now case insensitive.


## 0.6.1

[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.6.0...0.6.1) | [XcodeProj](https://github.com/CocoaPods/XcodeProj/compare/0.2.0...0.2.1)

###### Bug fixes

- Switched to master branch for specs repo.
- Fixed a crash with `pod spec lint` related to `preserve_paths`.
- Fixed a bug that caused subspecs to not inherit the compiler flags of the top level specification.
- Fixed a bug that caused duplication of system framworks.


## 0.6.0

A full list of all the changes since 0.5.1 can be found [here][6].
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ gemspec
group :development do
gem "xcodeproj", :git => "git://github.com/CocoaPods/Xcodeproj.git", :branch => "develop"

gem "mocha", "~> 0.11.4"
gem "bacon"
gem "kicker"
gem "mocha-on-bacon"
16 changes: 11 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
GIT
remote: git://github.com/CocoaPods/Xcodeproj.git
revision: 4042ea00c560f806807bc0a8ad2a8761102d40d8
revision: afbbabf609322db2069c9b0a5f603c9c31cf66fc
branch: develop
specs:
xcodeproj (0.2.1)
xcodeproj (0.2.2)

PATH
remote: .
specs:
cocoapods (0.6.1)
cocoapods (0.7.0)
activesupport (~> 3.2.6)
colored (~> 1.2)
escape (~> 0.0.4)
faraday (~> 0.8.1)
json (~> 1.7.3)
octokit (~> 1.7.0)
open4 (~> 1.3.0)
rake (~> 0.9.0)
xcodeproj (~> 0.2.1)
xcodeproj (~> 0.2.2)

GEM
remote: http://rubygems.org/
specs:
activesupport (3.2.6)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.2.8)
awesome_print (1.0.2)
bacon (1.1.0)
@@ -35,8 +39,9 @@ GEM
ffi (1.0.11)
github-markup (0.7.2)
hashie (1.2.0)
i18n (0.6.0)
json (1.7.3)
kicker (2.6.0)
kicker (2.6.1)
listen
listen (0.4.7)
rb-fchange (~> 0.0.5)
@@ -84,6 +89,7 @@ DEPENDENCIES
cocoapods!
github-markup
kicker
mocha (~> 0.11.4)
mocha-on-bacon
pry
rake
15 changes: 11 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -79,8 +79,8 @@ namespace :gem do
task :release do

unless ENV['SKIP_CHECKS']
if `git symbolic-ref HEAD 2>/dev/null`.strip.split('/').last != 'master'
$stderr.puts "[!] You need to be on the `master' branch in order to be able to do a release."
if `git symbolic-ref HEAD 2>/dev/null`.strip.split('/').last != 'develop'
$stderr.puts "[!] You need to be on the `develop' branch in order to be able to do a release."
exit 1
end

@@ -99,7 +99,7 @@ namespace :gem do
exit 1
end

if diff_lines != ['Gemfile.lock', 'lib/cocoapods.rb']
if diff_lines != ['lib/cocoapods.rb']
$stderr.puts "[!] Only change the version number in a release commit!"
exit 1
end
@@ -138,8 +138,15 @@ namespace :gem do
# ENV['FROM_GEM'] = '1'
# silent_sh "rake examples:build"

# Ensure that the branches are up to date with the remote
sh "git pull"

# Then release
sh "git commit Gemfile.lock lib/cocoapods.rb -m 'Release #{gem_version}'"
sh "git commit lib/cocoapods.rb -m 'Release #{gem_version}'"
sh "git push origin develop"
sh "git checkout master"
sh "git pull"
sh "git merge develop -m 'Release #{gem_version}'"
sh "git tag -a #{gem_version} -m 'Release #{gem_version}'"
sh "git push origin master"
sh "git push origin --tags"
19 changes: 10 additions & 9 deletions cocoapods.gemspec
Original file line number Diff line number Diff line change
@@ -25,15 +25,16 @@ Gem::Specification.new do |s|
s.executables = %w{ pod }
s.require_paths = %w{ lib }

s.add_runtime_dependency 'faraday', '~> 0.8.1'
s.add_runtime_dependency 'octokit', '~> 1.7.0'

s.add_runtime_dependency 'colored', '~> 1.2'
s.add_runtime_dependency 'escape', '~> 0.0.4'
s.add_runtime_dependency 'json', '~> 1.7.3'
s.add_runtime_dependency 'open4', '~> 1.3.0'
s.add_runtime_dependency 'rake', '~> 0.9.0'
s.add_runtime_dependency 'xcodeproj', '~> 0.2.1'
s.add_runtime_dependency 'faraday', '~> 0.8.1'
s.add_runtime_dependency 'octokit', '~> 1.7.0'

s.add_runtime_dependency 'colored', '~> 1.2'
s.add_runtime_dependency 'escape', '~> 0.0.4'
s.add_runtime_dependency 'json', '~> 1.7.3'
s.add_runtime_dependency 'open4', '~> 1.3.0'
s.add_runtime_dependency 'rake', '~> 0.9.0'
s.add_runtime_dependency 'xcodeproj', '~> 0.2.2'
s.add_runtime_dependency 'activesupport', '~> 3.2.6'

s.add_development_dependency 'bacon', '~> 1.1'

2 changes: 1 addition & 1 deletion lib/cocoapods.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Pod
VERSION = '0.6.1'
VERSION = '0.7.0'

class PlainInformative < StandardError
end
17 changes: 10 additions & 7 deletions lib/cocoapods/command/push.rb
Original file line number Diff line number Diff line change
@@ -6,11 +6,11 @@ class Push < Command
def self.banner
%{Pushing new specifications to a spec-repo:
$ pod push [REPO]
$ pod push REPO [NAME.podspec]
Validates `*.podspec' in the current working dir, updates
the local copy of the repository named REPO, adds specifications
to REPO, and finally it pushes REPO to its remote.}
Validates NAME.podspec or `*.podspec' in the current working dir, updates
the local copy of the repository named REPO, adds the specifications
to the REPO, and finally it pushes REPO to its remote.}
end

def self.options
@@ -23,6 +23,7 @@ def self.options
def initialize(argv)
@allow_warnings = argv.option('--allow-warnings')
@repo = argv.shift_argument
@podspec = argv.shift_argument
super unless argv.empty? && @repo
end

@@ -61,7 +62,7 @@ def check_repo_status
end

def podspec_files
files = Pathname.glob("*.podspec")
files = Pathname.glob(@podspec || "*.podspec")
raise Informative, "[!] Couldn't find .podspec file in current directory".red if files.empty?
files
end
@@ -71,8 +72,10 @@ def validate_podspec_files
lint_argv = ["lint"]
lint_argv << "--only-errors" if @allow_warnings
lint_argv << "--silent" if config.silent
lint_argv += podspec_files.map(&:to_s)
all_valid = Spec.new(ARGV.new(lint_argv)).run
all_valid = true
podspec_files.each do |podspec|
Spec.new(ARGV.new(lint_argv + [podspec.to_s])).run
end
end

def add_specs_to_repo
60 changes: 48 additions & 12 deletions lib/cocoapods/command/spec.rb
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ def self.banner
Creates a PodSpec, in the current working dir, called `NAME.podspec'.
If a GitHub url is passed the spec is prepopulated.
$ pod spec lint [ NAME.podspec | DIRECTORY ]
$ pod spec lint [ NAME.podspec | DIRECTORY | http://PATH/NAME.podspec ]
Validates `NAME.podspec'. If a directory is provided it performs a quick
validation on all the podspec files found, including subfolders. In case
@@ -80,6 +80,7 @@ def lint
else
raise Informative, count == 1 ? "The spec did not pass validation." : "#{invalid_count} out of #{count} specs failed validation."
end
podspecs_tmp_dir.rmtree if podspecs_tmp_dir.exist?
end

private
@@ -130,6 +131,16 @@ def print_messages(spec, type, messages)

def podspecs_to_lint
@podspecs_to_lint ||= begin
if @repo_or_podspec =~ /https?:\/\//
require 'open-uri'
output_path = podspecs_tmp_dir + File.basename(@repo_or_podspec)
output_path.dirname.mkpath
open(@repo_or_podspec) do |io|
output_path.open('w') { |f| f << io.read }
end
return [output_path]
end

path = Pathname.new(@repo_or_podspec || '.')
if path.directory?
files = path.glob('**/*.podspec')
@@ -143,6 +154,10 @@ def podspecs_to_lint
end
end

def podspecs_tmp_dir
Pathname.new('/tmp/CocoaPods/Lint_podspec')
end

def specs_to_lint
@specs_to_lint ||= begin
podspecs_to_lint.map do |podspec|
@@ -222,7 +237,7 @@ def peform_extensive_analysis
install_pod
puts "Building with xcodebuild.\n".yellow if config.verbose?
# treat xcodebuild warnings as notes because the spec maintainer might not be the author of the library
xcodebuild_output.each { |msg| ( msg.include?('error') ? @platform_errors[@platform] : @platform_notes[@platform] ) << msg }
xcodebuild_output.each { |msg| ( msg.include?('error: ') ? @platform_errors[@platform] : @platform_notes[@platform] ) << msg }
@platform_errors[@platform] += file_patterns_errors
@platform_warnings[@platform] += file_patterns_warnings
tear_down_lint_environment
@@ -329,6 +344,7 @@ def podspec_warnings
messages = []
messages << "Missing license type" unless license[:type]
messages << "Sample license type" if license[:type] && license[:type] =~ /\(example\)/
messages << "Invalid license type" if license[:type] && license[:type] =~ /\n/
messages << "The summary is not meaningful" if spec.summary =~ /A short description of/
messages << "The description is not meaningful" if spec.description && spec.description =~ /An optional longer description of/
messages << "The summary should end with a dot" if @spec.summary !~ /.*\./
@@ -383,9 +399,9 @@ def xcodebuild_output
def process_xcode_build_output(output)
output_by_line = output.split("\n")
selected_lines = output_by_line.select do |l|
l.include?('error:') && (l !~ /errors? generated\./) \
|| l.include?('warning:') && (l !~ /warnings? generated\./)\
|| l.include?('note:')
l.include?('error: ') && (l !~ /errors? generated\./) \
|| l.include?('warning: ') && (l !~ /warnings? generated\./)\
|| l.include?('note: ') && (l !~ /expanded from macro/)
end
selected_lines.map do |l|
new = l.gsub(/\/tmp\/CocoaPods\/Lint\/Pods\//,'') # Remove the unnecessary tmp path
@@ -404,14 +420,16 @@ def file_patterns_errors
messages = []
messages << "The sources did not match any file" if !@spec.source_files.empty? && @pod.source_files.empty?
messages << "The resources did not match any file" if !@spec.resources.empty? && @pod.resource_files.empty?
messages << "The preserve_paths did not match any file" if !@spec.preserve_paths.empty? && @pod.preserve_paths.empty?
messages << "The preserve_paths did not match any file" if !@spec.preserve_paths.empty? && @pod.preserve_files.empty?
messages << "The exclude_header_search_paths did not match any file" if !@spec.exclude_header_search_paths.empty? && @pod.headers_excluded_from_search_paths.empty?
messages
end

def file_patterns_warnings
messages = []
messages << "Unable to find a license file" unless @pod.license_file
unless @pod.license_file || @spec.license && ( @spec.license[:type] == 'Public Domain' || @spec.license[:text] )
messages << "Unable to find a license file"
end
messages
end
end
@@ -483,15 +501,32 @@ def spec_template(data)
s.name = "#{data[:name]}"
s.version = "#{data[:version]}"
s.summary = "#{data[:summary]}"
# s.description = 'An optional longer description of #{data[:name]}.'
# s.description = <<-DESC
# An optional longer description of #{data[:name]}
#
# * Markdonw format.
# * Don't worry about the indent, we strip it!
# DESC
s.homepage = "#{data[:homepage]}"
# Specify the license type. CocoaPods detects automatically the license file if it is named
# `LICENSE*', however if the name is different, specify it.
# `LICENSE*.*', however if the name is different, specify it.
s.license = 'MIT (example)'
# s.license = { :type => 'MIT (example)', :file => 'FILE_LICENSE' }
#
# Only if no dedicated file is available include the full text of the license.
#
s.license = 'MIT (example)'
# s.license = { :type => 'MIT', :file => 'LICENSE', :text => 'Permission is hereby granted ...' }
# s.license = {
# :type => 'MIT (example)',
# :text => <<-LICENSE
# Copyright (C) <year> <copyright holders>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# ...
# LICENSE
# }
# Specify the authors of the library, with email addresses. You can often find
# the email addresses of the authors by using the SCM log. E.g. $ git log
@@ -543,9 +578,10 @@ def spec_template(data)
# A list of paths to preserve after installing the Pod.
# CocoaPods cleans by default any file that is not used.
# Please don't include documentation, example, and test files.
# Also allows the use of the FileList class like `source_files does.
#
# s.preserve_paths = "examples", "doc"
# s.preserve_paths = "FilesToSave", "MoreFilesToSave"
# Specify a list of frameworks that the application needs to link
# against for this Pod to work.
1 change: 1 addition & 0 deletions lib/cocoapods/dependency.rb
Original file line number Diff line number Diff line change
@@ -159,6 +159,7 @@ def copy_external_source_into_sandbox(sandbox)
def description
"from `#{@params[:git]}'".tap do |description|
description << ", commit `#{@params[:commit]}'" if @params[:commit]
description << ", branch `#{@params[:branch]}'" if @params[:branch]
description << ", tag `#{@params[:tag]}'" if @params[:tag]
end
end
26 changes: 25 additions & 1 deletion lib/cocoapods/downloader/git.rb
Original file line number Diff line number Diff line change
@@ -16,6 +16,8 @@ def download
puts '-> Cloning git repo' if config.verbose?
if options[:tag]
download_tag
elsif options[:branch]
download_branch
elsif options[:commit]
download_commit
else
@@ -89,6 +91,13 @@ def ensure_ref_exists(ref)
raise Informative, "[!] Cache unable to find git reference `#{ref}' for `#{url}'.".red unless ref_exists?(ref)
end

def ensure_remote_branch_exists(branch)
Dir.chdir(cache_path) { git "branch -r | grep #{branch}$" } # check for remote branch and do suffix matching ($ anchor)
return if $? == 0

raise Informative, "[!] Cache unable to find git reference `#{branch}' for `#{url}' (#{$?}).".red
end

def download_head
update_cache
git "clone '#{clone_url}' '#{target_path}'"
@@ -112,6 +121,17 @@ def download_commit
git "checkout -b activated-pod-commit #{options[:commit]}"
end
end

def download_branch
ensure_remote_branch_exists(options[:branch])
git "clone '#{clone_url}' '#{target_path}'"
Dir.chdir(target_path) do
git "remote add upstream #{@url}" # we need to add the original url, not the cache url
git "fetch -q upstream" # refresh the branches
git "checkout --track -b activated-pod-commit upstream/#{options[:branch]}" # create a new tracking branch
puts "Just downloaded and checked out branch: #{options[:branch]} from upstream #{clone_url}" if config.verbose?
end
end
end

class GitHub < Git
@@ -127,8 +147,12 @@ def download_commit
download_only? ? download_and_extract_tarball(options[:commit]) : super
end

def download_branch
download_only? ? download_and_extract_tarball(options[:branch]) : super
end

def tarball_url_for(id)
original_url, username, reponame = *(url.match(/[:\/]([\w\-]+)\/([\w\-]+)\.git/).to_a)
original_url, username, reponame = *(url.match(/[:\/]([\w\-]+)\/([\w\-]+)\.git/))
"https://github.com/#{username}/#{reponame}/tarball/#{id}"
end

6 changes: 3 additions & 3 deletions lib/cocoapods/downloader/http.rb
Original file line number Diff line number Diff line change
@@ -58,11 +58,11 @@ def download_file(full_filename)
def extract_with_type(full_filename, type=:zip)
case type
when :zip
unzip "'#{full_filename}' -d #{target_path}"
unzip "'#{full_filename}' -d '#{target_path}'"
when :tgz
tar "xfz '#{full_filename}' -C #{target_path}"
tar "xfz '#{full_filename}' -C '#{target_path}'"
when :tar
tar "xf '#{full_filename}' -C #{target_path}"
tar "xf '#{full_filename}' -C '#{target_path}'"
else
raise UnsupportedFileTypeError.new "Unsupported file type: #{type}"
end
8 changes: 4 additions & 4 deletions lib/cocoapods/local_pod.rb
Original file line number Diff line number Diff line change
@@ -255,7 +255,7 @@ def preserve_files
# file.
#
def readme_file
expanded_paths(%w[ README{*,.*} readme{*,.*} ]).first
expanded_paths(%w[ readme{*,.*} ]).first
end

# @return [Pathname] The absolute path of the license file from the
@@ -265,7 +265,7 @@ def license_file
if top_specification.license && top_specification.license[:file]
root + top_specification.license[:file]
else
expanded_paths(%w[ LICENSE{*,.*} licence{*,.*} ]).first
expanded_paths(%w[ licen{c,s}e{*,.*} ]).first
end
end

@@ -305,7 +305,7 @@ def all_specs_public_header_files

all_specs = [ top_specification ] + top_specification.subspecs
options = {:glob => '*.{h}'}
files = paths_by_spec(:source_files, options, all_specs).values.flatten!
files = paths_by_spec(:source_files, options, all_specs).values.flatten
headers = files.select { |f| f.extname == '.h' }
headers
end
@@ -450,7 +450,7 @@ def expanded_paths(patterns, options = {})
if pattern.directory? && options[:glob]
pattern += options[:glob]
end
pattern.glob
Pathname.glob(pattern, File::FNM_CASEFOLD)
end.flatten
end
end
33 changes: 26 additions & 7 deletions lib/cocoapods/specification.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'xcodeproj/config'
require 'active_support/core_ext/string/strip.rb'

module Pod
extend Config::Mixin
@@ -189,23 +190,41 @@ def available_platforms
top_attr_accessor :summary
top_attr_accessor :documentation
top_attr_accessor :requires_arc
top_attr_accessor :license, lambda { |l| ( l.kind_of? String ) ? { :type => l } : l }
top_attr_accessor :version, lambda { |v| Version.new(v) }
top_attr_accessor :authors, lambda { |a| parse_authors(a) }

top_attr_reader :description, lambda {|instance, ivar| ivar || instance.summary }
top_attr_writer :description
top_attr_reader :description, lambda { |instance, ivar| ivar || instance.summary }
top_attr_writer :description, lambda { |d| d.strip_heredoc }

alias_method :author=, :authors=
# @!method license
#
# @abstract
# The license of the pod.
#
# @example
# s.license = 'MIT'
# s.license = { :type => 'MIT', :file => 'license.txt', :text => 'Permission is granted to...' }
#
top_attr_accessor :license, lambda { |license|
license = ( license.kind_of? String ) ? { :type => license } : license
license[:text] = license[:text].strip_heredoc if license[:text]
license
}

def self.parse_authors(*names_and_email_addresses)
# @!method authors
#
# @abstract
# The list of the authors (with email) of the pod.
#
top_attr_accessor :authors, lambda { |*names_and_email_addresses|
list = names_and_email_addresses.flatten
unless list.first.is_a?(Hash)
authors = list.last.is_a?(Hash) ? list.pop : {}
list.each { |name| authors[name] = nil }
end
authors || list.first
end
}

alias_method :author=, :authors=

### Attributes **with** multiple platform support

Binary file modified spec/fixtures/banana-lib.tar.gz
Binary file not shown.
12 changes: 10 additions & 2 deletions spec/functional/command/spec_spec.rb
Original file line number Diff line number Diff line change
@@ -115,8 +115,16 @@

it "lints the current working directory" do
Dir.chdir(fixture('spec-repos') + 'master/JSONKit/1.4/') do
output = command('spec', 'lint', '--quick', '--only-errors').run
output.should.include "passed validation"
cmd = command('spec', 'lint', '--quick', '--only-errors')
cmd.run
cmd.output.should.include "passed validation"
end
end

it "lints a remote podspec" do
Dir.chdir(fixture('spec-repos') + 'master/JSONKit/1.4/') do
cmd = command('spec', 'lint', '--quick', '--only-errors', '--silent', 'https://github.com/CocoaPods/Specs/raw/master/A2DynamicDelegate/2.0.1/A2DynamicDelegate.podspec')
VCR.use_cassette('linter', :record => :new_episodes) { lambda { cmd.run }.should.not.raise }
end
end

24 changes: 24 additions & 0 deletions spec/functional/downloader_spec.rb
Original file line number Diff line number Diff line change
@@ -18,12 +18,23 @@
(@pod.root + 'README').read.strip.should == 'first commit'
end

it "check's out a specific branch" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :branch => 'topicbranch'
)
downloader = Pod::Downloader.for_pod(@pod)
downloader.download

(@pod.root + 'README').read.strip.should == 'topicbranch'
end

it "check's out a specific tag" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :tag => 'v1.0'
)
downloader = Pod::Downloader.for_pod(@pod)
downloader.download

(@pod.root + 'README').read.strip.should == 'v1.0'
end

@@ -170,6 +181,19 @@
(@pod.root + 'libPusher.podspec').readlines.grep(/1.1/).should.not.be.empty
end

it "downloads a specific branch when specified" do
@pod.top_specification.stubs(:source).returns(
:git => "git://github.com/lukeredpath/libPusher.git", :branch => 'gh-pages', :download_only => true
)
downloader = Pod::Downloader.for_pod(@pod)

VCR.use_cassette('tarballs', :record => :new_episodes) { downloader.download }


# deliberately keep this assertion as loose as possible for now
(@pod.root + 'index.html').readlines.grep(/libPusher Documentation/).should.not.be.empty
end

it "downloads a specific commit when specified" do
@pod.top_specification.stubs(:source).returns(
:git => "git://github.com/lukeredpath/libPusher.git", :commit => 'eca89998d5', :download_only => true
10 changes: 5 additions & 5 deletions spec/unit/command/repo_spec.rb
Original file line number Diff line number Diff line change
@@ -13,8 +13,8 @@
@command.class.send(:is_compatilbe, versions).should == true
end

it "doesn't supports a repo with a compatible minimum version" do
versions = { 'min' => '0.7' }
it "doesn't supports a repo with a non compatible minimum version" do
versions = { 'min' => '0.999' }
@command.class.send(:is_compatilbe, versions).should == false
end

@@ -28,13 +28,13 @@
@command.class.send(:is_compatilbe, versions).should == false
end

it "detects if an update is available" do
it "detects if no update is available" do
versions = { 'last' => '0.5' }
@command.class.send(:has_update, versions).should == false
end

it "detects if no update is available" do
versions = { 'last' => '0.7' }
it "detects if an update is available" do
versions = { 'last' => '0.999' }
@command.class.send(:has_update, versions).should == true
end
end