Commit c15a1f09 authored by Fabio Pelosin's avatar Fabio Pelosin

[Docs] Preliminary support for YARD.

parent de9fe2dc
...@@ -18,3 +18,4 @@ spec/fixtures/integration/Headers/ ...@@ -18,3 +18,4 @@ spec/fixtures/integration/Headers/
spec/fixtures/mercurial-repo/.hg/*cache spec/fixtures/mercurial-repo/.hg/*cache
.hg .hg
spec/fixtures/vcr spec/fixtures/vcr
.yardoc
--markup markdown
--exclude examples
--exclude spec
--exclude tmp
...@@ -20,4 +20,8 @@ group :development do ...@@ -20,4 +20,8 @@ group :development do
gem "webmock" gem "webmock"
gem "awesome_print" gem "awesome_print"
gem "pry" gem "pry"
gem 'yard'
gem 'redcarpet'
gem 'github-markup'
end end
...@@ -19,6 +19,7 @@ GEM ...@@ -19,6 +19,7 @@ GEM
multipart-post (~> 1.1) multipart-post (~> 1.1)
faraday_middleware (0.8.7) faraday_middleware (0.8.7)
faraday (>= 0.7.4, < 0.9) faraday (>= 0.7.4, < 0.9)
github-markup (0.7.2)
hashie (1.2.0) hashie (1.2.0)
json (1.7.3) json (1.7.3)
kicker (2.5.0) kicker (2.5.0)
...@@ -44,11 +45,13 @@ GEM ...@@ -44,11 +45,13 @@ GEM
slop (>= 2.4.4, < 3) slop (>= 2.4.4, < 3)
rake (0.9.2.2) rake (0.9.2.2)
rb-fsevent (0.9.1) rb-fsevent (0.9.1)
redcarpet (2.1.1)
slop (2.4.4) slop (2.4.4)
vcr (2.2.0) vcr (2.2.0)
webmock (1.8.7) webmock (1.8.7)
addressable (>= 2.2.7) addressable (>= 2.2.7)
crack (>= 0.1.7) crack (>= 0.1.7)
yard (0.8.2)
PLATFORMS PLATFORMS
ruby ruby
...@@ -59,6 +62,7 @@ DEPENDENCIES ...@@ -59,6 +62,7 @@ DEPENDENCIES
colored colored
escape escape
faraday (>= 0.8.1) faraday (>= 0.8.1)
github-markup
json json
kicker kicker
mocha-on-bacon mocha-on-bacon
...@@ -67,6 +71,8 @@ DEPENDENCIES ...@@ -67,6 +71,8 @@ DEPENDENCIES
pry pry
rake rake
rb-fsevent rb-fsevent
redcarpet
vcr vcr
webmock webmock
xcodeproj! xcodeproj!
yard
module Pod module Pod
# Describes an build envronment. It caputures information about the SDK and a deployment target.
#
class Platform class Platform
# @return [Platform] Convenience method to initialize an iOS platform
#
def self.ios def self.ios
new :ios new :ios
end end
# @return [Platform] Convenience method to initialize an OS X platform
#
def self.osx def self.osx
new :osx new :osx
end end
attr_reader :deployment_target # Constructs a platform from either another platform or by
##
# Public: Constructs a platform from either another platform or by
# specifying the symbolic name and optionally the deployment target. # specifying the symbolic name and optionally the deployment target.
# #
# input - Another platform or the symbolic name of the platform. # @param [Platform, Symbol] input Another platform or a symbolic name for the platform.
# deployment_target - The optional deployment target if initalized by # @param [Version, {Symbol=>Object}] deployment_target The optional deployment target if initalized by symbolic name
# symbolic name
# #
# Examples # Examples:
# #
# Platform.new(:ios) # ```
# Platform.new(:ios, '4.3') # Platform.new(:ios)
# Platform.new(Platform.new(:ios)) # Platform.new(:ios, '4.3')
# Platform.new(Platform.new(:ios))
# ```
# #
# Returns nothing.
def initialize(input = nil, deployment_target = nil) def initialize(input = nil, deployment_target = nil)
if input.is_a? Platform if input.is_a? Platform
@symbolic_name = input.name @symbolic_name = input.name
...@@ -39,22 +43,44 @@ module Pod ...@@ -39,22 +43,44 @@ module Pod
end end
end end
# @return [Symbol] The name of the SDK reppresented by the platform.
#
def name def name
@symbolic_name @symbolic_name
end end
# The optional deployment target of the platform.
# A deployment target can be specified as a string.
#
# @return [Version]
attr_reader :deployment_target
def deployment_target= (version) def deployment_target= (version)
@deployment_target = Pod::Version.create(version) @deployment_target = Pod::Version.create(version)
end end
def ==(other_platform_or_symbolic_name) # Checks if two platforms are the equivalent.
if other_platform_or_symbolic_name.is_a?(Symbol) #
@symbolic_name == other_platform_or_symbolic_name # @param [Platform, Symbol] other The other platform to check. If a symbol is
# passed the comparison does not take into
# account the deployment target.
#
# @return [Boolean]
#
def ==(other)
if other.is_a?(Symbol)
@symbolic_name == other
else else
self.name == (other_platform_or_symbolic_name.name) && self.deployment_target == other_platform_or_symbolic_name.deployment_target self.name == (other.name) && self.deployment_target == other.deployment_target
end end
end end
# A platfrom supports (from the point of view of a pod) another platform if they reppresent the same SDK and if the
# deployment target of the other is lower. If one of the platforms does not specify the deployment target, it is not taken into account.
#
# This method always returns true if one of platforms is nil.
#
# **TODO**: rename to supported_on?
def supports?(other) def supports?(other)
return true if @symbolic_name.nil? || other.nil? return true if @symbolic_name.nil? || other.nil?
os_check = @symbolic_name == other.name os_check = @symbolic_name == other.name
...@@ -62,6 +88,10 @@ module Pod ...@@ -62,6 +88,10 @@ module Pod
os_check && version_check os_check && version_check
end end
# A string reppresentation of the Platform including the deployment target if specified.
#
# @return [String] A string reppresentation.
#
def to_s def to_s
case @symbolic_name case @symbolic_name
when :ios when :ios
...@@ -73,14 +103,21 @@ module Pod ...@@ -73,14 +103,21 @@ module Pod
end end
end end
# @return [Symbol] A Symbol reppresentation of the SDK.
#
def to_sym def to_sym
name name
end end
# A platform behaves as nil if doesn't specify an SDK.
# A nil platform reppresents all the available platforms.
#
def nil? def nil?
name.nil? name.nil?
end end
# @return Whether the platform requires legacy architectures for iOS.
#
def requires_legacy_ios_archs? def requires_legacy_ios_archs?
return unless deployment_target return unless deployment_target
(name == :ios) && (deployment_target < Pod::Version.new("4.3")) (name == :ios) && (deployment_target < Pod::Version.new("4.3"))
......
...@@ -332,12 +332,14 @@ module Pod ...@@ -332,12 +332,14 @@ module Pod
# Pod::Specification is yielded to the block. This is the same class which # Pod::Specification is yielded to the block. This is the same class which
# is normally used to specify a Pod. # is normally used to specify a Pod.
# #
# ```
# dependency do |spec| # dependency do |spec|
# spec.name = 'JSONKit' # spec.name = 'JSONKit'
# spec.version = '1.4' # spec.version = '1.4'
# spec.source = { :git => 'https://github.com/johnezang/JSONKit.git', :tag => 'v1.4' } # spec.source = { :git => 'https://github.com/johnezang/JSONKit.git', :tag => 'v1.4' }
# spec.source_files = 'JSONKit.*' # spec.source_files = 'JSONKit.*'
# end # end
# ```
# #
# #
# For more info on the definition of a Pod::Specification see: # For more info on the definition of a Pod::Specification see:
......
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