class RBT::ImproveTheCookbookRecipes

Public Class Methods

[](i = ARGV) click to toggle source
#

RBT::ImproveTheCookbookRecipes[]

#
# File lib/rbt/cookbooks/improve_the_cookbook_recipes/improve_the_cookbook_recipes.rb, line 157
def self.[](i = ARGV)
  new(i)
end
new( commandline_arguments = nil, run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/cookbooks/improve_the_cookbook_recipes/improve_the_cookbook_recipes.rb, line 35
def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Public Instance Methods

reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::LeanPrototype#reset
# File lib/rbt/cookbooks/improve_the_cookbook_recipes/improve_the_cookbook_recipes.rb, line 49
def reset
  super()
  infer_the_namespace
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/cookbooks/improve_the_cookbook_recipes/improve_the_cookbook_recipes.rb, line 79
def run
  set_work_on_these_yaml_files(
    Dir[RUBY_SRC_DIR+'rbt/lib/rbt/yaml/cookbooks/*.yml']
  )
  found_n_problems = 0 # How many faulty .yml files were found.
  @work_on_these_yaml_files.each {|entry|
    dataset = File.read(entry) # Read in the full content of the .yml file here.
    # ===================================================================== #
    # === keep_extracted: f
    # ===================================================================== #
    if dataset =~ /keep_extracted: f$/
      found_n_problems += 1
      e 'The file `'+steelblue(entry.to_s)+rev+
        '` has a less-than-optimal '\
        'keep_extracted value (of "f").'
      if is_on_roebe?
        this_has_been_corrected
        # copy_file(entry, '/Depot/j/'+File.basename(entry))
        data = File.read(entry)
        data.sub!(/keep_extracted: f/,'keep_extracted: no')
        e 'Saving into '+sfile(entry)+rev+' next.'
        write_what_into(data, entry)
      end
    end
    # ===================================================================== #
    # === keep_extracted: t
    # ===================================================================== #
    if dataset =~ /keep_extracted: t$/
      found_n_problems += 1
      e 'The file `'+steelblue(entry.to_s)+'` has a less-than-optimal '\
        'keep_extracted value (of "t").'
      if is_on_roebe?
        this_has_been_corrected
        data = File.read(entry)
        data.sub!(/keep_extracted: t/,'keep_extracted: yes')
        e 'Saving into '+sfile(entry)+rev+' next.'
        write_what_into(data, entry)
      end
    end
    # ===================================================================== #
    # === symlink_headers: t
    # ===================================================================== #
    if dataset =~ /symlink_headers: t$/
      found_n_problems += 1
      e 'The file `'+steelblue(entry.to_s)+'` has a less-than-optimal '\
        'symlink_headers value (of "t").'
      if is_on_roebe?
        this_has_been_corrected
        data = File.read(entry)
        data.sub!(/symlink_headers: t/,'symlink_headers: yes')
        e 'Saving into '+sfile(entry)+rev+' next.'
        write_what_into(data, entry)
      end
    end
    # ===================================================================== #
    # === symlink_pkgconfig_files: t
    # ===================================================================== #
    if dataset =~ /symlink_pkgconfig_files: t$/
      found_n_problems += 1
      e 'The file `'+steelblue(entry.to_s)+'` has a less-than-optimal '\
        'symlink_pkgconfig_files value (of "t").'
      if is_on_roebe?
        this_has_been_corrected
        data = File.read(entry)
        data.sub!(/symlink_pkgconfig_files: t/,'symlink_pkgconfig_files: yes')
        e 'Saving into '+sfile(entry)+rev+' next.'
        write_what_into(data, entry)
      end
    end
  }
  if found_n_problems == 0
    verbose_report_to_the_user_that_no_problem_was_found
  end
end
set_work_on_these_yaml_files(i) click to toggle source
#

set_work_on_these_yaml_files

#
# File lib/rbt/cookbooks/improve_the_cookbook_recipes/improve_the_cookbook_recipes.rb, line 72
def set_work_on_these_yaml_files(i)
  @work_on_these_yaml_files = i
end
this_has_been_corrected() click to toggle source
#

this_has_been_corrected

#
# File lib/rbt/cookbooks/improve_the_cookbook_recipes/improve_the_cookbook_recipes.rb, line 65
def this_has_been_corrected
  e "#{rev}This has been corrected."
end
verbose_report_to_the_user_that_no_problem_was_found() click to toggle source
#

verbose_report_to_the_user_that_no_problem_was_found

#
# File lib/rbt/cookbooks/improve_the_cookbook_recipes/improve_the_cookbook_recipes.rb, line 57
def verbose_report_to_the_user_that_no_problem_was_found
  opne 'No problem was found. This is great! '+
       gold(cheering_person)
end