Commit aa4994a6 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #3753 from CocoaPods/seg-default-plugins

[Installer] Add support for default plugins
parents f6028aa0 db30799b
...@@ -17,6 +17,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -17,6 +17,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
project churn and merge conflicts. project churn and merge conflicts.
[Samuel Giddins](https://github.com/segiddins) [Samuel Giddins](https://github.com/segiddins)
* [`cocoapods-stats`](https://github.com/CocoaPods/cocoapods-stats)
is now a default plugin.
[Samuel Giddins](https://github.com/segiddins)
##### Bug Fixes ##### Bug Fixes
* Ensure that the `prepare_command` is run even when skipping the download * Ensure that the `prepare_command` is run even when skipping the download
......
...@@ -18,6 +18,7 @@ group :development do ...@@ -18,6 +18,7 @@ group :development do
cp_gem 'cocoapods-core', 'Core' cp_gem 'cocoapods-core', 'Core'
cp_gem 'cocoapods-downloader', 'cocoapods-downloader' cp_gem 'cocoapods-downloader', 'cocoapods-downloader'
cp_gem 'cocoapods-plugins', 'cocoapods-plugins' cp_gem 'cocoapods-plugins', 'cocoapods-plugins'
cp_gem 'cocoapods-stats', 'cocoapods-stats'
cp_gem 'cocoapods-trunk', 'cocoapods-trunk' cp_gem 'cocoapods-trunk', 'cocoapods-trunk'
cp_gem 'cocoapods-try', 'cocoapods-try' cp_gem 'cocoapods-try', 'cocoapods-try'
cp_gem 'molinillo', 'Molinillo' cp_gem 'molinillo', 'Molinillo'
......
...@@ -47,6 +47,14 @@ GIT ...@@ -47,6 +47,14 @@ GIT
cocoapods-plugins (0.4.2) cocoapods-plugins (0.4.2)
nap nap
GIT
remote: https://github.com/CocoaPods/cocoapods-stats.git
revision: 524102745303db529da8b6aa99633c5a7c60be6c
branch: master
specs:
cocoapods-stats (0.5.2)
nap (~> 0.8)
GIT GIT
remote: https://github.com/CocoaPods/cocoapods-trunk.git remote: https://github.com/CocoaPods/cocoapods-trunk.git
revision: dbe2fc2e569dc66d652ec85e276294d02e34c3b6 revision: dbe2fc2e569dc66d652ec85e276294d02e34c3b6
...@@ -72,6 +80,7 @@ PATH ...@@ -72,6 +80,7 @@ PATH
cocoapods-core (= 0.38.0.beta.1) cocoapods-core (= 0.38.0.beta.1)
cocoapods-downloader (~> 0.9.1) cocoapods-downloader (~> 0.9.1)
cocoapods-plugins (~> 0.4.2) cocoapods-plugins (~> 0.4.2)
cocoapods-stats (~> 0.5.0)
cocoapods-trunk (~> 0.6.1) cocoapods-trunk (~> 0.6.1)
cocoapods-try (~> 0.4.5) cocoapods-try (~> 0.4.5)
colored (~> 1.2) colored (~> 1.2)
...@@ -183,6 +192,7 @@ DEPENDENCIES ...@@ -183,6 +192,7 @@ DEPENDENCIES
cocoapods-dependencies cocoapods-dependencies
cocoapods-downloader! cocoapods-downloader!
cocoapods-plugins! cocoapods-plugins!
cocoapods-stats!
cocoapods-trunk! cocoapods-trunk!
cocoapods-try! cocoapods-try!
diffy diffy
......
...@@ -32,6 +32,7 @@ Gem::Specification.new do |s| ...@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'xcodeproj', '~> 0.25.0' s.add_runtime_dependency 'xcodeproj', '~> 0.25.0'
s.add_runtime_dependency 'cocoapods-downloader', '~> 0.9.1' s.add_runtime_dependency 'cocoapods-downloader', '~> 0.9.1'
s.add_runtime_dependency 'cocoapods-plugins', '~> 0.4.2' s.add_runtime_dependency 'cocoapods-plugins', '~> 0.4.2'
s.add_runtime_dependency 'cocoapods-stats', '~> 0.5.0'
s.add_runtime_dependency 'cocoapods-try', '~> 0.4.5' s.add_runtime_dependency 'cocoapods-try', '~> 0.4.5'
s.add_runtime_dependency 'cocoapods-trunk', '~> 0.6.1' s.add_runtime_dependency 'cocoapods-trunk', '~> 0.6.1'
s.add_runtime_dependency 'molinillo', '~> 0.2.3' s.add_runtime_dependency 'molinillo', '~> 0.2.3'
......
...@@ -418,7 +418,7 @@ module Pod ...@@ -418,7 +418,7 @@ module Pod
# #
def run_plugins_pre_install_hooks def run_plugins_pre_install_hooks
context = PreInstallHooksContext.generate(sandbox, podfile, lockfile) context = PreInstallHooksContext.generate(sandbox, podfile, lockfile)
HooksManager.run(:pre_install, context, podfile.plugins) HooksManager.run(:pre_install, context, plugins)
end end
# Performs any post-installation actions # Performs any post-installation actions
...@@ -434,7 +434,7 @@ module Pod ...@@ -434,7 +434,7 @@ module Pod
# #
def run_plugins_post_install_hooks def run_plugins_post_install_hooks
context = PostInstallHooksContext.generate(sandbox, aggregate_targets) context = PostInstallHooksContext.generate(sandbox, aggregate_targets)
HooksManager.run(:post_install, context, podfile.plugins) HooksManager.run(:post_install, context, plugins)
end end
# Ensures that all plugins specified in the {#podfile} are loaded. # Ensures that all plugins specified in the {#podfile} are loaded.
...@@ -453,6 +453,17 @@ module Pod ...@@ -453,6 +453,17 @@ module Pod
end end
end end
DEFAULT_PLUGINS = { 'cocoapods-stats' => {} }
# Returns the plugins that should be run, as indicated by the default
# plugins and the podfile's plugins
#
# @return [Hash<String, Hash>] The plugins to be used
#
def plugins
DEFAULT_PLUGINS.merge(podfile.plugins)
end
# Prints a warning for any pods that are deprecated # Prints a warning for any pods that are deprecated
# #
# @return [void] # @return [void]
......
Subproject commit 9d2b33a4c7ca1578968b835dabcc0c150cc2b096 Subproject commit f957d7bef1b92e6cc3ec00c63d06dc2fefa220f6
...@@ -106,6 +106,7 @@ describe_cli 'pod' do ...@@ -106,6 +106,7 @@ describe_cli 'pod' do
'COCOAPODS_SKIP_CACHE' => 'TRUE', 'COCOAPODS_SKIP_CACHE' => 'TRUE',
'XCODEPROJ_DISABLE_XCPROJ' => 'TRUE', 'XCODEPROJ_DISABLE_XCPROJ' => 'TRUE',
'CLAIDE_DISABLE_AUTO_WRAP' => 'TRUE', 'CLAIDE_DISABLE_AUTO_WRAP' => 'TRUE',
'COCOAPODS_DISABLE_STATS' => 'TRUE',
} }
s.default_args = [ s.default_args = [
'--verbose', '--verbose',
...@@ -118,6 +119,12 @@ describe_cli 'pod' do ...@@ -118,6 +119,12 @@ describe_cli 'pod' do
s.replace_pattern /#{Dir.tmpdir}\/[\w-]+/i, 'TMPDIR' s.replace_pattern /#{Dir.tmpdir}\/[\w-]+/i, 'TMPDIR'
s.replace_pattern /\d{4}-\d\d-\d\d \d\d:\d\d:\d\d [-+]\d{4}/, '<#DATE#>' s.replace_pattern /\d{4}-\d\d-\d\d \d\d:\d\d:\d\d [-+]\d{4}/, '<#DATE#>'
s.replace_pattern /\(Took \d+.\d+ seconds\)/, '(Took <#DURATION#> seconds)' s.replace_pattern /\(Took \d+.\d+ seconds\)/, '(Took <#DURATION#> seconds)'
s.replace_path %r{
`[^`]*? # The opening backtick on a plugin path
([[[:alnum:]]_+-]+) # The plugin name
(- ([[:xdigit:]]+ | #{Gem::Version::VERSION_PATTERN}))? # The version or SHA
/lib/cocoapods_plugin.rb # The actual plugin file that gets loaded
}ix, '`\1/lib/cocoapods_plugin.rb'
end end
describe 'Pod install' do describe 'Pod install' do
......
require File.expand_path('../../spec_helper', __FILE__) require File.expand_path('../../spec_helper', __FILE__)
require 'cocoapods_stats/sender'
# @return [Lockfile] # @return [Lockfile]
# #
def generate_lockfile def generate_lockfile
...@@ -36,6 +38,7 @@ end ...@@ -36,6 +38,7 @@ end
module Pod module Pod
describe Installer do describe Installer do
before do before do
CocoaPodsStats::Sender.any_instance.stubs(:send)
podfile = generate_podfile podfile = generate_podfile
lockfile = generate_lockfile lockfile = generate_lockfile
config.integrate_targets = false config.integrate_targets = false
...@@ -695,24 +698,34 @@ module Pod ...@@ -695,24 +698,34 @@ module Pod
@installer.stubs(:installed_specs).returns(@specs) @installer.stubs(:installed_specs).returns(@specs)
end end
describe 'DEFAULT_PLUGINS' do
before do
@default_plugins = @installer.send(:plugins)
end
it 'includes cocoapods-stats' do
@default_plugins['cocoapods-stats'].should == {}
end
end
it 'runs plugins pre install hook' do it 'runs plugins pre install hook' do
context = stub context = stub
Installer::PreInstallHooksContext.expects(:generate).returns(context) Installer::PreInstallHooksContext.expects(:generate).returns(context)
HooksManager.expects(:run).with(:pre_install, context, {}) HooksManager.expects(:run).with(:pre_install, context, Installer::DEFAULT_PLUGINS)
@installer.send(:run_plugins_pre_install_hooks) @installer.send(:run_plugins_pre_install_hooks)
end end
it 'runs plugins post install hook' do it 'runs plugins post install hook' do
context = stub context = stub
Installer::PostInstallHooksContext.expects(:generate).returns(context) Installer::PostInstallHooksContext.expects(:generate).returns(context)
HooksManager.expects(:run).with(:post_install, context, {}) HooksManager.expects(:run).with(:post_install, context, Installer::DEFAULT_PLUGINS)
@installer.send(:run_plugins_post_install_hooks) @installer.send(:run_plugins_post_install_hooks)
end end
it 'only runs the podfile-specified hooks' do it 'only runs the podfile-specified hooks' do
context = stub context = stub
Installer::PostInstallHooksContext.expects(:generate).returns(context) Installer::PostInstallHooksContext.expects(:generate).returns(context)
plugins_hash = { 'cocoapods-keys' => { 'keyring' => 'Eidolon' } } plugins_hash = Installer::DEFAULT_PLUGINS.merge('cocoapods-keys' => { 'keyring' => 'Eidolon' })
@installer.podfile.stubs(:plugins).returns(plugins_hash) @installer.podfile.stubs(:plugins).returns(plugins_hash)
HooksManager.expects(:run).with(:post_install, context, plugins_hash) HooksManager.expects(:run).with(:post_install, context, plugins_hash)
@installer.send(:run_plugins_post_install_hooks) @installer.send(:run_plugins_post_install_hooks)
......
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