Class: Ronin::Repos::CLI::Commands::Update Private

Inherits:
Ronin::Repos::CLI::Command show all
Includes:
Core::CLI::Logging
Defined in:
lib/ronin/repos/cli/commands/update.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Updates all or one repository from the cache directory.

Usage

ronin-repos update [options] [REPO]

Options

-C, --cache-dir DIR              Overrides the default cache directory
-h, --help                       Print help information

Arguments

[REPO]                           The repository to update

Instance Attribute Summary

Attributes inherited from Ronin::Repos::CLI::Command

#cache_dir

Instance Method Summary collapse

Methods inherited from Ronin::Repos::CLI::Command

#initialize

Constructor Details

This class inherits a constructor from Ronin::Repos::CLI::Command

Instance Method Details

#run(name = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Runs the ronin-repos update command.

Parameters:

  • name (String, nil) (defaults to: nil)

    The optional repository name to update.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/ronin/repos/cli/commands/update.rb', line 63

def run(name=nil)
  if name
    begin
      repo = cache_dir[name]

      log_info "Updating repository #{repo} ..."
      repo.update
    rescue RepositoryNotFound, CommandFailed => error
      log_error(error.message)
      exit(-1)
    end
  else
    cache_dir.each do |repo|
      log_info "Updating repository #{repo} ..."

      begin
        repo.update
      rescue CommandNotInstalled, CommandFailed => error
        log_error("failed to update repository #{repo}: #{error.message}")
      end
    end
  end
end