Commit 9db0c47c authored by Samuel E. Giddins's avatar Samuel E. Giddins

[Installer] Add support for default plugins

parent f6028aa0
......@@ -18,6 +18,7 @@ group :development do
cp_gem 'cocoapods-core', 'Core'
cp_gem 'cocoapods-downloader', 'cocoapods-downloader'
cp_gem 'cocoapods-plugins', 'cocoapods-plugins'
cp_gem 'cocoapods-stats', 'cocoapods-stats'
cp_gem 'cocoapods-trunk', 'cocoapods-trunk'
cp_gem 'cocoapods-try', 'cocoapods-try'
cp_gem 'molinillo', 'Molinillo'
......
......@@ -47,6 +47,14 @@ GIT
cocoapods-plugins (0.4.2)
nap
GIT
remote: https://github.com/CocoaPods/cocoapods-stats.git
revision: 1d1d46e8066398ff630f45a0f7f66444bcb05c39
branch: master
specs:
cocoapods-stats (0.5.0)
nap (~> 0.8)
GIT
remote: https://github.com/CocoaPods/cocoapods-trunk.git
revision: dbe2fc2e569dc66d652ec85e276294d02e34c3b6
......@@ -72,6 +80,7 @@ PATH
cocoapods-core (= 0.38.0.beta.1)
cocoapods-downloader (~> 0.9.1)
cocoapods-plugins (~> 0.4.2)
cocoapods-stats (~> 0.5.0)
cocoapods-trunk (~> 0.6.1)
cocoapods-try (~> 0.4.5)
colored (~> 1.2)
......@@ -183,6 +192,7 @@ DEPENDENCIES
cocoapods-dependencies
cocoapods-downloader!
cocoapods-plugins!
cocoapods-stats!
cocoapods-trunk!
cocoapods-try!
diffy
......
......@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'xcodeproj', '~> 0.25.0'
s.add_runtime_dependency 'cocoapods-downloader', '~> 0.9.1'
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-trunk', '~> 0.6.1'
s.add_runtime_dependency 'molinillo', '~> 0.2.3'
......
......@@ -418,7 +418,7 @@ module Pod
#
def run_plugins_pre_install_hooks
context = PreInstallHooksContext.generate(sandbox, podfile, lockfile)
HooksManager.run(:pre_install, context, podfile.plugins)
HooksManager.run(:pre_install, context, plugins)
end
# Performs any post-installation actions
......@@ -434,7 +434,7 @@ module Pod
#
def run_plugins_post_install_hooks
context = PostInstallHooksContext.generate(sandbox, aggregate_targets)
HooksManager.run(:post_install, context, podfile.plugins)
HooksManager.run(:post_install, context, plugins)
end
# Ensures that all plugins specified in the {#podfile} are loaded.
......@@ -453,6 +453,17 @@ module Pod
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
#
# @return [void]
......
......@@ -698,21 +698,21 @@ module Pod
it 'runs plugins pre install hook' do
context = stub
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)
end
it 'runs plugins post install hook' do
context = stub
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)
end
it 'only runs the podfile-specified hooks' do
context = stub
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)
HooksManager.expects(:run).with(:post_install, context, plugins_hash)
@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