Class: KnifeBriefcase::Knife

Inherits:
Chef::Knife
  • Object
show all
Defined in:
lib/knife-briefcase/knife.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.depsObject



6
7
8
9
10
11
12
13
14
# File 'lib/knife-briefcase/knife.rb', line 6

def self.deps
  super do
    require 'chef/data_bag'
    require 'chef/data_bag_item'
    require 'gpgme'
    require 'highline'
    yield if block_given?
  end
end

.inherited(c) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/knife-briefcase/knife.rb', line 16

def self.inherited(c)
  super

  # Ensure we always get to do our includes, whether subclass calls deps or not
  c.deps do
  end

  c.category 'briefcase'
  c.option :data_bag,
           :long => '--data-bag DATA_BAG_NAME',
           :description => 'Name of the data bag'
end

Instance Method Details

#data_bag_nameObject



29
30
31
# File 'lib/knife-briefcase/knife.rb', line 29

def data_bag_name
  config[:data_bag] || Chef::Config[:briefcase_data_bag] || 'briefcase'
end

#fileObject



51
52
53
54
# File 'lib/knife-briefcase/knife.rb', line 51

def file
  rv = @name_args[1]
  rv == '-' ? nil : rv
end

#highlineObject



45
46
47
48
49
# File 'lib/knife-briefcase/knife.rb', line 45

def highline
  super
rescue NameError
  @highline ||= HighLine.new
end

#item_nameObject



41
42
43
# File 'lib/knife-briefcase/knife.rb', line 41

def item_name
  @name_args.first
end

#recipientsObject



37
38
39
# File 'lib/knife-briefcase/knife.rb', line 37

def recipients
  Chef::Config[:briefcase_holders]
end

#signersObject



33
34
35
# File 'lib/knife-briefcase/knife.rb', line 33

def signers
  Chef::Config[:briefcase_signers]
end