Commit 80c0723e authored by Marius Rackwitz's avatar Marius Rackwitz

[Doc] Fix some method documentations

parent 03a8cb35
...@@ -48,7 +48,14 @@ module Pod ...@@ -48,7 +48,14 @@ module Pod
raise Informative, "#{ filepath } doesn't exist." raise Informative, "#{ filepath } doesn't exist."
end end
# Looks up an executable in the search paths
#
# @note
# Thank you homebrew # Thank you homebrew
#
# @param [String] cmd
# the executable to look up
#
def which(cmd) def which(cmd)
dir = ENV['PATH'].split(':').find { |p| File.executable? File.join(p, cmd) } dir = ENV['PATH'].split(':').find { |p| File.executable? File.join(p, cmd) }
Pathname.new(File.join(dir, cmd)) unless dir.nil? Pathname.new(File.join(dir, cmd)) unless dir.nil?
......
...@@ -28,6 +28,11 @@ module Pod ...@@ -28,6 +28,11 @@ module Pod
# Applies the given changes to the config for the duration of the given # Applies the given changes to the config for the duration of the given
# block. # block.
# #
# @param [Hash<#to_sym,Object>] changes
# the changes to merge temporarily with the current config
#
# @yield [] is called while the changes are applied
#
def with_changes(changes) def with_changes(changes)
old = {} old = {}
changes.keys.each do |key| changes.keys.each do |key|
......
...@@ -59,6 +59,9 @@ module Pod ...@@ -59,6 +59,9 @@ module Pod
# @param [Hash<#to_s, #to_s>] params # @param [Hash<#to_s, #to_s>] params
# the download parameters of the pod being downloaded. # the download parameters of the pod being downloaded.
# #
# @param [Specification] spec
# the specification of the pod being downloaded.
#
# @return [String] The slug used to store the files resulting from this # @return [String] The slug used to store the files resulting from this
# download request. # download request.
# #
......
...@@ -8,6 +8,14 @@ module Pod ...@@ -8,6 +8,14 @@ module Pod
# source. # source.
# #
module ExternalSources module ExternalSources
# Instantiate a matching {AbstractExternalSource} for a given dependency.
#
# @param [Dependency] dependency
# the dependency
#
# @param [String] podfile_path
# @see AbstractExternalSource#podfile_path
#
# @return [AbstractExternalSource] an initialized instance of the concrete # @return [AbstractExternalSource] an initialized instance of the concrete
# external source class associated with the option specified in the # external source class associated with the option specified in the
# hash. # hash.
...@@ -26,6 +34,11 @@ module Pod ...@@ -26,6 +34,11 @@ module Pod
end end
end end
# Get the class to represent the defined source type of a dependency
#
# @param [Array<Symbol>] params
# the source params of the dependency
#
# @return [Class] # @return [Class]
# #
def self.concrete_class_from_params(params) def self.concrete_class_from_params(params)
......
...@@ -41,7 +41,7 @@ module Pod ...@@ -41,7 +41,7 @@ module Pod
# Fetches the external source from the remote according to the params. # Fetches the external source from the remote according to the params.
# #
# @param [Sandbox] sandbox # @param [Sandbox] _sandbox
# the sandbox where the specification should be stored. # the sandbox where the specification should be stored.
# #
# @return [void] # @return [void]
...@@ -58,6 +58,11 @@ module Pod ...@@ -58,6 +58,11 @@ module Pod
protected protected
# Return the normalized path for a podspec for a relative declared path.
#
# @param [String] declared_path
# The path declared in the podfile.
#
# @return [String] The uri of the podspec appending the name of the file # @return [String] The uri of the podspec appending the name of the file
# and expanding it if necessary. # and expanding it if necessary.
# #
......
...@@ -13,9 +13,11 @@ module Pod ...@@ -13,9 +13,11 @@ module Pod
# #
attr_reader :platform attr_reader :platform
# @param [Hash{String, Array{String}] # @param [Hash<String, Array<String>>] resources_by_config
# resources_by_config @see resources_by_config # @see resources_by_config
# @param [Platform] platform @see platform #
# @param [Platform] platform
# @see platform
# #
def initialize(resources_by_config, platform) def initialize(resources_by_config, platform)
@resources_by_config = resources_by_config @resources_by_config = resources_by_config
......
...@@ -34,10 +34,7 @@ module Pod ...@@ -34,10 +34,7 @@ module Pod
@specs_by_configuration = specs_by_configuration @specs_by_configuration = specs_by_configuration
end end
# Generates and saves the file. # Generates the file contents.
#
# @param [Pathname] pathname
# The path where to save the generated file.
# #
# @return [void] # @return [void]
# #
......
...@@ -11,7 +11,8 @@ module Pod ...@@ -11,7 +11,8 @@ module Pod
# @param [Array<String>] strings # @param [Array<String>] strings
# a list of strings. # a list of strings.
# #
# @param [String] optional prefix, such as a flag or option. # @param [String] prefix
# optional prefix, such as a flag or option.
# #
# @return [String] the resulting string. # @return [String] the resulting string.
# #
...@@ -20,6 +21,12 @@ module Pod ...@@ -20,6 +21,12 @@ module Pod
strings.sort.map { |s| %W( #{prefix}"#{s}" ) }.join(' ') strings.sort.map { |s| %W( #{prefix}"#{s}" ) }.join(' ')
end end
# Return the default linker flags
#
# @param [Target] target
# the target, which is used to check if the ARC compatibility
# flag is required.
#
# @return [String] the default linker flags. `-ObjC` is always included # @return [String] the default linker flags. `-ObjC` is always included
# while `-fobjc-arc` is included only if requested in the # while `-fobjc-arc` is included only if requested in the
# Podfile. # Podfile.
...@@ -35,7 +42,7 @@ module Pod ...@@ -35,7 +42,7 @@ module Pod
# Configures the given Xcconfig # Configures the given Xcconfig
# #
# @param [PodTarget] pod_target # @param [PodTarget] target
# The pod target, which holds the list of +Spec::FileAccessor+. # The pod target, which holds the list of +Spec::FileAccessor+.
# #
# @param [Xcodeproj::Config] xcconfig # @param [Xcodeproj::Config] xcconfig
......
...@@ -11,35 +11,35 @@ module Pod ...@@ -11,35 +11,35 @@ module Pod
# Stores the information of the Installer for the hooks # Stores the information of the Installer for the hooks
# #
class PodRepresentation class PodRepresentation
# @return [String] # @return [String] the name of the pod
# #
attr_accessor :name attr_accessor :name
# @return [Version] # @return [Version] the version
# #
def version def version
root_spec.version root_spec.version
end end
# @return [Specification] # @return [Specification] the root spec
# #
def root_spec def root_spec
file_accessors.first.spec.root file_accessors.first.spec.root
end end
# @return [Array<Specification>] # @return [Array<Specification>] the specs
# #
def specs def specs
file_accessors.map(&:spec).uniq file_accessors.map(&:spec).uniq
end end
# @return [Pathname] # @return [Pathname] the root path
# #
def root def root
file_accessors.first.path_list.root file_accessors.first.path_list.root
end end
# @return [Array<Pathname>] # @return [Array<Pathname>] the source files
# #
def source_files def source_files
file_accessors.map(&:source_files).flatten.uniq file_accessors.map(&:source_files).flatten.uniq
......
...@@ -172,6 +172,8 @@ module Pod ...@@ -172,6 +172,8 @@ module Pod
# @!group Installation steps # @!group Installation steps
# Performs the analysis.
#
# @return [void] # @return [void]
# #
# @note The warning about the version of the Lockfile doesn't use the # @note The warning about the version of the Lockfile doesn't use the
...@@ -707,18 +709,20 @@ module Pod ...@@ -707,18 +709,20 @@ module Pod
# @!group Hooks Data # @!group Hooks Data
# Creates a hook representation for this installer.
#
# @return [InstallerRepresentation] # @return [InstallerRepresentation]
# #
def installer_rep def installer_rep
Hooks::InstallerRepresentation.new(self) Hooks::InstallerRepresentation.new(self)
end end
# @return [PodRepresentation] The hook representation of a Pod. # Creates a hook representation for a Pod.
# #
# @param [String] pod # @param [String] pod
# The name of the pod. # The name of the pod.
# #
# @return [PodRepresentation] The pod representation. # @return [PodRepresentation]
# #
def pod_rep(pod) def pod_rep(pod)
all_file_accessors = pod_targets.map(&:file_accessors).flatten.compact all_file_accessors = pod_targets.map(&:file_accessors).flatten.compact
...@@ -726,18 +730,27 @@ module Pod ...@@ -726,18 +730,27 @@ module Pod
Hooks::PodRepresentation.new(pod, file_accessors) Hooks::PodRepresentation.new(pod, file_accessors)
end end
# Creates a hook representation for a given aggregate target.
#
# @param [AggregateTarget] aggregate_target
# the aggregate target
#
# @return [LibraryRepresentation] # @return [LibraryRepresentation]
# #
def library_rep(aggregate_target) def library_rep(aggregate_target)
Hooks::LibraryRepresentation.new(sandbox, aggregate_target) Hooks::LibraryRepresentation.new(sandbox, aggregate_target)
end end
# Creates hook representations for all aggregate targets.
#
# @return [Array<LibraryRepresentation>] # @return [Array<LibraryRepresentation>]
# #
def library_reps def library_reps
@library_reps ||= aggregate_targets.map { |lib| library_rep(lib) } @library_reps ||= aggregate_targets.map { |lib| library_rep(lib) }
end end
# Creates hook representations for all #root_specs.
#
# @return [Array<PodRepresentation>] # @return [Array<PodRepresentation>]
# #
def pod_reps def pod_reps
......
...@@ -44,6 +44,9 @@ module Pod ...@@ -44,6 +44,9 @@ module Pod
# compute which specification should be installed. The manifest of the # compute which specification should be installed. The manifest of the
# sandbox returns which specifications are installed. # sandbox returns which specifications are installed.
# #
# @param [Bool] allow_fetches
# whether external sources may be fetched
#
# @return [AnalysisResult] # @return [AnalysisResult]
# #
def analyze(allow_fetches = true) def analyze(allow_fetches = true)
...@@ -72,6 +75,9 @@ module Pod ...@@ -72,6 +75,9 @@ module Pod
podfile_needs_install?(analysis_result) || sandbox_needs_install?(analysis_result) podfile_needs_install?(analysis_result) || sandbox_needs_install?(analysis_result)
end end
# @param [AnalysisResult] analysis_result
# the analysis result to check for changes
#
# @return [Bool] Whether the podfile has changes respect to the lockfile. # @return [Bool] Whether the podfile has changes respect to the lockfile.
# #
def podfile_needs_install?(analysis_result) def podfile_needs_install?(analysis_result)
...@@ -80,6 +86,9 @@ module Pod ...@@ -80,6 +86,9 @@ module Pod
!needing_install.empty? !needing_install.empty?
end end
# @param [AnalysisResult] analysis_result
# the analysis result to check for changes
#
# @return [Bool] Whether the sandbox is in synch with the lockfile. # @return [Bool] Whether the sandbox is in synch with the lockfile.
# #
def sandbox_needs_install?(analysis_result) def sandbox_needs_install?(analysis_result)
...@@ -804,10 +813,10 @@ module Pod ...@@ -804,10 +813,10 @@ module Pod
# Adds the name of a Pod to the give state. # Adds the name of a Pod to the give state.
# #
# @param [String] # @param [String] name
# the name of the Pod. # the name of the Pod.
# #
# @param [Symbol] # @param [Symbol] state
# the state of the Pod. # the state of the Pod.
# #
# @return [void] # @return [void]
......
...@@ -66,7 +66,7 @@ module Pod ...@@ -66,7 +66,7 @@ module Pod
# Performs the analysis to the detect the state of the sandbox respect # Performs the analysis to the detect the state of the sandbox respect
# to the resolved specifications. # to the resolved specifications.
# #
# @return [SpecsState] the state of the sandbox. # @return [void]
# #
def analyze def analyze
state = SpecsState.new state = SpecsState.new
......
...@@ -13,6 +13,15 @@ module Pod ...@@ -13,6 +13,15 @@ module Pod
# #
attr_accessor :umbrella_targets attr_accessor :umbrella_targets
# Generate a {HooksContext}.
#
# @param [Sandbox] sandbox
# The sandbox
#
# @param [Array<AggregateTarget>] aggregate_targets
# The aggregate targets, which will been presented by an adequate
# {UmbrellaTargetDescription} in the generated context.
#
# @return [HooksContext] Convenience class method to generate the # @return [HooksContext] Convenience class method to generate the
# static context. # static context.
# #
......
...@@ -8,7 +8,8 @@ module Pod ...@@ -8,7 +8,8 @@ module Pod
class << self class << self
# Performs the migration. # Performs the migration.
# #
# @param [Sandbox] The sandbox which should be migrated. # @param [Sandbox] sandbox
# The sandbox which should be migrated.
# #
def migrate(sandbox) def migrate(sandbox)
if sandbox.manifest if sandbox.manifest
...@@ -21,6 +22,8 @@ module Pod ...@@ -21,6 +22,8 @@ module Pod
# Migrates from CocoaPods versions previous to 0.34. # Migrates from CocoaPods versions previous to 0.34.
# #
# @param [Sandbox] sandbox
#
def migrate_to_0_34(sandbox) def migrate_to_0_34(sandbox)
UI.message('Migrating to CocoaPods 0.34') do UI.message('Migrating to CocoaPods 0.34') do
delete(sandbox.root + 'Headers') delete(sandbox.root + 'Headers')
...@@ -49,6 +52,8 @@ module Pod ...@@ -49,6 +52,8 @@ module Pod
# Migrates from CocoaPods versions prior to 0.36. # Migrates from CocoaPods versions prior to 0.36.
# #
# @param [Sandbox] sandbox
#
def migrate_to_0_36(sandbox) def migrate_to_0_36(sandbox)
UI.message('Migrating to CocoaPods 0.36') do UI.message('Migrating to CocoaPods 0.36') do
move(sandbox.root + 'Headers/Build', sandbox.root + 'Headers/Private') move(sandbox.root + 'Headers/Build', sandbox.root + 'Headers/Private')
...@@ -69,6 +74,16 @@ module Pod ...@@ -69,6 +74,16 @@ module Pod
# @!group Private helpers # @!group Private helpers
# Check whether a migration is required
#
# @param [#to_s] target_version
# See Version#new.
#
# @param [Sandbox] sandbox
# The sandbox
#
# @return [void]
#
def installation_minor?(target_version, sandbox) def installation_minor?(target_version, sandbox)
sandbox.manifest.cocoapods_version < Version.new(target_version) sandbox.manifest.cocoapods_version < Version.new(target_version)
end end
...@@ -79,6 +94,8 @@ module Pod ...@@ -79,6 +94,8 @@ module Pod
# @path [#to_s] path # @path [#to_s] path
# The path. # The path.
# #
# @return [void]
#
def make_path(path) def make_path(path)
return if path.exist? return if path.exist?
UI.message "- Making path #{UI.path(path)}" do UI.message "- Making path #{UI.path(path)}" do
...@@ -94,6 +111,8 @@ module Pod ...@@ -94,6 +111,8 @@ module Pod
# @path [#to_s] destination # @path [#to_s] destination
# The destination path. # The destination path.
# #
# @return [void]
#
def move(source, destination) def move(source, destination)
return unless source.exist? return unless source.exist?
make_path(destination.dirname) make_path(destination.dirname)
...@@ -108,6 +127,8 @@ module Pod ...@@ -108,6 +127,8 @@ module Pod
# @path [#to_s] path # @path [#to_s] path
# The path. # The path.
# #
# @return [void]
#
def delete(path) def delete(path)
return unless path.exist? return unless path.exist?
UI.message "- Deleting #{UI.path(path)}" do UI.message "- Deleting #{UI.path(path)}" do
......
...@@ -8,7 +8,7 @@ module Pod ...@@ -8,7 +8,7 @@ module Pod
# @note This class needs to consider all the activated specs of a Pod. # @note This class needs to consider all the activated specs of a Pod.
# #
class PodSourceInstaller class PodSourceInstaller
# @return [Sandbox] # @return [Sandbox] The installation target.
# #
attr_reader :sandbox attr_reader :sandbox
...@@ -68,7 +68,7 @@ module Pod ...@@ -68,7 +68,7 @@ module Pod
lock_installation unless local? lock_installation unless local?
end end
# @return [Hash] # @return [Hash] @see Downloader#checkout_options
# #
attr_reader :specific_source attr_reader :specific_source
......
...@@ -257,6 +257,8 @@ module Pod ...@@ -257,6 +257,8 @@ module Pod
# Read the project from the disk to ensure that it is up to date as # Read the project from the disk to ensure that it is up to date as
# other TargetIntegrators might have modified it. # other TargetIntegrators might have modified it.
# #
# @return [Project]
#
def user_project def user_project
@user_project ||= Xcodeproj::Project.open(target.user_project_path) @user_project ||= Xcodeproj::Project.open(target.user_project_path)
end end
......
...@@ -16,6 +16,14 @@ module OpenURI ...@@ -16,6 +16,14 @@ module OpenURI
# (RFC 2109 4.3.1, RFC 2965 3.3, RFC 2616 15.1.3) # (RFC 2109 4.3.1, RFC 2965 3.3, RFC 2616 15.1.3)
# However this is ad hoc. It should be extensible/configurable. # However this is ad hoc. It should be extensible/configurable.
# #
# @param [URI::Generic] uri1
# the origin uri from where the redirect origins
#
# @param [URI::Generic] uri2
# the target uri where to where the redirect points to
#
# @return [Bool]
#
def self.redirectable?(uri1, uri2) def self.redirectable?(uri1, uri2)
uri1.scheme.downcase == uri2.scheme.downcase || uri1.scheme.downcase == uri2.scheme.downcase ||
(/\A(?:http|ftp)\z/i =~ uri1.scheme && /\A(?:https?|ftp)\z/i =~ uri2.scheme) (/\A(?:http|ftp)\z/i =~ uri1.scheme && /\A(?:https?|ftp)\z/i =~ uri2.scheme)
......
...@@ -246,6 +246,8 @@ module Pod ...@@ -246,6 +246,8 @@ 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).
# #
# @return [void]
#
# @todo Store all the specifications (including those not originating # @todo Store all the specifications (including those not originating
# from external sources) so users can check them. # from external sources) so users can check them.
# #
......
...@@ -56,19 +56,19 @@ module Pod ...@@ -56,19 +56,19 @@ module Pod
# @!group Adding headers # @!group Adding headers
# Adds a header to the directory. # Adds headers to the directory.
# #
# @param [Pathname] namespace_path # @param [Pathname] namespace
# the path where the header file should be stored relative to the # the path where the header file should be stored relative to the
# headers directory. # headers directory.
# #
# @param [Pathname] relative_header_path # @param [Array<Pathname>] relative_header_paths
# the path of the header file relative to the Pods project # the path of the header file relative to the Pods project
# (`PODS_ROOT` variable of the xcconfigs). # (`PODS_ROOT` variable of the xcconfigs).
# #
# @note This method adds the files to the search paths. # @note This method adds the files to the search paths.
# #
# @return [Pathname] # @return [Array<Pathname>]
# #
def add_files(namespace, relative_header_paths, platform) def add_files(namespace, relative_header_paths, platform)
add_search_path(namespace, platform) add_search_path(namespace, platform)
......
...@@ -61,24 +61,41 @@ module Pod ...@@ -61,24 +61,41 @@ module Pod
# @!group Globbing # @!group Globbing
# @return [Array<Pathname>] Similar to {glob} but returns the absolute # Similar to {glob} but returns the absolute paths.
# paths. #
# @param [String,Array<String>] patterns
# @see #relative_glob
#
# @param [Hash] options
# @see #relative_glob
#
# @return [Array<Pathname>]
# #
def glob(patterns, options = {}) def glob(patterns, options = {})
relative_glob(patterns, options).map { |p| root + p } relative_glob(patterns, options).map { |p| root + p }
end end
# @return [Array<Pathname>] The list of relative paths that are case # The list of relative paths that are case insensitively matched by a
# insensitively matched by a given pattern. This method emulates # given pattern. This method emulates {Dir#glob} with the
# {Dir#glob} with the {File::FNM_CASEFOLD} option. # {File::FNM_CASEFOLD} option.
# #
# @param [String,Array<String>] patterns # @param [String,Array<String>] patterns
# A single {Dir#glob} like pattern, or a list of patterns. # A single {Dir#glob} like pattern, or a list of patterns.
# #
# @param [String] dir_pattern # @param [Hash] options
#
# @option options [String] :dir_pattern
# An optional pattern to append to a pattern, if it is the path # An optional pattern to append to a pattern, if it is the path
# to a directory. # to a directory.
# #
# @option options [Array<String>] :exclude_patterns
# Exclude specific paths given by those patterns.
#
# @option options [Array<String>] :include_dirs
# Additional paths to take into account for matching.
#
# @return [Array<Pathname>]
#
def relative_glob(patterns, options = {}) def relative_glob(patterns, options = {})
return [] if patterns.empty? return [] if patterns.empty?
......
...@@ -195,7 +195,9 @@ module Pod ...@@ -195,7 +195,9 @@ module Pod
# Updates the local clone of the spec-repo with the given name or of all # Updates the local clone of the spec-repo with the given name or of all
# the git repos if the name is omitted. # the git repos if the name is omitted.
# #
# @param [String] name # @param [String] source_name
#
# @param [Bool] show_output
# #
# @return [void] # @return [void]
# #
......
...@@ -51,8 +51,12 @@ module Pod ...@@ -51,8 +51,12 @@ module Pod
# #
attr_accessor :user_target_uuids attr_accessor :user_target_uuids
# @return [Array<PBXNativeTarget>] The list of all the user targets that # List all user targets that will be integrated by this #target.
# will be integrated by this target. #
# @param [Xcodeproj::Project] project
# The project to search for the user targets
#
# @return [Array<PBXNativeTarget>]
# #
def user_targets(project = nil) def user_targets(project = nil)
return [] unless user_project_path return [] unless user_project_path
......
...@@ -37,6 +37,16 @@ module Pod ...@@ -37,6 +37,16 @@ module Pod
# @todo Refactor to title (for always visible titles like search) # @todo Refactor to title (for always visible titles like search)
# and sections (titles that represent collapsible sections). # and sections (titles that represent collapsible sections).
# #
# @param [String] title
# The title to print
#
# @param [String] verbose_prefix
# See #message
#
# @param [FixNum] relative_indentation
# The indentation level relative to the current,
# when the message is printed.
#
def section(title, verbose_prefix = '', relative_indentation = 0) def section(title, verbose_prefix = '', relative_indentation = 0)
if config.verbose? if config.verbose?
title(title, verbose_prefix, relative_indentation) title(title, verbose_prefix, relative_indentation)
...@@ -74,6 +84,16 @@ module Pod ...@@ -74,6 +84,16 @@ module Pod
# A title opposed to a section is always visible # A title opposed to a section is always visible
# #
# @param [String] title
# The title to print
#
# @param [String] verbose_prefix
# See #message
#
# @param [FixNum] relative_indentation
# The indentation level relative to the current,
# when the message is printed.
#
def title(title, verbose_prefix = '', relative_indentation = 2) def title(title, verbose_prefix = '', relative_indentation = 2)
if @treat_titles_as_messages if @treat_titles_as_messages
message(title, verbose_prefix) message(title, verbose_prefix)
...@@ -102,6 +122,16 @@ module Pod ...@@ -102,6 +122,16 @@ module Pod
# #
# @todo Clean interface. # @todo Clean interface.
# #
# @param [String] message
# The message to print.
#
# @param [String] verbose_prefix
# See #message
#
# @param [FixNum] relative_indentation
# The indentation level relative to the current,
# when the message is printed.
#
def message(message, verbose_prefix = '', relative_indentation = 2) def message(message, verbose_prefix = '', relative_indentation = 2)
message = verbose_prefix + message if config.verbose? message = verbose_prefix + message if config.verbose?
puts_indented message if config.verbose? puts_indented message if config.verbose?
...@@ -117,6 +147,9 @@ module Pod ...@@ -117,6 +147,9 @@ module Pod
# #
# Any title printed in the optional block is treated as a message. # Any title printed in the optional block is treated as a message.
# #
# @param [String] message
# The message to print.
#
def info(message) def info(message)
indentation = config.verbose? ? self.indentation_level : 0 indentation = config.verbose? ? self.indentation_level : 0
indented = wrap_string(message, indentation) indented = wrap_string(message, indentation)
...@@ -143,6 +176,9 @@ module Pod ...@@ -143,6 +176,9 @@ module Pod
# The returned path is quoted. If the argument is nil it returns the # The returned path is quoted. If the argument is nil it returns the
# empty string. # empty string.
# #
# @param [#to_str] pathname
# The path to print.
#
def path(pathname) def path(pathname)
if pathname if pathname
from_path = config.podfile_path.dirname if config.podfile_path from_path = config.podfile_path.dirname if config.podfile_path
...@@ -156,6 +192,12 @@ module Pod ...@@ -156,6 +192,12 @@ module Pod
# Prints the textual representation of a given set. # Prints the textual representation of a given set.
# #
# @param [Set] set
# the set that should be presented.
#
# @param [Symbol] mode
# the presentation mode, either `:normal` or `:name_and_version`.
#
def pod(set, mode = :normal) def pod(set, mode = :normal)
if mode == :name_and_version if mode == :name_and_version
puts_indented "#{set.name} #{set.versions.first.version}" puts_indented "#{set.name} #{set.versions.first.version}"
...@@ -190,6 +232,15 @@ module Pod ...@@ -190,6 +232,15 @@ module Pod
# Prints a message with a label. # Prints a message with a label.
# #
# @param [String] label
# The label to print.
#
# @param [#to_s] value
# The value to print.
#
# @param [FixNum] justification
# The justification of the label.
#
def labeled(label, value, justification = 12) def labeled(label, value, justification = 12)
if value if value
title = "- #{label}:" title = "- #{label}:"
...@@ -208,6 +259,9 @@ module Pod ...@@ -208,6 +259,9 @@ module Pod
# Prints a message respecting the current indentation level and # Prints a message respecting the current indentation level and
# wrapping it to the terminal width if necessary. # wrapping it to the terminal width if necessary.
# #
# @param [String] message
# The message to print.
#
def puts_indented(message = '') def puts_indented(message = '')
indented = wrap_string(message, self.indentation_level) indented = wrap_string(message, self.indentation_level)
puts(indented) puts(indented)
...@@ -238,12 +292,18 @@ module Pod ...@@ -238,12 +292,18 @@ module Pod
# prints a message followed by a new line unless config is silent. # prints a message followed by a new line unless config is silent.
# #
# @param [String] message
# The message to print.
#
def puts(message = '') def puts(message = '')
STDOUT.puts(message) unless config.silent? STDOUT.puts(message) unless config.silent?
end end
# prints a message followed by a new line unless config is silent. # prints a message followed by a new line unless config is silent.
# #
# @param [String] message
# The message to print.
#
def print(message) def print(message)
STDOUT.print(message) unless config.silent? STDOUT.print(message) unless config.silent?
end end
...@@ -259,6 +319,8 @@ module Pod ...@@ -259,6 +319,8 @@ module Pod
# #
# @param [String] message The message to print. # @param [String] message The message to print.
# @param [Array] actions The actions that the user should take. # @param [Array] actions The actions that the user should take.
# @param [Bool] verbose_only
# Restrict the appearance of the warning to verbose mode only
# #
# return [void] # return [void]
# #
......
...@@ -167,7 +167,8 @@ module Pod ...@@ -167,7 +167,8 @@ module Pod
result_type != :error && (result_type != :warning || allow_warnings) result_type != :error && (result_type != :warning || allow_warnings)
end end
# @return [Symbol] # @return [Symbol] The type, which should been used to display the result.
# One of: `:error`, `:warning`, `:note`.
# #
def result_type def result_type
types = results.map(&:type).uniq types = results.map(&:type).uniq
...@@ -177,7 +178,8 @@ module Pod ...@@ -177,7 +178,8 @@ module Pod
end end
end end
# @return [Symbol] # @return [Symbol] The color, which should been used to display the result.
# One of: `:green`, `:yellow`, `:red`.
# #
def result_color def result_color
case result_type case result_type
......
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