Commit 042b51f9 authored by Fabio Pelosin's avatar Fabio Pelosin

[Documenation] Clean-up.

parent faa726a3
## Branch 0.17 ## Branch 0.17
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/master...0.17)
- TODO: Dropped script for resources.
###### DSL Changes ###### DSL Changes
...@@ -13,12 +16,15 @@ ...@@ -13,12 +16,15 @@
###### Enhancements ###### Enhancements
- Released [documentation](docs.cocoapods.org).
- Extrace models to [CocoaPods-Core](https://github.com/CocoaPods/Core) gem.
- Major clean up and refactor to the code base.
- Extracted command-line command & option handling into - Extracted command-line command & option handling into
[CLAide](https://github.com/CocoaPods/CLAide). [CLAide](https://github.com/CocoaPods/CLAide).
- Added PathList class. - Added PathList class.
- Added Podfile to the Pods project. - Added Podfile to the Pods project.
[#476](https://github.com/CocoaPods/CocoaPods/issues/476) [#476](https://github.com/CocoaPods/CocoaPods/issues/476)
- Extracted XCConfig generator.
## 0.16.0 ## 0.16.0
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.16.0.rc5...master) [CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.16.0.rc5...master)
......
...@@ -124,15 +124,17 @@ module Pod ...@@ -124,15 +124,17 @@ module Pod
# The contents of the specification (String) or the path to a # The contents of the specification (String) or the path to a
# podspec file (Pathname). # podspec file (Pathname).
# #
# TODO This could be done by the sandbox. # @todo This could be done by the sandbox.
# TODO The check for the podspec string is a bit primitive. # @todo Store all the specifications (including those not originating
# from external sources) so users can check them.
# @todo The check for the podspec string is a bit primitive.
# #
def store_podspec(sandbox, podspec) def store_podspec(sandbox, podspec)
output_path = sandbox.root + "Local Podspecs/#{name}.podspec" output_path = sandbox.root + "Local Podspecs/#{name}.podspec"
output_path.dirname.mkpath output_path.dirname.mkpath
if podspec.is_a?(String) if podspec.is_a?(String)
unless podspec.include?('Spec.new') unless podspec.include?('Spec.new')
raise Informative, "No podspec found for `#{name}` in #{description}" raise Informative, "The `#{name}.podspec` from `#{description}` appears to be invalid."
end end
output_path.open('w') { |f| f.puts(podspec) } output_path.open('w') { |f| f.puts(podspec) }
else else
......
...@@ -39,7 +39,7 @@ module Pod ...@@ -39,7 +39,7 @@ module Pod
# #
# @return [String] # @return [String]
# #
# TODO: Subspecs can specify prefix header information too. # @todo Subspecs can specify prefix header information too.
# #
def generate def generate
result = "#ifdef __OBJC__\n" result = "#ifdef __OBJC__\n"
......
...@@ -40,10 +40,10 @@ module Pod ...@@ -40,10 +40,10 @@ module Pod
# #
# @return [Xcodeproj::Config] # @return [Xcodeproj::Config]
# #
# TODO What is the need of having a custom PODS_HEADERS_SEARCH_PATHS # @note The value `PODS_HEADERS_SEARCH_PATHS` is used to store the headers
# instead of using PODS_HEADERS_SEARCH_PATHS? # so xcconfig can reference the variable.
# #
# TODO Add Xcodeproj::Config#[] # @todo Add Xcodeproj::Config#[]
# #
def generate def generate
ld_flags = '-ObjC' ld_flags = '-ObjC'
......
This diff is collapsed.
...@@ -47,7 +47,7 @@ module Pod ...@@ -47,7 +47,7 @@ module Pod
create_copy_resources_script create_copy_resources_script
end end
# TODO: This has to be removed, but this means the specs have to be # @todo This has to be removed, but this means the specs have to be
# updated if they need a reference to the prefix header. # updated if they need a reference to the prefix header.
# #
def prefix_header_filename def prefix_header_filename
...@@ -166,7 +166,7 @@ module Pod ...@@ -166,7 +166,7 @@ module Pod
# Creates a script that copies the resources to the bundle of the client # Creates a script that copies the resources to the bundle of the client
# target. # target.
# #
# TODO: This should be replaced by an Xcode copy resources build phase. # @todo This should be replaced by an Xcode copy resources build phase.
# #
# @return [void] # @return [void]
# #
......
...@@ -25,7 +25,7 @@ module Pod ...@@ -25,7 +25,7 @@ module Pod
# @return [Pathname] the path of the installation. # @return [Pathname] the path of the installation.
# #
# TODO: This is only used to compute the workspace path in case that it # @todo This is only used to compute the workspace path in case that it
# should be inferred by the project. If the workspace should be in # should be inferred by the project. If the workspace should be in
# the same dir of the project, this could be removed. # the same dir of the project, this could be removed.
# #
...@@ -212,7 +212,7 @@ module Pod ...@@ -212,7 +212,7 @@ module Pod
# configurations overrides the `xcconfig` file and warns the # configurations overrides the `xcconfig` file and warns the
# user. # user.
# #
# TODO: If the xcconfig is already set don't override it and inform # @todo If the xcconfig is already set don't override it and inform
# the user. # the user.
# #
# @return [void] # @return [void]
......
module Pod module Pod
class LocalPod class LocalPod
# The {PathList} class is designed to perform multiple glob matches against # The PathList class is designed to perform multiple glob matches against
# a given directory. Basically, it generates a list of all the children # a given directory. Basically, it generates a list of all the children
# paths and matches the globs patterns against them, resulting in just # paths and matches the globs patterns against them, resulting in just one
# one access to the file system. # access to the file system.
# #
# @note A {PathList} once it has generated the list of the paths this is # @note A PathList once it has generated the list of the paths this is
# updated only if explicitly requested by calling # updated only if explicitly requested by calling
# {PathList#read_file_system} # {#read_file_system}
# #
class PathList class PathList
...@@ -63,12 +63,12 @@ module Pod ...@@ -63,12 +63,12 @@ module Pod
# insensitively matched by a given pattern. This method emulates # insensitively matched by a given pattern. This method emulates
# {Dir#glob} with the {File::FNM_CASEFOLD} option. # {Dir#glob} with the {File::FNM_CASEFOLD} option.
# #
# @param [String,Array<String>] patterns A signle {Dir#glob} like # @param [String,Array<String>] patterns
# pattern, or a list of patterns. # A signle {Dir#glob} like pattern, or a list of patterns.
# #
# @param [String] dir_pattern An optional pattern to append to a # @param [String] dir_pattern
# pattern, if it is the path to a # An optional pattern to append to a pattern, if it is the path
# directory. # to a directory.
# #
def relative_glob(patterns, dir_pattern = nil, exclude_patterns = nil) def relative_glob(patterns, dir_pattern = nil, exclude_patterns = nil)
return [] if patterns.empty? return [] if patterns.empty?
...@@ -94,7 +94,8 @@ module Pod ...@@ -94,7 +94,8 @@ module Pod
end end
# @return [Bool] Wether a path is a directory. The result of this method # @return [Bool] Wether a path is a directory. The result of this method
# computed without accessing the file system and is case insensitive. # computed without accessing the file system and is case
# insensitive.
# #
# @param [String, Pathname] sub_path The path that could be a directory. # @param [String, Pathname] sub_path The path that could be a directory.
# #
...@@ -104,8 +105,9 @@ module Pod ...@@ -104,8 +105,9 @@ module Pod
end end
# @return [Array<String>] An array of patterns converted from a # @return [Array<String>] An array of patterns converted from a
# {Dir.glob} pattern to patterns that {File.fnmatch} can handle. This # {Dir.glob} pattern to patterns that {File.fnmatch} can handle.
# is used by the {#relative_glob} method to emulate {Dir.glob}. # This is used by the {#relative_glob} method to emulate
# {Dir.glob}.
# #
# The expansion provides support for: # The expansion provides support for:
# #
......
...@@ -322,7 +322,7 @@ module Pod ...@@ -322,7 +322,7 @@ module Pod
# @return [Pathname] the folder where to store the support files of this # @return [Pathname] the folder where to store the support files of this
# library. # library.
# #
# TODO: each library should have a folder for its support files # @todo each library should have a group for its support files
# #
def support_files_root def support_files_root
project.sandbox.root project.sandbox.root
...@@ -409,7 +409,7 @@ module Pod ...@@ -409,7 +409,7 @@ module Pod
support_files_root + bridge_support_name support_files_root + bridge_support_name
end end
# TODO # @todo
# #
def acknowledgements_path def acknowledgements_path
support_files_root + "#{label}-Acknowledgements" support_files_root + "#{label}-Acknowledgements"
......
...@@ -35,7 +35,7 @@ module Pod ...@@ -35,7 +35,7 @@ module Pod
# #
# @note This option is used by `pod outdated`. # @note This option is used by `pod outdated`.
# #
# @TODO: This implementation is not clean, because if the spec doesn't # @todo: This implementation is not clean, because if the spec doesn't
# exists the sandbox will actually download and modify the # exists the sandbox will actually download and modify the
# installation. # installation.
# #
...@@ -112,7 +112,7 @@ module Pod ...@@ -112,7 +112,7 @@ module Pod
# @return [Source::Aggregate] A cache of the sources needed to find the # @return [Source::Aggregate] A cache of the sources needed to find the
# podspecs. # podspecs.
# #
# TODO: Cache the sources globally? # @todo Cache the sources globally?
# #
attr_accessor :cached_sources attr_accessor :cached_sources
...@@ -155,8 +155,9 @@ module Pod ...@@ -155,8 +155,9 @@ module Pod
# dependency of the specification. In this way it is possible to # dependency of the specification. In this way it is possible to
# not updated the installed pods without without introducing # not updated the installed pods without without introducing
# dependencies in other target definitions. # dependencies in other target definitions.
# TODO: Just add the requirement to the set? #
# TODO: Use root name? # @todo Just add the requirement to the set?
# @todo Use root name?
# #
# @note The recursive process checks if a dependency has already been # @note The recursive process checks if a dependency has already been
# loaded to prevent an infinite loop. For this reason the # loaded to prevent an infinite loop. For this reason the
......
...@@ -10,8 +10,6 @@ module Pod ...@@ -10,8 +10,6 @@ module Pod
# #
class Sandbox class Sandbox
# TODO the headers should be stored in a `Headers` folder.
# The path of the build headers directory relative to the root. # The path of the build headers directory relative to the root.
# #
BUILD_HEADERS_DIR = "BuildHeaders" BUILD_HEADERS_DIR = "BuildHeaders"
...@@ -34,6 +32,8 @@ module Pod ...@@ -34,6 +32,8 @@ module Pod
# @param [String, Pathname] root @see root # @param [String, Pathname] root @see root
# #
# @todo the headers should be stored in a `Headers` folder.
#
def initialize(root) def initialize(root)
@root = Pathname.new(root) @root = Pathname.new(root)
@build_headers = HeadersDirectory.new(self, BUILD_HEADERS_DIR) @build_headers = HeadersDirectory.new(self, BUILD_HEADERS_DIR)
...@@ -85,7 +85,7 @@ module Pod ...@@ -85,7 +85,7 @@ module Pod
public public
# @TODO refactor the pods from a local source should not be cached by the # @todo refactor the pods from a local source should not be cached by the
# sandbox # sandbox
# #
# @return [LocalPod] # @return [LocalPod]
...@@ -142,7 +142,7 @@ module Pod ...@@ -142,7 +142,7 @@ module Pod
# @return [Array<String>] the names of the pods that have been # @return [Array<String>] the names of the pods that have been
# pre-downloaded from an external source. # pre-downloaded from an external source.
# #
# TODO: the installer needs to be aware of it. # @todo the installer needs to be aware of it.
# #
attr_reader :predownloaded_pods attr_reader :predownloaded_pods
...@@ -202,7 +202,6 @@ module Pod ...@@ -202,7 +202,6 @@ module Pod
public public
# #
# #
def add_file(namespace_path, relative_header_path) def add_file(namespace_path, relative_header_path)
......
...@@ -4,7 +4,6 @@ module Pod ...@@ -4,7 +4,6 @@ module Pod
include Config::Mixin include Config::Mixin
# TODO: Move exceptions to clients?
# @return [Array<Source>] the list of all the sources known to this # @return [Array<Source>] the list of all the sources known to this
# installation of CocoaPods. # installation of CocoaPods.
...@@ -26,6 +25,8 @@ module Pod ...@@ -26,6 +25,8 @@ module Pod
# {Source} that contain the Pod. If no sources containing the # {Source} that contain the Pod. If no sources containing the
# Pod where found it returns nil. # Pod where found it returns nil.
# #
# @todo Move exceptions to clients?
#
# @raise If no source including the set can be found. # @raise If no source including the set can be found.
# #
def search(dependency) def search(dependency)
...@@ -46,8 +47,10 @@ module Pod ...@@ -46,8 +47,10 @@ module Pod
# #
# @raises If no source including the set can be found. # @raises If no source including the set can be found.
# #
# @note Full text search requires to load the specification for each pod, # @note Full text search requires to load the specification for each
# hence is considerably slower. # pod, hence is considerably slower.
#
# @todo Move exceptions to clients?
# #
# @return [Array<Set>] The sets that contain the search term. # @return [Array<Set>] The sets that contain the search term.
# #
......
require 'active_support/core_ext/array/conversions'
module Pod
module UserInterface
class UIPod
attr_accessor :set
def initialize(set)
@set = set
end
# set information
def name
@set.name
end
def version
@set.versions.first
end
def versions
@set.versions.sort.reverse
end
def verions_by_source
result = []
@set.versions_by_source.each do |source, versions|
result << "#{versions.map(&:to_s) * ', '} [#{source.name} repo]"
end
result * ' - '
end
# @return [Array<String>]
#
def sources
@set.sources.map(&:name).sort
end
# specification information
def spec
@set.specification
end
def authors
spec.authors ? spec.authors.keys.to_sentence : ''
end
def homepage
spec.homepage
end
def description
spec.description
end
def summary
spec.summary
end
def source_url
spec.source.reject {|k,_| k == :commit || k == :tag }.values.first
end
def platform
spec.available_platforms.sort { |a,b| a.to_s.downcase <=> b.to_s.downcase }.join(' - ')
end
def license
spec.license[:type] if spec.license
end
# will return array of all subspecs (recursevly) or nil
def subspecs
(spec.recursive_subspecs.any? && spec.recursive_subspecs) || nil
end
# Statistics information
def creation_date
Pod::Specification::Statistics.instance.creation_date(@set)
end
def github_watchers
Pod::Specification::Statistics.instance.github_watchers(@set)
end
def github_forks
Pod::Specification::Statistics.instance.github_forks(@set)
end
def github_last_activity
distance_from_now_in_words(Pod::Specification::Statistics.instance.github_pushed_at(@set))
end
def ==(other)
self.class === other && @set == other.set
end
def eql?(other)
self.class === other && name.eql?(other.name)
end
def hash
name.hash
end
private
def distance_from_now_in_words(from_time)
return nil unless from_time
from_time = Time.parse(from_time)
to_time = Time.now
distance_in_days = (((to_time - from_time).abs)/60/60/24).round
case distance_in_days
when 0..7
"less than a week ago"
when 8..29
"#{distance_in_days} days ago"
when 30..45
"1 month ago"
when 46..365
"#{(distance_in_days.to_f / 30).round} months ago"
else
"more than a year ago"
end
end
end
end
end
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