Commit 132a29f2 authored by Orta Therox's avatar Orta Therox

Merge pre-install plugin

parents 2986a560 248385a1
...@@ -8,6 +8,15 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -8,6 +8,15 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements ##### Enhancements
* Schemes of development pods will now be shared.
[Boris Bügling](https://github.com/neonichu)
[#3600](https://github.com/CocoaPods/CocoaPods/issues/3600)
* Recognizes incomplete cache when the original download of a pod was
interrupted.
[Marius Rackwitz](https://github.com/mrackwitz)
[#3561](https://github.com/CocoaPods/CocoaPods/issues/3561)
* Allow opting out of pod source locking, meaning `pod try` yields editable * Allow opting out of pod source locking, meaning `pod try` yields editable
projects. projects.
[Samuel Giddins](https://github.com/segiddins) [Samuel Giddins](https://github.com/segiddins)
...@@ -19,6 +28,16 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -19,6 +28,16 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
to `PostInstallHooksContext`. to `PostInstallHooksContext`.
[Orta Therox](https://github.com/orta) [Orta Therox](https://github.com/orta)
[cocoapods#3540](https://github.com/CocoaPods/cocoapods/issues/3409) [cocoapods#3540](https://github.com/CocoaPods/cocoapods/issues/3409)
##### Bug Fixes
* `pod repo push` will now find and push JSON podspecs.
[#3494](https://github.com/CocoaPods/CocoaPods/issues/3494)
[Kyle Fuller](https://github.com/kylef)
* Flush stdin/stderr and wait a bit in `executable`.
[Boris Bügling](https://github.com/neonichu)
[#3500](https://github.com/CocoaPods/CocoaPods/issues/3500)
## 0.37.1 ## 0.37.1
......
...@@ -30,6 +30,7 @@ group :development do ...@@ -30,6 +30,7 @@ group :development do
gem 'mocha-on-bacon' gem 'mocha-on-bacon'
gem 'prettybacon' gem 'prettybacon'
gem 'webmock' gem 'webmock'
gem 'inch'
# Integration tests # Integration tests
gem 'diffy' gem 'diffy'
......
...@@ -98,6 +98,7 @@ GEM ...@@ -98,6 +98,7 @@ GEM
colored (~> 1.2) colored (~> 1.2)
diffy diffy
cocoapods-dependencies (0.4.0) cocoapods-dependencies (0.4.0)
coderay (1.1.0)
colored (1.2) colored (1.2)
crack (0.4.2) crack (0.4.2)
safe_yaml (~> 1.0.0) safe_yaml (~> 1.0.0)
...@@ -106,6 +107,11 @@ GEM ...@@ -106,6 +107,11 @@ GEM
ffi (1.9.6) ffi (1.9.6)
fuzzy_match (2.0.4) fuzzy_match (2.0.4)
i18n (0.7.0) i18n (0.7.0)
inch (0.5.10)
pry
sparkr (>= 0.2.0)
term-ansicolor
yard (~> 0.8.7.5)
json (1.7.7) json (1.7.7)
kicker (3.0.0) kicker (3.0.0)
listen (~> 1.3.0) listen (~> 1.3.0)
...@@ -115,6 +121,7 @@ GEM ...@@ -115,6 +121,7 @@ GEM
rb-inotify (>= 0.9) rb-inotify (>= 0.9)
rb-kqueue (>= 0.2) rb-kqueue (>= 0.2)
metaclass (0.0.4) metaclass (0.0.4)
method_source (0.8.2)
minitest (5.6.1) minitest (5.6.1)
mocha (1.1.0) mocha (1.1.0)
metaclass (~> 0.0.1) metaclass (~> 0.0.1)
...@@ -128,6 +135,10 @@ GEM ...@@ -128,6 +135,10 @@ GEM
powerpack (0.1.0) powerpack (0.1.0)
prettybacon (0.0.2) prettybacon (0.0.2)
bacon (~> 1.2) bacon (~> 1.2)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rainbow (2.0.0) rainbow (2.0.0)
rake (10.4.2) rake (10.4.2)
rb-fsevent (0.9.4) rb-fsevent (0.9.4)
...@@ -144,12 +155,18 @@ GEM ...@@ -144,12 +155,18 @@ GEM
ruby-prof (0.15.2) ruby-prof (0.15.2)
ruby-progressbar (1.7.1) ruby-progressbar (1.7.1)
safe_yaml (1.0.4) safe_yaml (1.0.4)
slop (3.6.0)
sparkr (0.4.1)
term-ansicolor (1.3.0)
tins (~> 1.0)
thread_safe (0.3.5) thread_safe (0.3.5)
tins (1.3.5)
tzinfo (1.2.2) tzinfo (1.2.2)
thread_safe (~> 0.1) thread_safe (~> 0.1)
webmock (1.20.4) webmock (1.20.4)
addressable (>= 2.3.6) addressable (>= 2.3.6)
crack (>= 0.3.2) crack (>= 0.3.2)
yard (0.8.7.6)
PLATFORMS PLATFORMS
ruby ruby
...@@ -168,6 +185,7 @@ DEPENDENCIES ...@@ -168,6 +185,7 @@ DEPENDENCIES
cocoapods-trunk! cocoapods-trunk!
cocoapods-try! cocoapods-try!
diffy diffy
inch
json (= 1.7.7) json (= 1.7.7)
kicker kicker
mocha mocha
......
...@@ -141,6 +141,9 @@ begin ...@@ -141,6 +141,9 @@ begin
title 'Running RuboCop' title 'Running RuboCop'
Rake::Task['rubocop'].invoke Rake::Task['rubocop'].invoke
title 'Running Inch'
Rake::Task['inch:spec'].invoke
end end
namespace :fixture_tarballs do namespace :fixture_tarballs do
...@@ -295,6 +298,60 @@ begin ...@@ -295,6 +298,60 @@ begin
sh 'bundle exec rubocop lib spec Rakefile' sh 'bundle exec rubocop lib spec Rakefile'
end end
#-- Inch -------------------------------------------------------------------#
namespace :inch do
desc 'Lint the completeness of the documentation with Inch'
task :spec do
require 'inch'
require 'inch/cli'
puts 'Parse docs …'
YARD::Parser::SourceParser.before_parse_file do |_|
print green('.') # Visualize progress
end
class ProgressEnumerable
include Enumerable
def initialize(array)
@array = array
end
def each
@array.each do |e|
print '.'
yield e
end
end
end
Inch::Codebase::Objects.class_eval do
alias_method :old_init, :initialize
def initialize(language, objects)
puts "\n\nEvaluating …"
old_init(language, ProgressEnumerable.new(objects))
end
end
codebase = Inch::Codebase.parse(Dir.pwd, Inch::Config.codebase)
context = Inch::API::List.new(codebase, {})
options = Inch::CLI::Command::Options::List.new
options.show_all = true
options.ui = Inch::Utils::UI.new
failing_grade_symbols = [:B, :C] # add :U for undocumented
failing_grade_list = context.grade_lists.select { |g| failing_grade_symbols.include?(g.to_sym) }
Inch::CLI::Command::Output::List.new(options, context.objects, failing_grade_list)
puts
if context.objects.any? { |o| failing_grade_symbols.include?(o.grade.to_sym) }
puts red('✗ Lint of Documentation failed: Please improve above suggestions.')
exit 1
else
puts green('✓ Nothing to improve detected.')
end
end
end
rescue LoadError, NameError => e rescue LoadError, NameError => e
$stderr.puts "\033[0;31m" \ $stderr.puts "\033[0;31m" \
'[!] Some Rake tasks haven been disabled because the environment' \ '[!] Some Rake tasks haven been disabled because the environment' \
...@@ -333,6 +390,10 @@ def title(title) ...@@ -333,6 +390,10 @@ def title(title)
puts puts
end end
def green(string)
"\033[0;32m#{string}\e[0m"
end
def red(string) def red(string)
"\033[0;31m#{string}\e[0m" "\033[0;31m#{string}\e[0m"
end end
...@@ -17,6 +17,8 @@ module Pod ...@@ -17,6 +17,8 @@ module Pod
super super
end end
# Run the command
#
# @todo the command report new dependencies added to the Podfile as # @todo the command report new dependencies added to the Podfile as
# updates. # updates.
# #
......
...@@ -24,6 +24,8 @@ module Pod ...@@ -24,6 +24,8 @@ module Pod
super super
end end
# Run the command
#
# @todo Part of this logic needs to be ported to cocoapods-core so web # @todo Part of this logic needs to be ported to cocoapods-core so web
# services can validate the repo. # services can validate the repo.
# #
......
...@@ -190,9 +190,15 @@ module Pod ...@@ -190,9 +190,15 @@ module Pod
# @return [Array<Pathname>] The path of the specifications to push. # @return [Array<Pathname>] The path of the specifications to push.
# #
def podspec_files def podspec_files
files = Pathname.glob(@podspec || '*.podspec') if @podspec
raise Informative, "Couldn't find any .podspec file in current directory" if files.empty? path = Pathname(@podspec)
files raise Informative, "Couldn't find #{@podspec}" unless path.exist?
[path]
else
files = Pathname.glob('*.podspec{,.json}')
raise Informative, "Couldn't find any podspec files in current directory" if files.empty?
files
end
end end
# @return [Integer] The number of the podspec files to push. # @return [Integer] The number of the podspec files to push.
......
...@@ -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|
......
...@@ -12,6 +12,8 @@ module Pod ...@@ -12,6 +12,8 @@ module Pod
# #
attr_reader :root attr_reader :root
# Initialize a new instance
#
# @param [Pathname,String] root # @param [Pathname,String] root
# see {#root} # see {#root}
# #
...@@ -74,9 +76,10 @@ module Pod ...@@ -74,9 +76,10 @@ module Pod
# was found in the download cache. # was found in the download cache.
# #
def cached_pod(request) def cached_pod(request)
cached_spec = cached_spec(request)
path = path_for_pod(request) path = path_for_pod(request)
spec = request.spec || cached_spec(request) return unless cached_spec && path.directory?
return unless spec && path.directory? spec = request.spec || cached_spec
Response.new(path, spec, request.params) Response.new(path, spec, request.params)
end end
...@@ -89,6 +92,8 @@ module Pod ...@@ -89,6 +92,8 @@ module Pod
def cached_spec(request) def cached_spec(request)
path = path_for_spec(request) path = path_for_spec(request)
path.file? && Specification.from_file(path) path.file? && Specification.from_file(path)
rescue JSON::ParserError
nil
end end
# @param [Request] request # @param [Request] request
...@@ -127,7 +132,7 @@ module Pod ...@@ -127,7 +132,7 @@ module Pod
tmpdir = Pathname(Dir.mktmpdir) tmpdir = Pathname(Dir.mktmpdir)
blk.call(tmpdir) blk.call(tmpdir)
ensure ensure
FileUtils.remove_entry(tmpdir) if tmpdir.exist? FileUtils.remove_entry(tmpdir) if tmpdir && tmpdir.exist?
end end
# Copies the `source` directory to `destination`, cleaning the directory # Copies the `source` directory to `destination`, cleaning the directory
......
...@@ -28,6 +28,8 @@ module Pod ...@@ -28,6 +28,8 @@ module Pod
attr_reader :head attr_reader :head
alias_method :head?, :head alias_method :head?, :head
# Initialize a new instance
#
# @param [Specification,Nil] spec # @param [Specification,Nil] spec
# see {#spec} # see {#spec}
# #
...@@ -59,6 +61,9 @@ module Pod ...@@ -59,6 +61,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.
# #
......
...@@ -83,7 +83,13 @@ module Pod ...@@ -83,7 +83,13 @@ module Pod
Thread.new { while s = o.gets; stdout << s; end } Thread.new { while s = o.gets; stdout << s; end }
Thread.new { while s = e.gets; stderr << s; end } Thread.new { while s = e.gets; stderr << s; end }
i.close i.close
t.value status = t.value
o.flush
e.flush
sleep(0.1)
status
end end
end end
...@@ -101,6 +107,8 @@ module Pod ...@@ -101,6 +107,8 @@ module Pod
# #
attr_accessor :io attr_accessor :io
# Init a new Indenter
#
# @param [IO] io @see io # @param [IO] io @see io
# #
def initialize(io = nil) def initialize(io = nil)
......
...@@ -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)
......
...@@ -17,6 +17,8 @@ module Pod ...@@ -17,6 +17,8 @@ module Pod
# #
attr_reader :podfile_path attr_reader :podfile_path
# Initialize a new instance
#
# @param [String] name @see name # @param [String] name @see name
# @param [Hash] params @see params # @param [Hash] params @see params
# @param [String] podfile_path @see podfile_path # @param [String] podfile_path @see podfile_path
...@@ -41,7 +43,7 @@ module Pod ...@@ -41,7 +43,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 +60,11 @@ module Pod ...@@ -58,6 +60,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,13 @@ module Pod ...@@ -13,9 +13,13 @@ module Pod
# #
attr_reader :platform attr_reader :platform
# @param [Hash{String, Array{String}] # Initialize a new instance
# resources_by_config @see resources_by_config #
# @param [Platform] platform @see platform # @param [Hash<String, Array<String>>] resources_by_config
# @see resources_by_config
#
# @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
......
...@@ -19,6 +19,8 @@ module Pod ...@@ -19,6 +19,8 @@ module Pod
# #
attr_accessor :module_imports attr_accessor :module_imports
# Initialize a new instance
#
# @param [Symbol] platform # @param [Symbol] platform
# @see platform # @see platform
# #
......
...@@ -9,6 +9,8 @@ module Pod ...@@ -9,6 +9,8 @@ module Pod
# #
attr_reader :target attr_reader :target
# Initialize a new instance
#
# @param [Target] target @see target # @param [Target] target @see target
# #
def initialize(target) def initialize(target)
......
...@@ -6,15 +6,17 @@ module Pod ...@@ -6,15 +6,17 @@ module Pod
# with existing headers of the podspec. # with existing headers of the podspec.
# #
class ModuleMap class ModuleMap
# @return [Target] the target represented by this Info.plist. # @return [PodTarget] the target represented by this Info.plist.
# #
attr_reader :target attr_reader :target
# @return [Array] the private headers of the module # @return [Array<#to_s>] the private headers of the module
# #
attr_accessor :private_headers attr_accessor :private_headers
# @param [Target] target @see target # Initialize a new instance
#
# @param [PodTarget] target @see target
# #
def initialize(target) def initialize(target)
@target = target @target = target
......
...@@ -12,6 +12,8 @@ module Pod ...@@ -12,6 +12,8 @@ module Pod
# #
attr_reader :file_accessors attr_reader :file_accessors
# Initialize a new instance
#
# @param [Array<FileAccessor>] file_accessors # @param [Array<FileAccessor>] file_accessors
# @see file_accessors # @see file_accessors
# #
......
...@@ -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]
# #
......
...@@ -12,6 +12,8 @@ module Pod ...@@ -12,6 +12,8 @@ module Pod
# the target, which provides the product name # the target, which provides the product name
attr_reader :target attr_reader :target
# Initialize a new instance
#
# @param [Target] target # @param [Target] target
# @see target # @see target
# #
......
...@@ -8,6 +8,8 @@ module Pod ...@@ -8,6 +8,8 @@ module Pod
# #
attr_reader :target attr_reader :target
# Initialize a new instance
#
# @param [Target] target @see target # @param [Target] target @see target
# #
# @param [String] configuration_name # @param [String] configuration_name
...@@ -26,7 +28,7 @@ module Pod ...@@ -26,7 +28,7 @@ module Pod
# Generates and saves the xcconfig to the given path. # Generates and saves the xcconfig to the given path.
# #
# @param [Pathname] path # @param [Pathname] path
# the path where the prefix header should be stored. # the path where the xcconfig should be stored.
# #
# @return [void] # @return [void]
# #
......
...@@ -17,6 +17,8 @@ module Pod ...@@ -17,6 +17,8 @@ module Pod
# #
attr_reader :public_xcconfig attr_reader :public_xcconfig
# Initialize a new instance
#
# @param [Target] target @see target # @param [Target] target @see target
# @param [Xcodeproj::Config] public_xcconfig @see public_xcconfig # @param [Xcodeproj::Config] public_xcconfig @see public_xcconfig
# #
......
...@@ -13,6 +13,8 @@ module Pod ...@@ -13,6 +13,8 @@ module Pod
# #
attr_reader :target attr_reader :target
# Initialize a new instance
#
# @param [Target] target @see target # @param [Target] target @see target
# #
def initialize(target) def initialize(target)
......
...@@ -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
...@@ -70,10 +77,10 @@ module Pod ...@@ -70,10 +77,10 @@ module Pod
add_developers_frameworks_if_needed(xcconfig, consumer.platform_name) add_developers_frameworks_if_needed(xcconfig, consumer.platform_name)
end end
# Configures the given Xcconfig with the the build settings for the given # Configures the given Xcconfig with the build settings for the given
# framework path. # framework path.
# #
# @param [Pathanme] framework_path # @param [Pathname] framework_path
# The path of the framework. # The path of the framework.
# #
# @param [Xcodeproj::Config] xcconfig # @param [Xcodeproj::Config] xcconfig
...@@ -92,11 +99,11 @@ module Pod ...@@ -92,11 +99,11 @@ module Pod
xcconfig.merge!(build_settings) xcconfig.merge!(build_settings)
end end
# Configures the given Xcconfig with the the build settings for the given # Configures the given Xcconfig with the build settings for the given
# library path. # library path.
# #
# @param [Pathanme] framework_path # @param [Pathname] library_path
# The path of the framework. # The path of the library.
# #
# @param [Xcodeproj::Config] xcconfig # @param [Xcodeproj::Config] xcconfig
# The xcconfig to edit. # The xcconfig to edit.
......
...@@ -119,6 +119,8 @@ module Pod ...@@ -119,6 +119,8 @@ module Pod
# @!group Private implementation # @!group Private implementation
# Initialize a new instance
#
# @param [Installer] installer @see installer # @param [Installer] installer @see installer
# #
def initialize(installer) def initialize(installer)
......
...@@ -61,7 +61,7 @@ module Pod ...@@ -61,7 +61,7 @@ module Pod
# #
attr_reader :sandbox attr_reader :sandbox
# @return [Library] The library whose target needs to be generated. # @return [Target] The library whose target needs to be generated.
# #
attr_reader :library attr_reader :library
...@@ -76,8 +76,10 @@ module Pod ...@@ -76,8 +76,10 @@ module Pod
# @!group Private implementation # @!group Private implementation
# Initialize a new instance
#
# @param [Sandbox] sandbox @see sandbox # @param [Sandbox] sandbox @see sandbox
# @param [Library] library @see library # @param [Target] library @see library
# #
def initialize(sandbox, library) def initialize(sandbox, library)
@sandbox = sandbox @sandbox = sandbox
......
...@@ -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
......
...@@ -34,6 +34,8 @@ module Pod ...@@ -34,6 +34,8 @@ module Pod
# #
attr_reader :block attr_reader :block
# Initialize a new instance
#
# @param [String] name @see {#name}. # @param [String] name @see {#name}.
# #
# @param [String] plugin_name @see {#plugin_name}. # @param [String] plugin_name @see {#plugin_name}.
......
...@@ -56,6 +56,8 @@ module Pod ...@@ -56,6 +56,8 @@ module Pod
# #
attr_reader :lockfile attr_reader :lockfile
# Initialize a new instance
#
# @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
...@@ -136,6 +138,7 @@ module Pod ...@@ -136,6 +138,7 @@ module Pod
set_target_dependencies set_target_dependencies
run_podfile_post_install_hooks run_podfile_post_install_hooks
write_pod_project write_pod_project
share_development_pod_schemes
write_lockfiles write_lockfiles
end end
end end
...@@ -174,6 +177,8 @@ module Pod ...@@ -174,6 +177,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
...@@ -611,6 +616,20 @@ module Pod ...@@ -611,6 +616,20 @@ module Pod
end end
end end
# Shares schemes of development Pods.
#
# @return [void]
#
def share_development_pod_schemes
development_pod_targets = sandbox.development_pods.keys.map do |pod|
pods_project.targets.select { |target| target.name =~ /^Pods-.*-#{pod}$/ }
end.flatten
development_pod_targets.each do |pod_target|
Xcodeproj::XCScheme.share_scheme(pods_project.path, pod_target.name)
end
end
# Writes the Podfile and the lock files. # Writes the Podfile and the lock files.
# #
# @todo Pass the checkout options to the Lockfile. # @todo Pass the checkout options to the Lockfile.
...@@ -718,18 +737,20 @@ module Pod ...@@ -718,18 +737,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
...@@ -737,18 +758,27 @@ module Pod ...@@ -737,18 +758,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
......
...@@ -24,6 +24,8 @@ module Pod ...@@ -24,6 +24,8 @@ module Pod
# #
attr_reader :lockfile attr_reader :lockfile
# Initialize a new instance
#
# @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
...@@ -44,6 +46,9 @@ module Pod ...@@ -44,6 +46,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 +77,9 @@ module Pod ...@@ -72,6 +77,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 +88,9 @@ module Pod ...@@ -80,6 +88,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)
...@@ -181,7 +192,7 @@ module Pod ...@@ -181,7 +192,7 @@ module Pod
# Creates the models that represent the libraries generated by CocoaPods. # Creates the models that represent the libraries generated by CocoaPods.
# #
# @return [Array<Libraries>] the generated libraries. # @return [Array<Target>] the generated libraries.
# #
def generate_targets def generate_targets
targets = [] targets = []
...@@ -757,6 +768,8 @@ module Pod ...@@ -757,6 +768,8 @@ module Pod
# subspecs are added instead of the name of the Pods. # subspecs are added instead of the name of the Pods.
# #
class SpecsState class SpecsState
# Initialize a new instance
#
# @param [Hash{Symbol=>String}] pods_by_state # @param [Hash{Symbol=>String}] pods_by_state
# The name of the pods grouped by their state # The name of the pods grouped by their state
# (`:added`, `:removed`, `:changed` or `:unchanged`). # (`:added`, `:removed`, `:changed` or `:unchanged`).
...@@ -804,10 +817,10 @@ module Pod ...@@ -804,10 +817,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]
......
...@@ -51,6 +51,8 @@ module Pod ...@@ -51,6 +51,8 @@ module Pod
# #
attr_reader :lockfile attr_reader :lockfile
# Init a new SandboxAnalyzer
#
# @param [Sandbox] sandbox @see sandbox # @param [Sandbox] sandbox @see sandbox
# @param [Array<Specifications>] specs @see specs # @param [Array<Specifications>] specs @see specs
# @param [Bool] update_mode @see update_mode # @param [Bool] update_mode @see update_mode
...@@ -66,7 +68,7 @@ module Pod ...@@ -66,7 +68,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
......
...@@ -16,6 +16,8 @@ module Pod ...@@ -16,6 +16,8 @@ module Pod
# #
attr_reader :pods_project attr_reader :pods_project
# Initialize a new instance
#
# @param [Sandbox] sandbox @see sandbox # @param [Sandbox] sandbox @see sandbox
# @param [Array<PodTarget>] libraries @see libraries # @param [Array<PodTarget>] libraries @see libraries
# @param [Project] libraries @see libraries # @param [Project] libraries @see libraries
...@@ -153,7 +155,7 @@ module Pod ...@@ -153,7 +155,7 @@ module Pod
# The key of the group of the Pods project. # The key of the group of the Pods project.
# #
# @param [Bool] reflect_file_system_structure_for_development # @param [Bool] reflect_file_system_structure_for_development
# Wether organizing the a local pod's files in subgroups inside # Whether organizing a local pod's files in subgroups inside
# the pod's group is allowed. # the pod's group is allowed.
# #
# @return [void] # @return [void]
......
...@@ -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
...@@ -17,6 +17,8 @@ module Pod ...@@ -17,6 +17,8 @@ module Pod
# #
attr_reader :specs_by_platform attr_reader :specs_by_platform
# Initialize a new instance
#
# @param [Sandbox] sandbox @see sandbox # @param [Sandbox] sandbox @see sandbox
# @param [Hash{Symbol=>Array}] specs_by_platform @see specs_by_platform # @param [Hash{Symbol=>Array}] specs_by_platform @see specs_by_platform
# #
...@@ -68,7 +70,7 @@ module Pod ...@@ -68,7 +70,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
......
...@@ -12,6 +12,8 @@ module Pod ...@@ -12,6 +12,8 @@ module Pod
# #
attr_reader :path attr_reader :path
# Initialize a new instance
#
# @param [Specification] spec the root specification of the Pod. # @param [Specification] spec the root specification of the Pod.
# @param [Pathname] path the folder where the source of the Pod is located. # @param [Pathname] path the folder where the source of the Pod is located.
# #
......
...@@ -13,7 +13,16 @@ module Pod ...@@ -13,7 +13,16 @@ module Pod
# #
attr_accessor :umbrella_targets attr_accessor :umbrella_targets
# @return [PostInstallHooksContext] Convenience class method to generate the # @return [PostInstallHooksContext] Convenience class generator method
#
# @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
# static context. # static context.
# #
def self.generate(sandbox, aggregate_targets) def self.generate(sandbox, aggregate_targets)
......
...@@ -33,14 +33,16 @@ module Pod ...@@ -33,14 +33,16 @@ module Pod
# #
attr_reader :installation_root attr_reader :installation_root
# @return [Array<Target>] the targets represented in the Podfile. # @return [Array<AggregateTarget>] the targets represented in the Podfile.
# #
attr_reader :targets attr_reader :targets
# Init a new UserProjectIntegrator
#
# @param [Podfile] podfile @see #podfile # @param [Podfile] podfile @see #podfile
# @param [Sandbox] sandbox @see #sandbox # @param [Sandbox] sandbox @see #sandbox
# @param [Pathname] installation_root @see #installation_root # @param [Pathname] installation_root @see #installation_root
# @param [Library] libraries @see #libraries # @param [Array<AggregateTarget>] targets @see #targets
# #
# @todo Too many initialization arguments # @todo Too many initialization arguments
# #
......
...@@ -14,11 +14,13 @@ module Pod ...@@ -14,11 +14,13 @@ module Pod
# #
EMBED_FRAMEWORK_TARGET_TYPES = [:application, :unit_test_bundle].freeze EMBED_FRAMEWORK_TARGET_TYPES = [:application, :unit_test_bundle].freeze
# @return [Target] the target that should be integrated. # @return [AggregateTarget] the target that should be integrated.
# #
attr_reader :target attr_reader :target
# @param [Target] target @see #target_definition # Init a new TargetIntegrator
#
# @param [AggregateTarget] target @see #target
# #
def initialize(target) def initialize(target)
@target = target @target = target
...@@ -257,6 +259,8 @@ module Pod ...@@ -257,6 +259,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)
......
...@@ -7,6 +7,8 @@ module Pod ...@@ -7,6 +7,8 @@ module Pod
# through the installation process. # through the installation process.
# #
class Project < Xcodeproj::Project class Project < Xcodeproj::Project
# Initialize a new instance
#
# @param [Pathname, String] path @see path # @param [Pathname, String] path @see path
# @param [Bool] skip_initialization # @param [Bool] skip_initialization
# Whether the project should be initialized from scratch. # Whether the project should be initialized from scratch.
...@@ -169,7 +171,7 @@ module Pod ...@@ -169,7 +171,7 @@ module Pod
# The group for the new file reference. # The group for the new file reference.
# #
# @param [Bool] reflect_file_system_structure # @param [Bool] reflect_file_system_structure
# Wether group structure should reflect the file system structure. # Whether group structure should reflect the file system structure.
# If yes, where needed, intermediate groups are created, similar to # If yes, where needed, intermediate groups are created, similar to
# how mkdir -p operates. # how mkdir -p operates.
# #
......
...@@ -25,6 +25,8 @@ module Pod ...@@ -25,6 +25,8 @@ module Pod
# #
attr_accessor :sources attr_accessor :sources
# Init a new Resolver
#
# @param [Sandbox] sandbox @see sandbox # @param [Sandbox] sandbox @see sandbox
# @param [Podfile] podfile @see podfile # @param [Podfile] podfile @see podfile
# @param [Array<Dependency>] locked_dependencies @see locked_dependencies # @param [Array<Dependency>] locked_dependencies @see locked_dependencies
...@@ -53,7 +55,11 @@ module Pod ...@@ -53,7 +55,11 @@ module Pod
dependencies = podfile.target_definition_list.map(&:dependencies).flatten dependencies = podfile.target_definition_list.map(&:dependencies).flatten
@cached_sets = {} @cached_sets = {}
@activated = Molinillo::Resolver.new(self, self).resolve(dependencies, locked_dependencies) @activated = Molinillo::Resolver.new(self, self).resolve(dependencies, locked_dependencies)
specs_by_target specs_by_target.tap do |specs_by_target|
specs_by_target.values.flatten.each do |spec|
sandbox.store_head_pod(spec.name) if spec.version.head?
end
end
rescue Molinillo::ResolverError => e rescue Molinillo::ResolverError => e
handle_resolver_error(e) handle_resolver_error(e)
end end
...@@ -64,24 +70,18 @@ module Pod ...@@ -64,24 +70,18 @@ module Pod
# @note The returned specifications can be subspecs. # @note The returned specifications can be subspecs.
# #
def specs_by_target def specs_by_target
@specs_by_target ||= begin @specs_by_target ||= {}.tap do |specs_by_target|
specs_by_target = {}
podfile.target_definition_list.each do |target| podfile.target_definition_list.each do |target|
specs = target.dependencies.map(&:name).map do |name| specs = target.dependencies.map(&:name).flat_map do |name|
node = @activated.vertex_named(name) node = @activated.vertex_named(name)
valid_dependencies_for_target_from_node(target, node) << node valid_dependencies_for_target_from_node(target, node) << node
end end
specs_by_target[target] = specs. specs_by_target[target] = specs.
flatten.
map(&:payload). map(&:payload).
uniq. uniq.
sort_by(&:name). sort_by(&:name)
each do |spec|
sandbox.store_head_pod(spec.name) if spec.version.head?
end
end end
specs_by_target
end end
end end
......
...@@ -50,6 +50,8 @@ module Pod ...@@ -50,6 +50,8 @@ module Pod
# #
attr_reader :public_headers attr_reader :public_headers
# Initialize a new instance
#
# @param [String, Pathname] root @see root # @param [String, Pathname] root @see root
# #
def initialize(root) def initialize(root)
...@@ -246,6 +248,8 @@ module Pod ...@@ -246,6 +248,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.
# #
......
...@@ -27,6 +27,8 @@ module Pod ...@@ -27,6 +27,8 @@ module Pod
# #
attr_reader :spec_consumer attr_reader :spec_consumer
# Initialize a new instance
#
# @param [Sandbox::PathList, Pathname] path_list @see path_list # @param [Sandbox::PathList, Pathname] path_list @see path_list
# @param [Specification::Consumer] spec_consumer @see spec_consumer # @param [Specification::Consumer] spec_consumer @see spec_consumer
# #
...@@ -168,7 +170,7 @@ module Pod ...@@ -168,7 +170,7 @@ module Pod
end end
# @return [Hash{String => Array<Pathname>}] A hash that describes the # @return [Hash{String => Array<Pathname>}] A hash that describes the
# resource bundles of the Pod. The keys reppresent the name of # resource bundles of the Pod. The keys represent the name of
# the bundle while the values the path of the resources. # the bundle while the values the path of the resources.
# #
def resource_bundles def resource_bundles
......
...@@ -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)
......
...@@ -15,6 +15,8 @@ module Pod ...@@ -15,6 +15,8 @@ module Pod
# #
attr_accessor :root attr_accessor :root
# Initialize a new instance
#
# @param [Pathname] root The root of the PathList. # @param [Pathname] root The root of the PathList.
# #
def initialize(root) def initialize(root)
...@@ -61,24 +63,41 @@ module Pod ...@@ -61,24 +63,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]
# #
......
...@@ -6,7 +6,7 @@ module Pod ...@@ -6,7 +6,7 @@ module Pod
# This class is used to represent both the targets and their libraries. # This class is used to represent both the targets and their libraries.
# #
class Target class Target
# @return [PBXNativeTarget] the target definition of the Podfile that # @return [TargetDefinition] the target definition of the Podfile that
# generated this target. # generated this target.
# #
attr_reader :target_definition attr_reader :target_definition
......
...@@ -3,6 +3,8 @@ module Pod ...@@ -3,6 +3,8 @@ module Pod
# of the single Pods. The client targets will then depend on this one. # of the single Pods. The client targets will then depend on this one.
# #
class AggregateTarget < Target class AggregateTarget < Target
# Initialize a new instance
#
# @param [TargetDefinition] target_definition @see target_definition # @param [TargetDefinition] target_definition @see target_definition
# @param [Sandbox] sandbox @see sandbox # @param [Sandbox] sandbox @see sandbox
# #
...@@ -51,8 +53,12 @@ module Pod ...@@ -51,8 +53,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]
# #
......
...@@ -16,6 +16,8 @@ module Pod ...@@ -16,6 +16,8 @@ module Pod
# #
attr_reader :linter attr_reader :linter
# Initialize a new instance
#
# @param [Specification, Pathname, String] spec_or_path # @param [Specification, Pathname, String] spec_or_path
# the Specification or the path of the `podspec` file to lint. # the Specification or the path of the `podspec` file to lint.
# #
...@@ -167,7 +169,8 @@ module Pod ...@@ -167,7 +169,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 +180,8 @@ module Pod ...@@ -177,7 +180,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
......
...@@ -22,7 +22,13 @@ module Pod ...@@ -22,7 +22,13 @@ module Pod
it "complains if it can't find a spec" do it "complains if it can't find a spec" do
repo_make('test_repo') repo_make('test_repo')
e = lambda { run_command('repo', 'push', 'test_repo') }.should.raise Pod::Informative e = lambda { run_command('repo', 'push', 'test_repo') }.should.raise Pod::Informative
e.message.should.match(/Couldn't find any .podspec/) e.message.should.match(/Couldn't find any podspec/)
end
it "complains if it can't find the given podspec" do
repo_make('test_repo')
e = lambda { run_command('repo', 'push', 'test_repo', 'testspec.podspec') }.should.raise Pod::Informative
e.message.should.match(/Couldn't find testspec\.podspec/)
end end
it "it raises if the specification doesn't validate" do it "it raises if the specification doesn't validate" do
...@@ -38,6 +44,16 @@ module Pod ...@@ -38,6 +44,16 @@ module Pod
end end
end end
it 'finds JSON podspecs' do
repo_make('test_repo')
Dir.chdir(temporary_directory) do
File.open('JSON.podspec.json', 'w') { |f| f.write('{}') }
cmd = command('repo', 'push', 'test_repo')
cmd.send(:podspec_files).should == [Pathname('JSON.podspec.json')]
end
end
#--------------------------------------# #--------------------------------------#
before do before do
......
...@@ -74,6 +74,53 @@ module Pod ...@@ -74,6 +74,53 @@ module Pod
end end
end end
describe 'when the cache is incomplete' do
shared 'it falls back to download the pod' do
describe 'when downloading a released pod' do
it 'does download the source' do
Downloader::Git.any_instance.expects(:download).never
@cache.expects(:uncached_pod).once
@cache.download_pod(@request)
end
end
describe 'when downloading an unreleased pod' do
it 'does download the source' do
Downloader::Git.any_instance.expects(:download).never
@cache.expects(:uncached_pod).once
@cache.download_pod(@unreleased_request)
end
end
end
before do
[@request, @unreleased_request].each do |request|
path_for_pod = @cache.send(:path_for_pod, request)
path_for_pod.mkpath
Dir.chdir(path_for_pod) do
FileUtils.mkdir_p 'Classes'
File.open('Classes/a.m', 'w') {}
end
end
end
describe 'because the spec is missing' do
behaves_like 'it falls back to download the pod'
end
describe 'because the spec is invalid' do
before do
[@request, @unreleased_request].each do |request|
path_for_spec = @cache.send(:path_for_spec, request)
path_for_spec.dirname.mkpath
path_for_spec.open('w') { |f| f << '{' }
end
end
behaves_like 'it falls back to download the pod'
end
end
describe 'when the download is cached' do describe 'when the download is cached' do
before do before do
[@request, @unreleased_request].each do |request| [@request, @unreleased_request].each do |request|
......
...@@ -22,10 +22,10 @@ module Pod ...@@ -22,10 +22,10 @@ module Pod
it "doesn't hang when the spawned process forks a zombie process with the same STDOUT and STDERR" do it "doesn't hang when the spawned process forks a zombie process with the same STDOUT and STDERR" do
cmd = ['-e', <<-RB] cmd = ['-e', <<-RB]
Process.fork { Process.daemon(nil, true); sleep(2) } Process.fork { Process.daemon(nil, true); sleep(4) }
puts 'out' puts 'out'
RB RB
Timeout.timeout(1) do Timeout.timeout(2) do
Executable.execute_command('ruby', cmd, true).should == "out\n" Executable.execute_command('ruby', cmd, true).should == "out\n"
end end
end end
......
...@@ -590,6 +590,21 @@ module Pod ...@@ -590,6 +590,21 @@ module Pod
@installer.send(:write_pod_project) @installer.send(:write_pod_project)
end end
it 'shares schemes of development pods' do
spec = fixture_spec('banana-lib/BananaLib.podspec')
target_definition = Podfile::TargetDefinition.new(:default, @installer.podfile)
pod_target = PodTarget.new([spec], target_definition, config.sandbox)
@installer.pods_project.stubs(:targets).returns([pod_target])
@installer.sandbox.stubs(:development_pods).returns('BananaLib' => nil)
Xcodeproj::XCScheme.expects(:share_scheme).with(
@installer.pods_project.path,
'Pods-default-BananaLib')
@installer.send(:share_development_pod_schemes)
end
it "uses the user project's object version for the pods project" do it "uses the user project's object version for the pods project" do
tmp_directory = Pathname(Dir.tmpdir) + 'CocoaPods' tmp_directory = Pathname(Dir.tmpdir) + 'CocoaPods'
FileUtils.mkdir_p(tmp_directory) FileUtils.mkdir_p(tmp_directory)
......
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