Class: Souschef::Berkshelf

Inherits:
Object
  • Object
show all
Defined in:
lib/souschef/berkshelf.rb

Overview

Includes slave functions that do all the work

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Berkshelf

Returns a new instance of Berkshelf.



6
7
8
# File 'lib/souschef/berkshelf.rb', line 6

def initialize(opts)
  @opts = opts
end

Instance Attribute Details

#cookbook_dirObject

Returns the value of attribute cookbook_dir.



4
5
6
# File 'lib/souschef/berkshelf.rb', line 4

def cookbook_dir
  @cookbook_dir
end

#optsObject

Returns the value of attribute opts.



4
5
6
# File 'lib/souschef/berkshelf.rb', line 4

def opts
  @opts
end

Instance Method Details

#berks_createObject

Public - Tell Berkshelf to create a cookbook

Returns nil



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/souschef/berkshelf.rb', line 13

def berks_create
  remove_old_readme
  Souschef::Print.info 'Creating cookbook structure' if @opts[:verbose]

  i, o, e, w = Open3.popen3(berks_cmd)
  print_open3_stdout(o) if @opts[:verbose]
  remove_vagrantfile
  print_open3_stdout(e)
  i.close
  fail 'Berks failed' unless w.value == 0
end