2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/theroku/destroy_command.rb', line 2
def execute(subdomain)
if File.exists?('.theroku')
puts "Deleting #{subdomain}..."
file = File.open(".theroku", "rb")
token = file.read
response = HTTParty.delete("#{Theroku::base_url}apps/#{subdomain}",
headers: { 'Authorization' => "Token token=#{token}", 'Content-Type' => 'application/json', 'Accept' => 'application/json'}
)
if response.code == 200
puts "You have successfully destroyed #{subdomain} app"
else
puts "There were the following errors:"
puts response["errors"].capitalize
end
else
puts "You have to login before making any changes you can do that with $ theroku login"
end
end
|