-
Notifications
You must be signed in to change notification settings - Fork 21
/
Thorfile
43 lines (32 loc) · 1007 Bytes
/
Thorfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# frozen_string_literal: true
# -*- ruby -*-
require 'rubygems'
require 'bundler/setup'
require 'shellwords'
class Cookbook < Thor
COOKBOOK_NAME = 'ssl-key-vault'
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"
$CHILD_STATUS.success?
end
end
end