lib/ronin/ui/cli/commands/repos.rb in ronin-1.0.0.pre4 vs lib/ronin/ui/cli/commands/repos.rb in ronin-1.0.0.rc1
- old
+ new
@@ -51,10 +51,13 @@
class_option :hg, :type => :boolean
class_option :git, :type => :boolean
argument :name, :type => :string, :required => false
+ #
+ # Executes the command.
+ #
def execute
Database.setup
if options[:add]
add options[:add]
@@ -69,10 +72,16 @@
end
end
protected
+ #
+ # The selected SCM.
+ #
+ # @return [Symbol]
+ # The name of the selected SCM.
+ #
def scm
@scm ||= if options[:scm]
options[:scm].to_sym
elsif options.rsync?
:rsync
@@ -104,10 +113,13 @@
end
end
end
end
+ #
+ # Lists installed or added Repositories.
+ #
def list
unless name
print_array Repository.all
else
repo = begin
@@ -175,10 +187,16 @@
end
end
end
end
+ #
+ # Adds a Repository.
+ #
+ # @param [String] path
+ # The path of the local repository.
+ #
def add(path)
repo = begin
Repository.add!(:path => path, :scm => @scm)
rescue DuplicateRepository => e
print_error e.message
@@ -186,10 +204,16 @@
end
print_info "Repository #{repo} added."
end
+ #
+ # Installs a Repository.
+ #
+ # @param [String, URI] uri
+ # The URI of the remote repository.
+ #
def install(uri)
repo = begin
Repository.install!(:uri => uri, :scm => scm)
rescue DuplicateRepository => e
print_error e.message
@@ -198,10 +222,13 @@
print_cache_errors(repo)
print_info "Repository #{repo} has been installed."
end
+ #
+ # Updates installed Repositories.
+ #
def update
repos = if name
begin
[Repository.find(name)]
rescue RepositoryNotFound => e
@@ -220,9 +247,15 @@
print_cache_errors(repo)
print_info "Repository updated."
end
end
+ #
+ # Uninstalls a Repository.
+ #
+ # @param [String] name
+ # The name of the repository.
+ #
def uninstall(name)
repo = Repository.uninstall!(name)
print_info "Uninstalling repository #{repo} ..."
end