Class: KnifeSolo::CookbookManagerSelector
- Inherits:
-
Object
- Object
- KnifeSolo::CookbookManagerSelector
- Defined in:
- lib/knife-solo/cookbook_manager_selector.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#ui ⇒ Object
readonly
Returns the value of attribute ui.
Instance Method Summary collapse
-
#initialize(config, ui) ⇒ CookbookManagerSelector
constructor
A new instance of CookbookManagerSelector.
- #select(base) ⇒ Object
Constructor Details
#initialize(config, ui) ⇒ CookbookManagerSelector
Returns a new instance of CookbookManagerSelector.
8 9 10 11 |
# File 'lib/knife-solo/cookbook_manager_selector.rb', line 8 def initialize(config, ui) @config = config @ui = ui end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/knife-solo/cookbook_manager_selector.rb', line 6 def config @config end |
#ui ⇒ Object (readonly)
Returns the value of attribute ui.
6 7 8 |
# File 'lib/knife-solo/cookbook_manager_selector.rb', line 6 def ui @ui end |
Instance Method Details
#select(base) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/knife-solo/cookbook_manager_selector.rb', line 13 def select(base) Chef::Log.debug "Selecting cookbook manager..." if (selected = select_or_disable_by_chef_config!) return selected elsif managers.empty? Chef::Log.debug "All disabled by configuration" return nil end selected = select_by_existing_conf_file(base) || select_by_installed_gem if selected.nil? Chef::Log.debug "Nothing selected" # TODO: ui.msg "Recommended to use a cookbook manager" end selected end |