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

[Documenation] Clean-up.

parent faa726a3
## Branch 0.17
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/master...0.17)
- TODO: Dropped script for resources.
###### DSL Changes
......@@ -13,12 +16,15 @@
###### 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
[CLAide](https://github.com/CocoaPods/CLAide).
- Added PathList class.
- Added Podfile to the Pods project.
[#476](https://github.com/CocoaPods/CocoaPods/issues/476)
- Extracted XCConfig generator.
## 0.16.0
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.16.0.rc5...master)
......
......@@ -124,15 +124,17 @@ module Pod
# The contents of the specification (String) or the path to a
# podspec file (Pathname).
#
# TODO This could be done by the sandbox.
# TODO The check for the podspec string is a bit primitive.
# @todo This could be done by the sandbox.
# @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)
output_path = sandbox.root + "Local Podspecs/#{name}.podspec"
output_path.dirname.mkpath
if podspec.is_a?(String)
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
output_path.open('w') { |f| f.puts(podspec) }
else
......@@ -217,19 +219,19 @@ module Pod
#
class LocalSource < AbstractExternalSource
# @see AbstractExternalSource#copy_external_source_into_sandbox
# @see AbstractExternalSource#copy_external_source_into_sandbox
#
def copy_external_source_into_sandbox(sandbox)
store_podspec(sandbox, pod_spec_path)
end
# @see AbstractExternalSource#description
# @see AbstractExternalSource#description
#
def description
"from `#{@params[:local]}`"
end
# @see AbstractExternalSource#specification_from_local
# @see AbstractExternalSource#specification_from_local
#
# @note The LocalSource class always fetches podspecs from the external
# source to provide always the freshest specification. Otherwise,
......@@ -240,7 +242,7 @@ module Pod
specification_from_external(sandbox)
end
# @see AbstractExternalSource#specification_from_local
# @see AbstractExternalSource#specification_from_local
#
# @note The LocalSource overrides the source of the specification to
# point to the local path.
......
......@@ -39,7 +39,7 @@ module Pod
#
# @return [String]
#
# TODO: Subspecs can specify prefix header information too.
# @todo Subspecs can specify prefix header information too.
#
def generate
result = "#ifdef __OBJC__\n"
......
......@@ -40,10 +40,10 @@ module Pod
#
# @return [Xcodeproj::Config]
#
# TODO What is the need of having a custom PODS_HEADERS_SEARCH_PATHS
# instead of using PODS_HEADERS_SEARCH_PATHS?
# @note The value `PODS_HEADERS_SEARCH_PATHS` is used to store the headers
# so xcconfig can reference the variable.
#
# TODO Add Xcodeproj::Config#[]
# @todo Add Xcodeproj::Config#[]
#
def generate
ld_flags = '-ObjC'
......
This diff is collapsed.
......@@ -47,7 +47,7 @@ module Pod
create_copy_resources_script
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.
#
def prefix_header_filename
......@@ -166,7 +166,7 @@ module Pod
# Creates a script that copies the resources to the bundle of the client
# 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]
#
......
......@@ -25,7 +25,7 @@ module Pod
# @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
# the same dir of the project, this could be removed.
#
......@@ -212,7 +212,7 @@ module Pod
# configurations overrides the `xcconfig` file and warns the
# 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.
#
# @return [void]
......
module Pod
class LocalPod
# The {PathList} class is designed to perform multiple glob matches against
# a given directory. Basically, it generates a list of all the children
# paths and matches the globs patterns against them, resulting in just
# one access to the file system.
# The PathList class is designed to perform multiple glob matches against
# a given directory. Basically, it generates a list of all the children
# paths and matches the globs patterns against them, resulting in just one
# access to the file system.
#
# @note A {PathList} once it has generated the list of the paths this is
# updated only if explicitly requested by calling
# {PathList#read_file_system}
# @note A PathList once it has generated the list of the paths this is
# updated only if explicitly requested by calling
# {#read_file_system}
#
class PathList
# @return [Pathname] The root of the list whose files and directories
# are used to perform the matching operations.
# are used to perform the matching operations.
#
attr_accessor :root
# @param [Pathname] root The root of the PathList.
# @param [Pathname] root The root of the PathList.
#
def initialize(root)
@root = root
end
# @return [Array<String>] The list of absolute the path of all the files
# contained in {root}.
# contained in {root}.
#
def files
read_file_system unless @files
......@@ -32,7 +32,7 @@ module Pod
end
# @return [Array<String>] The list of absolute the path of all the
# directories contained in {root}.
# directories contained in {root}.
#
def dirs
read_file_system unless @dirs
......@@ -40,7 +40,7 @@ module Pod
end
# @return [void] Reads the file system and populates the files and paths
# lists.
# lists.
#
def read_file_system
root_length = root.to_s.length+1
......@@ -53,22 +53,22 @@ module Pod
end
# @return [Array<Pathname>] Similar to {glob} but returns the absolute
# paths.
# paths.
#
def glob(patterns, dir_pattern = nil, exclude_patterns = nil)
relative_glob(patterns, dir_pattern, exclude_patterns).map {|p| root + p }
end
# @return [Array<Pathname>] The list of relative paths that are case
# insensitively matched by a given pattern. This method emulates
# {Dir#glob} with the {File::FNM_CASEFOLD} option.
# insensitively matched by a given pattern. This method emulates
# {Dir#glob} with the {File::FNM_CASEFOLD} option.
#
# @param [String,Array<String>] patterns A signle {Dir#glob} like
# pattern, or a list of patterns.
# @param [String,Array<String>] patterns
# A signle {Dir#glob} like pattern, or a list of patterns.
#
# @param [String] dir_pattern An optional pattern to append to a
# pattern, if it is the path to a
# directory.
# @param [String] dir_pattern
# An optional pattern to append to a pattern, if it is the path
# to a directory.
#
def relative_glob(patterns, dir_pattern = nil, exclude_patterns = nil)
return [] if patterns.empty?
......@@ -94,9 +94,10 @@ module Pod
end
# @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.
#
def directory?(sub_path)
sub_path = sub_path.to_s.downcase.sub(/\/$/, '')
......@@ -104,8 +105,9 @@ module Pod
end
# @return [Array<String>] An array of patterns converted from a
# {Dir.glob} pattern to patterns that {File.fnmatch} can handle. This
# is used by the {#relative_glob} method to emulate {Dir.glob}.
# {Dir.glob} pattern to patterns that {File.fnmatch} can handle.
# This is used by the {#relative_glob} method to emulate
# {Dir.glob}.
#
# The expansion provides support for:
#
......
......@@ -322,7 +322,7 @@ module Pod
# @return [Pathname] the folder where to store the support files of this
# 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
project.sandbox.root
......@@ -409,7 +409,7 @@ module Pod
support_files_root + bridge_support_name
end
# TODO
# @todo
#
def acknowledgements_path
support_files_root + "#{label}-Acknowledgements"
......
......@@ -35,7 +35,7 @@ module Pod
#
# @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
# installation.
#
......@@ -112,7 +112,7 @@ module Pod
# @return [Source::Aggregate] A cache of the sources needed to find the
# podspecs.
#
# TODO: Cache the sources globally?
# @todo Cache the sources globally?
#
attr_accessor :cached_sources
......@@ -155,8 +155,9 @@ module Pod
# dependency of the specification. In this way it is possible to
# not updated the installed pods without without introducing
# 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
# loaded to prevent an infinite loop. For this reason the
......
......@@ -10,8 +10,6 @@ module Pod
#
class Sandbox
# TODO the headers should be stored in a `Headers` folder.
# The path of the build headers directory relative to the root.
#
BUILD_HEADERS_DIR = "BuildHeaders"
......@@ -34,6 +32,8 @@ module Pod
# @param [String, Pathname] root @see root
#
# @todo the headers should be stored in a `Headers` folder.
#
def initialize(root)
@root = Pathname.new(root)
@build_headers = HeadersDirectory.new(self, BUILD_HEADERS_DIR)
......@@ -85,7 +85,7 @@ module Pod
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
#
# @return [LocalPod]
......@@ -142,7 +142,7 @@ module Pod
# @return [Array<String>] the names of the pods that have been
# 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
......@@ -202,7 +202,6 @@ module Pod
public
#
#
def add_file(namespace_path, relative_header_path)
......
......@@ -4,7 +4,6 @@ module Pod
include Config::Mixin
# TODO: Move exceptions to clients?
# @return [Array<Source>] the list of all the sources known to this
# installation of CocoaPods.
......@@ -26,6 +25,8 @@ module Pod
# {Source} that contain the Pod. If no sources containing the
# Pod where found it returns nil.
#
# @todo Move exceptions to clients?
#
# @raise If no source including the set can be found.
#
def search(dependency)
......@@ -46,8 +47,10 @@ module Pod
#
# @raises If no source including the set can be found.
#
# @note Full text search requires to load the specification for each pod,
# hence is considerably slower.
# @note Full text search requires to load the specification for each
# pod, hence is considerably slower.
#
# @todo Move exceptions to clients?
#
# @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