public
Description: Easy, fresh, feature-rich IRC bots in Ruby
Homepage:
Clone URL: git://github.com/RISCfuture/autumn.git
autumn / script / destroy
100755 49 lines (42 sloc) 1.16 kb
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env ruby
#
# == Synopsis
#
# Destroys the files for leaves, seasons, and other objects of the Autumn
# framework.
#
# == Usage
#
# script/destroy <options> <object> <name>
#
# <object>:: The object type to destroy. Valid types are "leaf" and "season".
# <name>:: The name of the object to destroy. For example, you can call
# "script/destroy leaf Scorekeeper" to remove a leaf named Scorekeeper.
#
# == Options
#
# --help, -h:: Displays this usage information.
# --vcs, -c:: Remove any created files or directories from the project's version
# control system. (Autodetects CVS and Subversion.)
 
require 'libs/script'
 
opts = GetoptLong.new(
  [ '--help', '-h', GetoptLong::NO_ARGUMENT ],
  [ '--vcs', '-c', GetoptLong::NO_ARGUMENT ]
)
 
script = Autumn::Script.new
 
begin
  opts.each do |opt, arg|
    case opt
      when '--help' then RDoc::usage
      when '--vcs' then script.use_vcs
    end
  end
rescue GetoptLong::InvalidOption
  RDoc::usage
  exit 0
end
 
exit(0) unless script.parse_argv(ARGV)
 
case script.object
  when 'leaf' then script.call_generator(:unleaf)
  when 'season' then script.call_generator(:unseason)
end