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'
......
...@@ -55,24 +55,20 @@ module Pod ...@@ -55,24 +55,20 @@ module Pod
include Config::Mixin include Config::Mixin
# @return [Sandbox] # @return [Sandbox] The sandbox where the Pods should be installed.
# the sandbox where the Pods should be installed.
# #
attr_reader :sandbox attr_reader :sandbox
# @return [Podfile] # @return [Podfile] The Podfile specification that contains the information
# the Podfile specification that contains the information of the Pods # of the Pods that should be installed.
# that should be installed.
# #
attr_reader :podfile attr_reader :podfile
# @return [Lockfile] # @return [Lockfile] The Lockfile that stores the information about the
# the Lockfile that stores the information about the Pods previously # Pods previously installed on any machine.
# installed on any machine.
# #
attr_reader :lockfile attr_reader :lockfile
# @param [Sandbox] sandbox @see sandbox # @param [Sandbox] sandbox @see sandbox
# @param [Podfile] podfile @see podfile # @param [Podfile] podfile @see podfile
# @param [Lockfile] lockfile @see lockfile # @param [Lockfile] lockfile @see lockfile
...@@ -84,10 +80,9 @@ module Pod ...@@ -84,10 +80,9 @@ module Pod
@lockfile = lockfile @lockfile = lockfile
end end
# @return [Bool] # @return [Bool] Whether the installer is in update mode. In update mode
# whether the installer is in update mode. In update mode the contents of # the contents of the Lockfile are not taken into account for
# the Lockfile are not taken into account for deciding what Pods to # deciding what Pods to install.
# install.
# #
attr_accessor :update_mode attr_accessor :update_mode
...@@ -120,7 +115,6 @@ module Pod ...@@ -120,7 +115,6 @@ module Pod
integrate_user_project integrate_user_project
end end
# <<<<<<< HEAD
# Performs only the computation parts of an installation. # Performs only the computation parts of an installation.
# #
# It is used by the `outdated` subcommand. # It is used by the `outdated` subcommand.
...@@ -225,9 +219,9 @@ module Pod ...@@ -225,9 +219,9 @@ module Pod
# #
# @return [void] # @return [void]
# #
# TODO: If there is not Lockfile all the Pods should be marked as added. # @todo If there is not Lockfile all the Pods should be marked as added.
# #
# TODO: Once the manifest.lock is implemented only the unchanged pods # @todo Once the manifest.lock is implemented only the unchanged pods
# should be tracked. # should be tracked.
# #
def generate_pods_by_podfile_state def generate_pods_by_podfile_state
...@@ -260,18 +254,20 @@ module Pod ...@@ -260,18 +254,20 @@ module Pod
pods_unchanged_from_the_lockfile .each { |pod| UI.message("-" + "#{pod}", '', 2) } pods_unchanged_from_the_lockfile .each { |pod| UI.message("-" + "#{pod}", '', 2) }
end end
# @return [void] Lazily updates the source repositories. The update is # Lazily updates the source repositories. The update is triggered if:
# triggered if: #
# - There are pods that changed in the Podfile. # - There are pods that changed in the Podfile.
# - The lockfile is missing. # - The lockfile is missing.
# - The installer is in update_mode. # - The installer is in update_mode.
# #
# TODO: Remove the lockfile condition once compare_podfile_and_lockfile # @todo Remove the lockfile condition once compare_podfile_and_lockfile
# is updated. # is updated.
# #
# TODO: Lazy resolution can't be done if we want to fully support detection # @todo Lazy resolution can't be done if we want to fully support detection
# of changes in specifications checksum. # of changes in specifications checksum.
# #
# @return [void]
#
def update_repositories_if_needed def update_repositories_if_needed
return if config.skip_repo_update? return if config.skip_repo_update?
changed_pods = (pods_changed_from_the_lockfile + pods_deleted_from_the_lockfile) changed_pods = (pods_changed_from_the_lockfile + pods_deleted_from_the_lockfile)
...@@ -306,8 +302,8 @@ module Pod ...@@ -306,8 +302,8 @@ module Pod
# resolver needs the specifications to analyze their dependencies # resolver needs the specifications to analyze their dependencies
# (which might be from external sources). # (which might be from external sources).
# #
# @note In update mode the resolver is set to always update the specs from # @note In update mode the resolver is set to always update the specs
# external sources. # from external sources.
# #
# @return [void] # @return [void]
# #
...@@ -333,9 +329,9 @@ module Pod ...@@ -333,9 +329,9 @@ module Pod
# #
# @return [void] # @return [void]
# #
# TODO: Use {Sandbox} manifest. # @todo Use {Sandbox} manifest.
# #
# TODO: [#534] Detect if the folder of a Pod is empty. # @todo [#534] Detect if the folder of a Pod is empty.
# #
def generate_pods_that_should_be_installed def generate_pods_that_should_be_installed
changed_pods_names = [] changed_pods_names = []
...@@ -366,7 +362,7 @@ module Pod ...@@ -366,7 +362,7 @@ module Pod
# #
# @return [void] # @return [void]
# #
# TODO: [#535] Pods should be accumulated per Target, also in the Local # @todo [#535] Pods should be accumulated per Target, also in the Local
# Pod class. The Local Pod class should have a method to add itself # Pod class. The Local Pod class should have a method to add itself
# to a given project so it can use the sources of all the activated # to a given project so it can use the sources of all the activated
# podspecs across all targets. Also cleaning should take into account # podspecs across all targets. Also cleaning should take into account
...@@ -385,24 +381,6 @@ module Pod ...@@ -385,24 +381,6 @@ module Pod
end end
@local_pods = local_pods_by_target.values.flatten.uniq.sort_by { |pod| pod.name.downcase } @local_pods = local_pods_by_target.values.flatten.uniq.sort_by { |pod| pod.name.downcase }
# =======
# def project
# return @project if @project
# @project = Pod::Project.new(sandbox)
# # TODO
# # @project.user_build_configurations = @podfile.user_build_configurations
# pods.each { |p| p.add_file_references_to_project(@project) }
# pods.each { |p| p.link_headers }
# @project.add_podfile(config.project_podfile)
# @project
# end
#
# def target_installers
# @target_installers ||= @podfile.target_definitions.values.map do |definition|
# pods_for_target = pods_by_target[definition]
# TargetInstaller.new(project, definition, pods_for_target) unless definition.empty?
# end.compact
# >>>>>>> core-extraction
end end
#---------------------------------------------------------------------------# #---------------------------------------------------------------------------#
...@@ -426,7 +404,7 @@ module Pod ...@@ -426,7 +404,7 @@ module Pod
# @return [void] In this step we clean all the folders that will be # @return [void] In this step we clean all the folders that will be
# regenerated from scratch and any file which might not be overwritten. # regenerated from scratch and any file which might not be overwritten.
# #
# @TODO: Clean the podspecs of all the pods that aren't unchanged so the # @todo Clean the podspecs of all the pods that aren't unchanged so the
# resolution process doesn't get confused by them. # resolution process doesn't get confused by them.
# #
def clean_global_support_files def clean_global_support_files
...@@ -436,8 +414,8 @@ module Pod ...@@ -436,8 +414,8 @@ module Pod
# @return [void] In this step we clean all the files related to the removed # @return [void] In this step we clean all the files related to the removed
# Pods. # Pods.
# #
# @TODO: Use the local pod implode. # @todo Use the local pod implode.
# @TODO: [#534] Clean all the Pods folder that are not unchanged? # @todo [#534] Clean all the Pods folder that are not unchanged?
# #
def clean_removed_pods def clean_removed_pods
UI.section "Removing deleted dependencies" do UI.section "Removing deleted dependencies" do
...@@ -454,7 +432,7 @@ module Pod ...@@ -454,7 +432,7 @@ module Pod
# installed. We clean the files that might affect the resolution process # installed. We clean the files that might affect the resolution process
# and the files that might not be overwritten. # and the files that might not be overwritten.
# #
# @TODO: [#247] Clean the headers of only the pods to install. # @todo [#247] Clean the headers of only the pods to install.
# #
def clean_pods_to_install def clean_pods_to_install
...@@ -486,7 +464,7 @@ module Pod ...@@ -486,7 +464,7 @@ module Pod
# @note In this step we clean also the Pods that have been pre-downloaded # @note In this step we clean also the Pods that have been pre-downloaded
# in AbstractExternalSource#specification_from_sandbox. # in AbstractExternalSource#specification_from_sandbox.
# #
# TODO: [#529] Podspecs should not be preserved anymore to prevent user # @todo [#529] Podspecs should not be preserved anymore to prevent user
# confusion. Currently we are copying the ones form external sources # confusion. Currently we are copying the ones form external sources
# in `Local Podspecs` and this feature is not needed anymore. # in `Local Podspecs` and this feature is not needed anymore.
# I think that copying all the used podspecs would be helpful for # I think that copying all the used podspecs would be helpful for
...@@ -501,8 +479,9 @@ module Pod ...@@ -501,8 +479,9 @@ module Pod
pod.clean! if config.clean? pod.clean! if config.clean?
end end
# @return [void] Downloads a Pod forcing the `bleeding edge' version if # Downloads a Pod forcing the `bleeding edge' version if requested.
# requested. #
# @return [void]
# #
def download_pod(pod) def download_pod(pod)
downloader = Downloader.for_pod(pod) downloader = Downloader.for_pod(pod)
...@@ -520,8 +499,10 @@ module Pod ...@@ -520,8 +499,10 @@ module Pod
pod.downloaded = true pod.downloaded = true
end end
# @return [void] Generates the documentation of a Pod unless it exists # Generates the documentation of a Pod unless it exists for a given
# for a given version. # version.
#
# @return [void]
# #
def generate_docs_if_needed(pod) def generate_docs_if_needed(pod)
doc_generator = Generator::Documentation.new(pod) doc_generator = Generator::Documentation.new(pod)
...@@ -535,8 +516,8 @@ module Pod ...@@ -535,8 +516,8 @@ module Pod
# Creates and populates the targets of the pods project. # Creates and populates the targets of the pods project.
# #
# @note Post install hooks run _before_ saving of project, so that they can # @note Post install hooks run _before_ saving of project, so that they
# alter it before saving. # can alter it before it is writtent to the disk.
# #
# @return [void] # @return [void]
# #
...@@ -554,14 +535,15 @@ module Pod ...@@ -554,14 +535,15 @@ module Pod
# Creates the Pods project from scratch if it doesn't exists. # Creates the Pods project from scratch if it doesn't exists.
# #
# TODO clean and modify the project if it exists. # @todo Restore the build configuration support.
# @todo Clean and modify the project if it exists.
# #
# @return [void] # @return [void]
# #
def prepare_pods_project def prepare_pods_project
UI.message "- Creating Pods project" do UI.message "- Creating Pods project" do
@pods_project = Pod::Project.new(config.sandbox) @pods_project = Pod::Project.new(config.sandbox)
# TODO @pods_project.add_podfile(config.project_podfile)
# pods_project.user_build_configurations = podfile.user_build_configurations # pods_project.user_build_configurations = podfile.user_build_configurations
end end
end end
...@@ -574,7 +556,6 @@ module Pod ...@@ -574,7 +556,6 @@ module Pod
@target_installers = podfile.target_definitions.values.map do |definition| @target_installers = podfile.target_definitions.values.map do |definition|
pods_for_target = local_pods_by_target[definition] pods_for_target = local_pods_by_target[definition]
TargetInstaller.new(pods_project, definition, pods_for_target) unless definition.empty? TargetInstaller.new(pods_project, definition, pods_for_target) unless definition.empty?
# TargetInstaller.new(podfile, pods_project, definition) unless definition.empty?
end.compact end.compact
end end
...@@ -586,24 +567,25 @@ module Pod ...@@ -586,24 +567,25 @@ module Pod
# #
# @return [void] # @return [void]
# #
# TODO Clean the groups of the deleted Pods and add only the Pods that # @todo Clean the groups of the deleted Pods and add only the Pods that
# should be installed. # should be installed.
# # @todo [#588] Add file references for the resources of the Pods as well
# TODO [#588] Add file references for the resources of the Pods as well so # so they are visible for the user.
# they are visible for the user.
# #
def add_source_files_to_pods_project def add_source_files_to_pods_project
UI.message "- Adding source files to Pods project" do UI.message "- Adding source files to Pods project" do
local_pods.each { |p| p.add_file_references_to_project(pods_project) } local_pods.each { |p| p.add_file_references_to_project(pods_project) }
local_pods.each { |p| p.link_headers } local_pods.each { |p| p.link_headers }
end end
# <<<<<<< HEAD
# =======
#
# UserProjectIntegrator.new(@podfile).integrate! if config.integrate_targets?
# >>>>>>> core-extraction
end end
# Runs the pre install hooks of the installed specs and of the Podfile.
#
# @todo Run the hooks only for the installed pods.
# @todo Print a messsage with the names of the specs.
#
# @return [void]
#
def run_pre_install_hooks def run_pre_install_hooks
UI.message "- Running pre install hooks" do UI.message "- Running pre install hooks" do
local_pods_by_target.each do |target_definition, pods| local_pods_by_target.each do |target_definition, pods|
...@@ -615,10 +597,15 @@ module Pod ...@@ -615,10 +597,15 @@ module Pod
end end
end end
# Runs the post install hooks of the installed specs and of the Podfile.
#
# @todo Run the hooks only for the installed pods.
# @todo Print a messsage with the names of the specs.
#
# @return [void]
#
def run_post_install_hooks def run_post_install_hooks
UI.message "- Running post install hooks" do UI.message "- Running post install hooks" do
# we loop over target installers instead of pods, because we yield the
# target installer to the spec post install hook.
target_installers.each do |target_installer| target_installers.each do |target_installer|
specs_by_target[target_installer.target_definition].each do |spec| specs_by_target[target_installer.target_definition].each do |spec|
spec.post_install!(target_installer) spec.post_install!(target_installer)
...@@ -628,12 +615,16 @@ module Pod ...@@ -628,12 +615,16 @@ module Pod
end end
end end
# Installs the targets of the Pods projects and generates their support
# files.
#
# @todo Move the acknowledgements to the target installer?
#
def generate_target_support_files def generate_target_support_files
UI.message"- Installing targets" do UI.message"- Installing targets" do
target_installers.each do |target_installer| target_installers.each do |target_installer|
pods_for_target = local_pods_by_target[target_installer.target_definition] pods_for_target = local_pods_by_target[target_installer.target_definition]
target_installer.install! target_installer.install!
# TODO
acknowledgements_path = target_installer.library.acknowledgements_path acknowledgements_path = target_installer.library.acknowledgements_path
Generator::Acknowledgements.new(target_installer.target_definition, Generator::Acknowledgements.new(target_installer.target_definition,
pods_for_target).save_as(acknowledgements_path) pods_for_target).save_as(acknowledgements_path)
...@@ -642,6 +633,11 @@ module Pod ...@@ -642,6 +633,11 @@ module Pod
end end
end end
# Generates a dummy source file for each target so libraries that contain
# only cathegories build.
#
# @todo Move to the target installer?
#
def generate_dummy_source(target_installer) def generate_dummy_source(target_installer)
class_name_identifier = target_installer.target_definition.label class_name_identifier = target_installer.target_definition.label
dummy_source = Generator::DummySource.new(class_name_identifier) dummy_source = Generator::DummySource.new(class_name_identifier)
...@@ -666,7 +662,7 @@ module Pod ...@@ -666,7 +662,7 @@ module Pod
# #
# @return [void] # @return [void]
# #
# TODO: [#552] Implement # @todo [#552] Implement manifest.
# #
def write_lockfiles def write_lockfiles
@lockfile = Lockfile.generate(podfile, specs_by_target.values.flatten) @lockfile = Lockfile.generate(podfile, specs_by_target.values.flatten)
...@@ -688,10 +684,10 @@ module Pod ...@@ -688,10 +684,10 @@ module Pod
# #
# @return [void] # @return [void]
# #
# TODO: [#397] The libraries should be cleaned and the re-added on every # @todo [#397] The libraries should be cleaned and the re-added on every
# installation. Maybe a clean_user_project phase should be added. # installation. Maybe a clean_user_project phase should be added.
# #
# TODO: [#588] The resources should be added through a build phase instead # @todo [#588] The resources should be added through a build phase instead
# of using a script. # of using a script.
# #
def integrate_user_project def integrate_user_project
......
...@@ -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