forked from ebroder/anygit
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index-all
executable file
·50 lines (41 loc) · 954 Bytes
/
index-all
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
50
#!/usr/bin/env ruby
require 'optparse'
require 'fileutils'
require File.join(File.dirname(__FILE__), '../lib/anygit')
def main
options = {}
optparse = OptionParser.new do |opts|
opts.banner = "Usage: #{$0} [options] <url>"
opts.on('-h', '--help', 'Display this message') do
puts opts
exit(1)
end
opts.on('-d', '--dont-delete', 'Leave dumps lying around') do
options[:dont_delete] = true
end
opts.on('-l', '--loop-forever', 'Loop') do
options[:loop_forever] = true
end
end
optparse.parse!
if ARGV.length != 0
puts optparse
return 1
end
Anygit::Model.init
while true
Anygit::Indexer.run_all(:dont_delete => options[:dont_delete])
break unless options[:loop_forever]
# Really want some notification from the web interface, but meh.
sleep(5)
end
return 0
end
if $0 == __FILE__
ret = main
begin
exit(ret)
rescue TypeError
exit(0)
end
end