Permalink
Browse files

Merge pull request #372 from CocoaPods/spec-heredocs

Spec heredocs
  • Loading branch information...
2 parents 874a0ca + f3b6186 commit 15a427688c6c2dab64009aabdd27db1b95a08e8e @fabiopelosin fabiopelosin committed Jul 6, 2012
Showing with 62 additions and 20 deletions.
  1. +5 −0 Gemfile.lock
  2. +10 −9 cocoapods.gemspec
  3. +21 −4 lib/cocoapods/command/spec.rb
  4. +26 −7 lib/cocoapods/specification.rb
View
@@ -9,6 +9,7 @@ PATH
remote: .
specs:
cocoapods (0.6.1)
+ activesupport (~> 3.2.6)
colored (~> 1.2)
escape (~> 0.0.4)
faraday (~> 0.8.1)
@@ -21,6 +22,9 @@ PATH
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,6 +39,7 @@ 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)
listen
View
@@ -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.1'
+ s.add_runtime_dependency 'activesupport', '~> 3.2.6'
s.add_development_dependency 'bacon', '~> 1.1'
@@ -501,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
@@ -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

0 comments on commit 15a4276

Please sign in to comment.