knife-supermarket 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0be758fcc5429dc74bdb74b2584688cba7a86474
4
- data.tar.gz: eb8d55323765139fd86d8cc24ad6530608af8310
3
+ metadata.gz: e44f3c7622e723d19115bc0c317d8a5b148a7542
4
+ data.tar.gz: fca3200e2c3a45d737c2b1484a7da554769eeefc
5
5
  SHA512:
6
- metadata.gz: 1cfc08cb0cee61e7001ba6bc1311030c8f03e562a51b18356197da554cdaf59171664ff2ab811385116b13aad04a676dbf1d8654f34554989839b388dc1fdf90
7
- data.tar.gz: 3b31bab1cf361efa213e48b3130d9c8572355dbe101c7e86d687ce02e02729443e3579854c4cb3aeb7f4e2e5f0b33d55c6fd6e62eaf9894f3a6980293be4b6cf
6
+ metadata.gz: 30e5dd9d1750911cc98047c03e016dca7b2785d61c3ac6fa6c63187acbfee6618e88f91690b0d94da7a54de0e5c54cf20960a44a0751e00795e15c6c55c5506d
7
+ data.tar.gz: a579be762ee0d10bf0db5fea3c12f9b5d13afc1a9bc054f8268c2a22181f830747328cbd52f1d2419f012c4110fddd624c480459b577adb66f94355139adf156
data/README.md CHANGED
@@ -1,3 +1,35 @@
1
1
  # knife-supermarket
2
2
 
