class RBT::Action::FindAlternativeArchive

Constants

DEFAULT_ARGUMENT
#

DEFAULT_ARGUMENT

#

Public Class Methods

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

RBT::Action::FindAlternativeArchive[]

#
# File lib/rbt/actions/individual_actions/find_alternative_archive/find_alternative_archive.rb, line 175
def self.[](i = ARGV)
  new(i)
end
new( commandline_arguments = DEFAULT_ARGUMENT, run_already = true ) click to toggle source
#

initialize

The first argument should be the full, “expected” path to our archive in question. We need this full path so that this class can replace it with a proper new path, if necessary.

#
# File lib/rbt/actions/individual_actions/find_alternative_archive/find_alternative_archive.rb, line 41
def initialize(
    commandline_arguments = DEFAULT_ARGUMENT,
    run_already           = true
  )
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  if commandline_arguments.empty?
    commandline_arguments? << DEFAULT_ARGUMENT
  end
  run if run_already
end

Public Instance Methods

archive_type()
Alias for: archive_type?
archive_type?() click to toggle source
#

archive_type?

#
# File lib/rbt/actions/individual_actions/find_alternative_archive/find_alternative_archive.rb, line 65
def archive_type? # Return the archive type here.
  return return_archive_type(path?)
end
Also aliased as: archive_type
check_for_other_archive_types()
determine_directory_name() click to toggle source
#

determine_directory_name

#
# File lib/rbt/actions/individual_actions/find_alternative_archive/find_alternative_archive.rb, line 95
def determine_directory_name
  @internal_hash[:directory_name] =
    rds("#{File.dirname(file_path?)}/")
end
determine_file_path() click to toggle source
#

determine_file_path

#
# File lib/rbt/actions/individual_actions/find_alternative_archive/find_alternative_archive.rb, line 85
def determine_file_path
  set_file_path(
    first_argument?
  )
  determine_directory_name
end
directory_name?() click to toggle source
#

directory_name?

#
# File lib/rbt/actions/individual_actions/find_alternative_archive/find_alternative_archive.rb, line 103
def directory_name?
  @internal_hash[:directory_name]
end
file_path?() click to toggle source
#

file_path?

This method will return the file path.

#
# File lib/rbt/actions/individual_actions/find_alternative_archive/find_alternative_archive.rb, line 74
def file_path?
  @internal_hash[:file_path]
end
Also aliased as: path?, path, results?, result?, result
filename?() click to toggle source
#

filename?

#
# File lib/rbt/actions/individual_actions/find_alternative_archive/find_alternative_archive.rb, line 117
def filename?
  remove_file_suffix(
    file_path?
  )
end
find_other_archive(i) click to toggle source
#

find_other_archive

The input to this method should be a version, as a number.

The method will then try to find other archives.

#
# File lib/rbt/actions/individual_actions/find_alternative_archive/find_alternative_archive.rb, line 142
def find_other_archive(i)
  i = i.to_f unless i.is_a? Float
  _ = return_alternative_archives.select {|entry| entry =~ /#{i}/ }
  return _.first unless _.empty?
  nil # else we will return nil.
end
has_alternative?() click to toggle source
#

has_alternative?

#
# File lib/rbt/actions/individual_actions/find_alternative_archive/find_alternative_archive.rb, line 152
def has_alternative?
  return true unless return_alternative_archives.empty?
end
Also aliased as: more_than_one_entry?
more_than_one_entry?()
Alias for: has_alternative?
path()
Alias for: file_path?
path?()
Alias for: file_path?
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method
# File lib/rbt/actions/individual_actions/find_alternative_archive/find_alternative_archive.rb, line 58
def reset
  super()
end
result()
Alias for: file_path?
result?()
Alias for: file_path?
results?()
Alias for: file_path?
return_alternative_archives() click to toggle source
#

return_alternative_archives

#
# File lib/rbt/actions/individual_actions/find_alternative_archive/find_alternative_archive.rb, line 159
def return_alternative_archives
  return_default_files.select {|entry|
    is_an_archive? entry
  }.sort.reverse
end
return_default_files( from = " click to toggle source
#

return_default_files

Return the default files from the @directory_name entry. Note that we will not traverse into subdirectories.

#
# File lib/rbt/actions/individual_actions/find_alternative_archive/find_alternative_archive.rb, line 129
def return_default_files(
    from = "#{directory_name?}*"
  )
  Dir[from]
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/actions/individual_actions/find_alternative_archive/find_alternative_archive.rb, line 168
def run
  determine_file_path
end
set_file_path(i) click to toggle source
#

set_file_path

#
# File lib/rbt/actions/individual_actions/find_alternative_archive/find_alternative_archive.rb, line 110
def set_file_path(i)
  @internal_hash[:file_path] = i
end