public
Clone URL: git://github.com/robbyrussell/rubyurl.git
Search Repo:
rmm5t (author)
Sun Mar 02 13:50:21 -0800 2008
commit  3965c375e8e395640e8a382096821f83355e4961
tree    875c385d5c1f37c9d12050f3ac26077f6bfe7bf4
parent  bd7d666edaa48b47f16b9ea824c9e0bb02f3b31e
rubyurl / script / generate_robots_file
100755 18 lines (12 sloc) 0.394 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/environment'
 
@links = Link.find(:all)
 
robot_file_path = File.dirname(__FILE__) + "/../public/robots.txt"
 
if File.exist?(robot_file_path)
  File.delete(robot_file_path)
end
 
robots_file = File.new(robot_file_path, "w+")
 
robots_file.puts "User-agent: *"
 
@links.each do |link|
  robots_file.puts "Disallow: /#{link.token}"
end