3
- This readme will get some love soon
3
+ This Knife Plugin is an easy way to switch between various supermarkets, the biggest of them being the Chef Community Site, located at [https://supermarket.getchef.com](https://supermarket.getchef.com). The `knife supermarket` commands mimic the `knife cookbook site` commands and work the same way.
4
+
5
+ ## Installation
6
+
7
+ If you are running [Chef-DK](http://www.getchef.com/downloads/chef-dk) you can install it by running:
8
+
9
+ $ chef gem install knife-supermarket
10
+
11
+ Otherwise, this plugin is distributed as a Ruby Gem. To install it, run:
12
+
13
+ $ gem install knife-supermarket
14
+
15
+ Depending on your system's configuration, you may need to run this command with root privileges.
16
+
17
+ ## Configuration
18
+
19
+ Out of the box, knife-supermarket is configured to point at [https://supermarket.getchef.com](https://supermarket.getchef.com), but it can be configured to point at a supermarket that isn't the official one. To do this you can do this a few ways:
20
+
21
+ ### On The Command Line
22
+
23
+ When using the `knife supermarket` commands you can specify a `--supermarket-site` or `-m` flag and specify the uri of the new supermarket. So, for example, if your supermarket was hosted at `https://franchise.somecompany.com` you could run `knife supermarket install --supermarket-site https://franchise.somecompany.com mysql`.
24
+
25
+ ### `knife.rb` Configuration
26
+
27
+ It may be preferable to use have this setting default to another host. For that, we can set the `knife[:supermarket_site]` setting in our `knife.rb`. So if we wanted to default to a supermarket hosted at `https://franchise.somecompany.com` it would be:
28
+
29
+ knife[:supermarket_site] = 'https://franchise.somecompany.com'
30
+
31
+ Now when you run `knife supermarket install mysql` it will install the mysql cookbook from `https://franchise.somecompany.com`.
32
+
33
+ ## Subcommands
34
+
35
+ The subcommands work the same way they for [knife cookbook site](http://docs.opscode.com/chef/knife.html#cookbook-site). Please see [http://docs.opscode.com/chef/knife.html#cookbook-site](http://docs.opscode.com/chef/knife.html#cookbook-site) for more information on the subcommands.
@@ -29,11 +29,11 @@ class Chef
29
29
  :short => '-m SUPERMARKET_SITE',
30
30
  :long => '--supermarket-site SUPERMARKET_SITE',
31
31
  :description => 'Supermarket Site',
32
- :default => 'supermarket.getchef.com',
32
+ :default => 'https://supermarket.getchef.com',
33
33
  :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
34
34
 
35
35
  def cookbooks_api_url
36
- "http://#{config[:supermarket_site]}/api/v1/cookbooks"
36
+ "#{config[:supermarket_site]}/api/v1/cookbooks"
37
37
  end
38
38
  end
39
39
  end
@@ -36,7 +36,7 @@ class Chef
36
36
  :short => '-m SUPERMARKET_SITE',
37
37
  :long => '--supermarket-site SUPERMARKET_SITE',
38
38
  :description => 'Supermarket Site',
39
- :default => 'supermarket.getchef.com',
39
+ :default => 'https://supermarket.getchef.com',
40
40
  :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
41
41
 
42
42
  def download_cookbook_to(download_path)
@@ -29,11 +29,11 @@ class Chef
29
29
  :short => '-m SUPERMARKET_SITE',
30
30
  :long => '--supermarket-site SUPERMARKET_SITE',
31
31
  :description => 'Supermarket Site',
32
- :default => 'supermarket.getchef.com',
32
+ :default => 'https://supermarket.getchef.com',
33
33
  :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
34
34
 
35
35
  def get_cookbook_list(items=10, start=0, cookbook_collection={})
36
- cookbooks_url = "http://#{config[:supermarket_site]}/api/v1/cookbooks?items=#{items}&start=#{start}"
36
+ cookbooks_url = "#{config[:supermarket_site]}/api/v1/cookbooks?items=#{items}&start=#{start}"
37
37
  cr = noauth_rest.get_rest(cookbooks_url)
38
38
  cr["items"].each do |cookbook|
39
39
  cookbook_collection[cookbook["cookbook_name"]] = cookbook
@@ -29,7 +29,7 @@ class Chef
29
29
  :short => '-m SUPERMARKET_SITE',
30
30
  :long => '--supermarket-site SUPERMARKET_SITE',
31
31
  :description => 'Supermarket Site',
32
- :default => 'supermarket.getchef.com',
32
+ :default => 'https://supermarket.getchef.com',
33
33
  :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
34
34
 
35
35
  def run
@@ -37,7 +37,7 @@ class Chef
37
37
  end
38
38
 
39
39
  def search_cookbook(query, items=10, start=0, cookbook_collection={})
40
- cookbooks_url = "http://#{config[:supermarket_site]}/api/v1/search?q=#{query}&items=#{items}&start=#{start}"
40
+ cookbooks_url = "#{config[:supermarket_site]}/api/v1/search?q=#{query}&items=#{items}&start=#{start}"
41
41
  cr = noauth_rest.get_rest(cookbooks_url)
42
42
  cr["items"].each do |cookbook|
43
43
  cookbook_collection[cookbook["cookbook_name"]] = cookbook
@@ -35,11 +35,11 @@ class Chef
35
35
  :short => '-m SUPERMARKET_SITE',
36
36
  :long => '--supermarket-site SUPERMARKET_SITE',
37
37
  :description => 'Supermarket Site',
38
- :default => 'supermarket.getchef.com',
38
+ :default => 'https://supermarket.getchef.com',
39
39
  :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
40
40
 
41
41
  def do_upload(cookbook_filename, cookbook_category, user_id, user_secret_filename)
42
- uri = "http://#{config[:supermarket_site]}/api/v1/cookbooks"
42
+ uri = "#{config[:supermarket_site]}/api/v1/cookbooks"
43
43
 
44
44
  category_string = { 'category'=>cookbook_category }.to_json
45
45
 
@@ -29,20 +29,20 @@ class Chef
29
29
  :short => '-m SUPERMARKET_SITE',
30
30
  :long => '--supermarket-site SUPERMARKET_SITE',
31
31
  :description => 'Supermarket Site',
32
- :default => 'supermarket.getchef.com',
32
+ :default => 'https://supermarket.getchef.com',
33
33
  :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
34
34
 
35
35
  def get_cookbook_data
36
36
  case @name_args.length
37
37
  when 1
38
- noauth_rest.get_rest("http://#{config[:supermarket_site]}/api/v1/cookbooks/#{@name_args[0]}")
38
+ noauth_rest.get_rest("#{config[:supermarket_site]}/api/v1/cookbooks/#{@name_args[0]}")
39
39
  when 2
40
- noauth_rest.get_rest("http://#{config[:supermarket_site]}/api/v1/cookbooks/#{@name_args[0]}/versions/#{name_args[1].gsub('.', '_')}")
40
+ noauth_rest.get_rest("#{config[:supermarket_site]}/api/v1/cookbooks/#{@name_args[0]}/versions/#{name_args[1].gsub('.', '_')}")
41
41
  end
42
42
  end
43
43
 
44
44
  def get_cookbook_list(items=10, start=0, cookbook_collection={})
45
- cookbooks_url = "http://#{config[:supermarket_site]}/api/v1/cookbooks?items=#{items}&start=#{start}"
45
+ cookbooks_url = "#{config[:supermarket_site]}/api/v1/cookbooks?items=#{items}&start=#{start}"
46
46
  cr = noauth_rest.get_rest(cookbooks_url)
47
47
  cr["items"].each do |cookbook|
48
48
  cookbook_collection[cookbook["cookbook_name"]] = cookbook
@@ -33,7 +33,7 @@ class Chef
33
33
  :short => '-m SUPERMARKET_SITE',
34
34
  :long => '--supermarket-site SUPERMARKET_SITE',
35
35
  :description => 'Supermarket Site',
36
- :default => 'supermarket.getchef.com',
36
+ :default => 'https://supermarket.getchef.com',
37
37
  :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
38
38
 
39
39
  def run
@@ -47,7 +47,7 @@ class Chef
47
47
  confirm "Do you really want to unshare the cookbook #{@cookbook_name}"
48
48
 
49
49
  begin
50
- rest.delete_rest "http://#{config[:supermarket_site]}/api/v1/cookbooks/#{@name_args[0]}"
50
+ rest.delete_rest "#{config[:supermarket_site]}/api/v1/cookbooks/#{@name_args[0]}"
51
51
  rescue Net::HTTPServerException => e
52
52
  raise e unless e.message =~ /Forbidden/
53
53
  ui.error "Forbidden: You must be the maintainer of #{@cookbook_name} to unshare it."
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Supermarket
3
- VERSION = '0.0.3'
3
+ VERSION = '0.1.0'
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-supermarket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Webber
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-06 00:00:00.000000000 Z
11
+ date: 2014-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef
@@ -69,3 +69,4 @@ signing_key:
69
69
  specification_version: 4
70
70
  summary: Knife support for interacting with Chef Supermarkets
71
71
  test_files: []
72
+ has_rdoc: