Class: OsCtld::Commands::Repository::Delete

Inherits:
Logged
  • Object
show all
Includes:
OsCtl::Lib::Utils::Log, OsCtl::Lib::Utils::System
Defined in:
lib/osctld/commands/repository/delete.rb

Instance Attribute Summary

Attributes inherited from Base

#client, #client_handler, #id, #opts

Instance Method Summary collapse

Methods inherited from Logged

#base_execute

Methods inherited from Base

#base_execute, #call_cmd, #call_cmd!, #error, #error!, handle, #handled, #indirect?, #initialize, #manipulate, #manipulation_holder, #ok, #progress, #request_stop, run, run!

Constructor Details

This class inherits a constructor from OsCtld::Commands::Base

Instance Method Details

#execute(repo) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/osctld/commands/repository/delete.rb', line 14

def execute(repo)
  if repo.name == 'default'
    error!('the default repository cannot be deleted, only disabled')
  end

  manipulate(repo) do
    syscmd("rm -rf #{repo.cache_path}")
    DB::Repositories.remove(repo)
  end

  ok
end

#findObject



10
11
12
# File 'lib/osctld/commands/repository/delete.rb', line 10

def find
  DB::Repositories.find(opts[:name], opts[:pool])
end