Initial Chef repository

This commit is contained in:
Greg Karékinian
2015-07-21 19:45:23 +02:00
parent 7e5401fc71
commit ee4079fa85
1151 changed files with 185163 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
# -*- ruby -*-
require 'rubygems'
require 'bundler/setup'
require 'shellwords'
class Cookbook < Thor
COOKBOOK_NAME = 'hostname'
COOKBOOK_CATEGORY = 'utilities'
include Thor::Actions
desc :edit, "Edit cookbook in browser"
def edit
open "http://community.opscode.com/cookbooks/#{COOKBOOK_NAME}/edit"
end
desc :browse, "Go to cookbook's page on Opscode's community website"
def browse
open "http://community.opscode.com/cookbooks/#{COOKBOOK_NAME}/"
end
desc :upload, "Upload cookbook to Opscode's community website"
def upload
run "knife cookbook site share #{COOKBOOK_NAME} #{Shellwords.escape(COOKBOOK_CATEGORY)} -o #{Shellwords.escape(File.dirname(File.dirname(__FILE__)))}"
end
private
def open(what)
run "#{open_cmd} #{Shellwords.escape(what)}"
end
def open_cmd
@open_cmd ||= %w[open xdg-open].find do |command|
system "which #{command} >/dev/null 2>&1"
$?.success?
end
end
end