class Cookbooks::ExpandCookbooks
Constants
- NAMESPACE
#¶ ↑
NAMESPACE¶ ↑
#¶ ↑
- STORE_HERE
#¶ ↑
STORE_HERE¶ ↑
#¶ ↑
Public Class Methods
new( expand_which_programs = :all_of_them, run_already = true )
click to toggle source
Public Instance Methods
base_dir_to_store_expanded_cookbooks?()
click to toggle source
consider_updating_program_version_and_url_file()
click to toggle source
#¶ ↑
#consider_updating_program_version_and_url_file¶ ↑
#¶ ↑
# File lib/cookbooks/utility_scripts/expand_cookbooks.rb, line 177 def consider_updating_program_version_and_url_file if is_on_roebe? # ===================================================================== # # On my home system I will auto-update that file as well. # ===================================================================== # Cookbooks.create_program_version_url_file end end
ensure_that_the_base_directory_exists()
click to toggle source
inform_the_user_what_we_will_do_next()
click to toggle source
#¶ ↑
#inform_the_user_what_we_will_do_next¶ ↑
#¶ ↑
# File lib/cookbooks/utility_scripts/expand_cookbooks.rb, line 138 def inform_the_user_what_we_will_do_next if main_array?.size < 2 opnn; e 'We will now expand the program named '+ sfancy(return_default_program_name_as_string)+ ' towards its individual yaml file.' else opnn; e 'We will now expand the whole dataset stored into '\ 'the individual yaml files.' end end
main_array?()
click to toggle source
obtain_available_cookbooks()
click to toggle source
opnn()
click to toggle source
reset()
click to toggle source
return_default_program_name_as_string()
click to toggle source
run()
click to toggle source
set_expand_these_programs( i = :all_of_them )
click to toggle source
#¶ ↑
#set_expand_these_programs¶ ↑
#¶ ↑
# File lib/cookbooks/utility_scripts/expand_cookbooks.rb, line 50 def set_expand_these_programs( i = :all_of_them ) if i.is_a? Array i = i.first end i = :all_of_them if i.nil? # Assign to the default value, in this case. case i # ======================================================================= # # === expand_cookbooks --help # ======================================================================= # when /^-?-?help/ show_help(:then_exit) when :all_of_them i = @cookbooks end unless i.is_a? Array i = [i] # Turn it into an Array. end @expand_these_programs = i end
show_help(also_exit = false)
click to toggle source
#¶ ↑
#show_help¶ ↑
#¶ ↑
# File lib/cookbooks/utility_scripts/expand_cookbooks.rb, line 89 def show_help(also_exit = false) case also_exit when :then_exit also_exit = true end opnn; e 'This class will expand the given arguments (program names) '\ 'into .yml files.' e e 'Invocation example:' e e sfancy(' expand_cookbooks rubyprogressbar') e exit if also_exit end
work_on_each_cookbook()
click to toggle source
#¶ ↑
#work_on_each_cookbook¶ ↑
Work on each cookbook and save the dataset as a hash.
#¶ ↑
# File lib/cookbooks/utility_scripts/expand_cookbooks.rb, line 161 def work_on_each_cookbook @expand_these_programs.each {|program| _ = Cookbooks::Cookbook.new(program) { :bypass_menu } hash = _.hash? dataset_to_save = YAML.dump(hash) what = dataset_to_save into = base_dir_to_store_expanded_cookbooks?+program+'.yml' opnn; e "Now storing the hash from `#{simp(program)}"\ "` into `#{sfile(into)}`." write_what_into(what, into) } end