class RBT::ImproveTheCookbookRecipes
Public Class Methods
[](i = ARGV)
click to toggle source
new( commandline_arguments = nil, run_already = true )
click to toggle source
Public Instance Methods
reset()
click to toggle source
run()
click to toggle source
#¶ ↑
run (run tag)¶ ↑
#¶ ↑
# File lib/rbt/cookbooks/improve_the_cookbook_recipes/improve_the_cookbook_recipes.rb, line 57 def run all_yaml_files = Dir[ '/home/x/programming/ruby/src/rbt/lib/rbt/yaml/cookbooks/*.yml' ] found_n_problems = 0 all_yaml_files.each {|entry| dataset = File.read(entry) if dataset =~ /keep_extracted: f$/ found_n_problems += 1 e 'The file `'+steelblue(entry.to_s)+'` has a less-than-optimal '\ 'keep_extracted value (of "f").' if is_on_roebe? e 'This has been corrected.' # copy_file(entry, '/Depot/j/'+File.basename(entry)) data = File.read(entry) data.sub!(/keep_extracted: f/,'keep_extracted: no') write_what_into(data, entry) end end 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? e 'This has been corrected.' data = File.read(entry) data.sub!(/keep_extracted: t/,'keep_extracted: yes') write_what_into(data, entry) end end } if found_n_problems == 0 opne 'No problem was found. This is great! '+ gold(cheering_person) end end