class 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
# File lib/cookbooks/utility_scripts/merge_cookbooks.rb, line 30
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

opnn() click to toggle source
#

opnn

#
Calls superclass method Cookbooks::Base#opnn
# File lib/cookbooks/utility_scripts/merge_cookbooks.rb, line 74
def opnn
  super(NAMESPACE)
end
reset() click to toggle source
#

reset

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

run

#
# File lib/cookbooks/utility_scripts/merge_cookbooks.rb, line 81
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/cookbooks/utility_scripts/merge_cookbooks.rb, line 65
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/cookbooks/utility_scripts/merge_cookbooks.rb, line 57
def set_full_path(i = :default)
  i = DEFAULT_LOCATION if i == :default
  @full_path = i
end