Commit 15a42768 authored by Fabio Pelosin's avatar Fabio Pelosin

Merge pull request #372 from CocoaPods/spec-heredocs

Spec heredocs
parents 874a0ca8 f3b61866
...@@ -9,6 +9,7 @@ PATH ...@@ -9,6 +9,7 @@ PATH
remote: . remote: .
specs: specs:
cocoapods (0.6.1) cocoapods (0.6.1)
activesupport (~> 3.2.6)
colored (~> 1.2) colored (~> 1.2)
escape (~> 0.0.4) escape (~> 0.0.4)
faraday (~> 0.8.1) faraday (~> 0.8.1)
...@@ -21,6 +22,9 @@ PATH ...@@ -21,6 +22,9 @@ PATH
GEM GEM
remote: http://rubygems.org/ remote: http://rubygems.org/
specs: specs:
activesupport (3.2.6)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.2.8) addressable (2.2.8)
awesome_print (1.0.2) awesome_print (1.0.2)
bacon (1.1.0) bacon (1.1.0)
...@@ -35,6 +39,7 @@ GEM ...@@ -35,6 +39,7 @@ GEM
ffi (1.0.11) ffi (1.0.11)
github-markup (0.7.2) github-markup (0.7.2)
hashie (1.2.0) hashie (1.2.0)
i18n (0.6.0)
json (1.7.3) json (1.7.3)
kicker (2.6.0) kicker (2.6.0)
listen listen
......
...@@ -34,6 +34,7 @@ Gem::Specification.new do |s| ...@@ -34,6 +34,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'open4', '~> 1.3.0' s.add_runtime_dependency 'open4', '~> 1.3.0'
s.add_runtime_dependency 'rake', '~> 0.9.0' s.add_runtime_dependency 'rake', '~> 0.9.0'
s.add_runtime_dependency 'xcodeproj', '~> 0.2.1' s.add_runtime_dependency 'xcodeproj', '~> 0.2.1'
s.add_runtime_dependency 'activesupport', '~> 3.2.6'
s.add_development_dependency 'bacon', '~> 1.1' s.add_development_dependency 'bacon', '~> 1.1'
......
...@@ -501,15 +501,32 @@ Pod::Spec.new do |s| ...@@ -501,15 +501,32 @@ Pod::Spec.new do |s|
s.name = "#{data[:name]}" s.name = "#{data[:name]}"
s.version = "#{data[:version]}" s.version = "#{data[:version]}"
s.summary = "#{data[:summary]}" 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]}" s.homepage = "#{data[:homepage]}"
# Specify the license type. CocoaPods detects automatically the license file if it is named # 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. # Only if no dedicated file is available include the full text of the license.
# #
s.license = 'MIT (example)' # s.license = {
# s.license = { :type => 'MIT', :file => 'LICENSE', :text => 'Permission is hereby granted ...' } # :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 # 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 # the email addresses of the authors by using the SCM log. E.g. $ git log
......
require 'xcodeproj/config' require 'xcodeproj/config'
require 'active_support/core_ext/string/strip.rb'
module Pod module Pod
extend Config::Mixin extend Config::Mixin
...@@ -189,23 +190,41 @@ module Pod ...@@ -189,23 +190,41 @@ module Pod
top_attr_accessor :summary top_attr_accessor :summary
top_attr_accessor :documentation top_attr_accessor :documentation
top_attr_accessor :requires_arc 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 :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_reader :description, lambda { |instance, ivar| ivar || instance.summary }
top_attr_writer :description 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 list = names_and_email_addresses.flatten
unless list.first.is_a?(Hash) unless list.first.is_a?(Hash)
authors = list.last.is_a?(Hash) ? list.pop : {} authors = list.last.is_a?(Hash) ? list.pop : {}
list.each { |name| authors[name] = nil } list.each { |name| authors[name] = nil }
end end
authors || list.first authors || list.first
end }
alias_method :author=, :authors=
### Attributes **with** multiple platform support ### Attributes **with** multiple platform support
......
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