-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
not sure why this was never checked in
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env ruby | ||
|
||
# Mass delete, just pass the names or full paths of the repos to delete | ||
# and both the github and local repos/* repositories will be deleted. | ||
# | ||
## | ||
# You might need to wait for a few hours between deleting and pushing | ||
# since github has a bug where quickly deleting, creating, and pushing a | ||
# repo with the same name will just result in a resurrection of the old | ||
# repo with the old contents, not an empty one. | ||
# | ||
# Now you can use "FORCE=1 ./scraper 0999" to get around this. It doesn't | ||
# update the script's description but usually that's not needed and it's | ||
# better than waiting for github to fix this bug! | ||
|
||
|
||
$:.unshift './lib' | ||
|
||
require 'bundler' | ||
Bundler.require | ||
require 'github' | ||
|
||
|
||
scripts = {} | ||
|
||
ARGV.each do |name| | ||
name =~ /^repos\/(.*)\.git\/?$/ | ||
name = $1 if $1 | ||
path = "repos/#{name}.git" | ||
|
||
if test ?d, path | ||
scripts[name] = path | ||
else | ||
puts "warning: can't find #{path}" | ||
end | ||
end | ||
|
||
github = GitHub.new | ||
scripts.each do |name,path| | ||
github.delete name | ||
end | ||
|
||
scripts.each do |name,path| | ||
begin | ||
FileUtils.rm_rf path | ||
puts "deleted #{path}" | ||
rescue Exception => e | ||
puts "could not delete #{path}: #{e}" | ||
end | ||
end | ||
|