class RBT::Cookbooks::MergeCookbooks

Constants

DEFAULT_LOCATION
#

DEFAULT_LOCATION

#
NAMESPACE
#

NAMESPACE

#

Public Class Methods

new( path_where_to_store = DEFAULT_LOCATION, be_verbose = true ) click to toggle source
#

initialize

#
Calls superclass method RBT::Base::new
# File lib/rbt/utility_scripts/merge_cookbooks.rb, line 31
def initialize(
    path_where_to_store = DEFAULT_LOCATION,
    be_verbose          = true
  )
  super()
  reset
  set_full_path(
    path_where_to_store+@name_of_new_cookbook_file # Get a default name for now.
  )
  if be_verbose
    opnn; e 'We will store at '+sfancy(@full_path)
  end
  run
end

Public Instance Methods

reset() click to toggle source
#

reset

#
Calls superclass method RBT::Base#reset
# File lib/rbt/utility_scripts/merge_cookbooks.rb, line 49
def reset
  super()
  @namespace = NAMESPACE
  @array_merged = []
  @name_of_new_cookbook_file = 'merged_cookbook.yml'
end
run() click to toggle source
#

run

#
# File lib/rbt/utility_scripts/merge_cookbooks.rb, line 76
def run
  get_cookbooks(false).each { |entry|  # False for "don't apply filter".
    _ = read_file(entry)
    @array_merged << _ << N
    @array_merged.flatten!
  }
  save_file
end
save_file() click to toggle source
#

save_file

#
# File lib/rbt/utility_scripts/merge_cookbooks.rb, line 67
def save_file
  opnn; e "Merging cookbook file into `#{@full_path}`."
  remove_file(@full_path) if File.exist? @full_path
  write_what_into(@array_merged.join, @full_path,'w+')
end
set_full_path(i = :default) click to toggle source
#

set_full_path

#
# File lib/rbt/utility_scripts/merge_cookbooks.rb, line 59
def set_full_path(i = :default)
  i = DEFAULT_LOCATION if i == :default
  @full_path = i
end