public
Description: Your favorite URL-shortening service in all of Ruby land
Homepage: http://rubyurl.com
Clone URL: git://github.com/robbyrussell/rubyurl.git
Search Repo:
rmm5t (author)
Sun Mar 02 14:42:29 -0800 2008
commit  26886b6a75f2c37e6a056058e490e23b04054dcf
tree    32683fd7490fde843e3186728d5791158b9e17b3
parent  20157bf6ac66a72928a455a935a6e8e56bf6110e
rubyurl / script / generate_robots_file
100755 19 lines (12 sloc) 0.394 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/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