public
Clone URL: git://github.com/robbyrussell/rubyurl.git
Search Repo:
Robby Russell (author)
Sun Mar 02 17:43:00 -0800 2008
commit  f7fd211defe7227b53aa0ac6a05a0894b588ae0e
tree    2df056fa762f97565403149e910ae39c1dcf15a6
parent  ecbc90102fe92306a6bd5a8880e5fe952c558682
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