Class: Gerd::Inspections::Actions::DeleteRepo

Inherits:
Object
  • Object
show all
Defined in:
lib/gerd/inspections/actions/delete_repo.rb

Instance Method Summary collapse

Constructor Details

#initialize(repo_to_delete, organisation) ⇒ DeleteRepo

Returns a new instance of DeleteRepo.



7
8
9
10
# File 'lib/gerd/inspections/actions/delete_repo.rb', line 7

def initialize(repo_to_delete, organisation)
  @org = organisation
  @repo = repo_to_delete
end

Instance Method Details

#invoke(client, options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/gerd/inspections/actions/delete_repo.rb', line 12

def invoke(client, options = {})
 if !options[:delete]
   puts "You must explicitly use the --delete option to delete repos"
   return
  end
  opts = {
    :organization => @org
  }
  repo_name = "#{@org}/#{@repo}"
  puts "Deleting #{repo_name}"
  client.delete_repository(repo_name, opts)
end