diff options
author | Thom May <thom@chef.io> | 2016-05-05 14:29:07 +0100 |
---|---|---|
committer | Thom May <thom@chef.io> | 2016-05-05 14:57:34 +0100 |
commit | 232f78be0d348e6b07b12f9efbca55f1a66cbb3d (patch) | |
tree | c1a1cccfe2a5470f576abc53c675bea7cc3dde67 /lib/chef/knife/cookbook_site_search.rb | |
parent | 0f5e73eebbb509750a380ccddfaf112ba415dd4a (diff) | |
download | chef-232f78be0d348e6b07b12f9efbca55f1a66cbb3d.tar.gz |
Deprecate knife-supermarket gemtm/include_knife_supermarket
Include all knife supermarket sub commands here, and allow all knife
cookbook site commands to have a configurable supermarket URL.
Signed-off-by: Thom May <thom@may.lt>
Diffstat (limited to 'lib/chef/knife/cookbook_site_search.rb')
-rw-r--r-- | lib/chef/knife/cookbook_site_search.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/chef/knife/cookbook_site_search.rb b/lib/chef/knife/cookbook_site_search.rb index ba4b873efc..d401844217 100644 --- a/lib/chef/knife/cookbook_site_search.rb +++ b/lib/chef/knife/cookbook_site_search.rb @@ -24,12 +24,19 @@ class Chef banner "knife cookbook site search QUERY (options)" category "cookbook site" + option :supermarket_site, + :short => "-m SUPERMARKET_SITE", + :long => "--supermarket-site SUPERMARKET_SITE", + :description => "Supermarket Site", + :default => "https://supermarket.chef.io", + :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket } + def run output(search_cookbook(name_args[0])) end def search_cookbook(query, items = 10, start = 0, cookbook_collection = {}) - cookbooks_url = "https://supermarket.chef.io/api/v1/search?q=#{query}&items=#{items}&start=#{start}" + cookbooks_url = "#{config[:supermarket_site]}/api/v1/search?q=#{query}&items=#{items}&start=#{start}" cr = noauth_rest.get(cookbooks_url) cr["items"].each do |cookbook| cookbook_collection[cookbook["cookbook_name"]] = cookbook |