-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete_project
More file actions
32 lines (28 loc) · 792 Bytes
/
delete_project
File metadata and controls
32 lines (28 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
#
# Deletes a project.
#
# If you delete a user, all the projects and repositories belonging to the user
# will be deleted as well, and you don't need to call this script explicitly.
#
require File.dirname(__FILE__)+'/../config/environment'
ActionMailer::Base.raise_delivery_errors = false
ActionMailer::Base.delivery_method = :test
# Arguments
project_name = ARGV[0]
# Check the project name.
project = Project.find_by_title(project_name)
if !project
puts "There's no project with the title #{project_name}."
exit(1)
end
if project.destroy
#puts "Project #{project_id} deleted successfully."
else
puts "Failed to delete project #{project_id}."
project.errors.each_full { |msg| puts msg }
exit(1)
end
# print a dummy number
puts 0