class RBT::Cookbooks::LocalCheckForLatest
Constants
- NAMESPACE
#¶ ↑
NAMESPACE
¶ ↑#¶ ↑
- STORE_HERE
#¶ ↑
STORE_HERE
¶ ↑Specify where to store the results.
#¶ ↑
Public Class Methods
Public Instance Methods
all_files?()
click to toggle source
get_all_local_files()
click to toggle source
get_available_programs()
click to toggle source
is_latest?(input)
click to toggle source
#¶ ↑
is_latest?¶ ↑
The input to this method is something like:
/Users/x/SRC/zsh/zsh-4.3.10.tar.bz2
#¶ ↑
# File lib/rbt/utility_scripts/local_check_for_latest.rb, line 141 def is_latest?(input) short_name = ProgramInformation.return_name(input).downcase @cookbook_dataset.seek(short_name) _ = @cookbook_dataset.is_included? # The above is by default always true. Hence we must set it to false # in case ! .full_path == input the_path = @cookbook_dataset.full_path e the_path _ = false unless the_path == input return _ end
iterate_over_available_programs()
click to toggle source
#¶ ↑
iterate_over_available_programs
¶ ↑
When we have stored all available programs in the array @available_programs we can continue to iterate through it.
#¶ ↑
# File lib/rbt/utility_scripts/local_check_for_latest.rb, line 75 def iterate_over_available_programs @available_programs.each { |program| cliner { @save_this_string_to_file << N+N _ = ' ---> '+program @save_this_string_to_file << _+N opnn; e _ all_files?.each { |long, short| if program == short if is_latest?(long) _ = long+' this is the latest version locally. You should keep it.' # Explanation: We don't store what we should keep, we only store # what we should remove, as suggestion to the user. # @save_this_string_to_file << _+N # Disabled the above APR 2011. e _ else _ = "#{long} is quite old. You could consider deleting it." @save_this_string_to_file << "#{_}#{N}" opnn; ewarn _ end end } } } end
reset()
click to toggle source
#¶ ↑
reset¶ ↑
Initialize our variables here.
#¶ ↑
Calls superclass method
RBT::Base#reset
# File lib/rbt/utility_scripts/local_check_for_latest.rb, line 53 def reset # reset tag super() @namespace = NAMESPACE @store_where = STORE_HERE @source_directory = source_directory?+'*/**' @save_this_string_to_file = ''.dup # we save this string to the file. @cookbook_dataset = RBT::Cookbooks::Cookbook.new(:do_not_run_yet) { :bypass_menu } end
run()
click to toggle source
save_data_to_file()
click to toggle source
#¶ ↑
save_data_to_file
¶ ↑
Remove the file, then save the data into @store_where.
#¶ ↑
# File lib/rbt/utility_scripts/local_check_for_latest.rb, line 121 def save_data_to_file opnn; e 'Storing data into:' opnn; e ' '+sfile(store_where?) remove_file(store_where?) write_what_into(@save_this_string_to_file, store_where?) end