Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 28 lines (20 sloc) 0.76 kB
#!/usr/bin/env ruby
unless name = ARGV.first
abort "Usage: script/permadelete [GEM_NAME]"
end
ENV['RAILS_ENV'] ||= 'production'
require_relative '../config/environment'
index = Indexer.new
rubygem = Rubygem.find_by_name!(name)
names = rubygem.versions.map(&:full_name)
require 'highline'
terminal = HighLine.new
confirm = terminal.ask("Are you sure you want to permadelete #{name} with #{names.size} versions? (Y/N)")
if confirm.upcase == "Y" || confirm.upcase == "YES"
names.map { |n| index.directory.files.get("gems/#{n}.gem") }.each(&:destroy)
names.map { |n| index.directory.files.get("quick/Marshal.4.8/#{n}.gemspec.rz") }.each(&:destroy)
rubygem.destroy
puts "#{name} permadeleted."
else
abort "No problem! #{name} lives on."
end
Jump to Line
Something went wrong with that request. Please try again.