summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-02-04 10:31:31 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-02-09 09:16:06 -0800
commitd4e99ab8b124dbb87e673040bc0e99968a7cf168 (patch)
treee28cb53ed4a898d135a3dcd72f50a68c4a845eb9
parent76d9cc80851fddf30c7e60257403c2ddaaa9fdb4 (diff)
downloadchef-d4e99ab8b124dbb87e673040bc0e99968a7cf168.tar.gz
add comments and cleanup
-rw-r--r--lib/chef/cookbook/gem_installer.rb14
-rw-r--r--lib/chef/event_dispatch/base.rb6
-rw-r--r--lib/chef/formatters/doc.rb1
3 files changed, 14 insertions, 7 deletions
diff --git a/lib/chef/cookbook/gem_installer.rb b/lib/chef/cookbook/gem_installer.rb
index eccaa0e864..4211c61d2f 100644
--- a/lib/chef/cookbook/gem_installer.rb
+++ b/lib/chef/cookbook/gem_installer.rb
@@ -1,6 +1,4 @@
#--
-# Author:: Christopher Walters (<cw@opscode.com>)
-# Author:: Tim Hinderliter (<tim@opscode.com>)
# Copyright:: Copyright (c) 2010-2016 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
@@ -23,7 +21,10 @@ require "bundler/inline"
class Chef
class Cookbook
class GemInstaller
+
+ # @return [Chef::EventDispatch::Dispatcher] the client event dispatcher
attr_accessor :events
+ # @return [Chef::CookbookCollection] the cookbook collection
attr_accessor :cookbook_collection
def initialize(cookbook_collection, events)
@@ -31,6 +32,8 @@ class Chef
@events = events
end
+ # Installs the gems into the omnibus gemset.
+ #
def install
cookbook_gems = []
@@ -57,6 +60,9 @@ class Chef
events.cookbook_gem_finished
end
+ # Bundler::UI object so that we can intercept and log the output
+ # of the in-memory bundle install that we are going to do.
+ #
class ChefBundlerUI < Bundler::UI::Silent
attr_accessor :events
@@ -96,6 +102,10 @@ class Chef
private
+ # Helper to handle older bundler versions that do not support injecting the UI
+ # object. On older bundler versions, we work, but you get no output other than
+ # on STDOUT.
+ #
def inline_gemfile(&block)
# requires https://github.com/bundler/bundler/pull/4245
gemfile(true, ui: ChefBundlerUI.new(events), &block)
diff --git a/lib/chef/event_dispatch/base.rb b/lib/chef/event_dispatch/base.rb
index 14444dd4eb..b3271a139a 100644
--- a/lib/chef/event_dispatch/base.rb
+++ b/lib/chef/event_dispatch/base.rb
@@ -140,11 +140,7 @@ class Chef
end
# Called when starting to collect gems from the cookbooks
- def cookbook_gem_start
- end
-
- # Called with the full list of gems to resolve
- def cookbook_gem_set(gems)
+ def cookbook_gem_start(gems)
end
# Called when the result of installing the bundle is to install the gem
diff --git a/lib/chef/formatters/doc.rb b/lib/chef/formatters/doc.rb
index b7c65b9739..3f832f1e92 100644
--- a/lib/chef/formatters/doc.rb
+++ b/lib/chef/formatters/doc.rb
@@ -201,6 +201,7 @@ class Chef
unindent
end
+ # Called when cookbook gem installation fails
def cookbook_gem_failed(exception)
unindent
end