bot管理

ディレクトリ下にahokaiを複数配置

 /home/sho/bots% tree -L 1
.
|-- dangkang_bot
|-- narupeko_bot
|-- penguinana_bot
|-- post.rb
|-- refollow-refav.rb
|-- shingoy_bot
|-- store-make3gram.rb
`-- yusukebe_bot

収集用
store-make3gram.rb

#!/usr/bin/env ruby

path = File.dirname(__FILE__)

bots = Array.new
Dir.entries(path).each{|e|
  bots.push(e) if File::ftype("#{path}/#{e}") == "directory" && !(e =~ /\.+/)
}

bots.each{|name|
  puts 'store-make3gram:'+name
  puts `ruby #{path}/#{name}/store.rb 3`
  puts `ruby #{path}/#{name}/make3gram.rb`
}

follow返し
refollow-refav.rb

#!/usr/bin/env ruby

path = File.dirname(__FILE__)

bots = Array.new
Dir.entries(path).each{|e|
  bots.push(e) if File::ftype("#{path}/#{e}") == "directory" && !(e =~ /\.+/)
}

bots.each{|name|
  puts 'refollow-refav:'+name
  puts `ruby #{path}/#{name}/refollow.rb`
  puts `ruby #{path}/#{name}/refav.rb 2`
}

ランダム投稿
post.rb

#!/usr/bin/env ruby

path = File.dirname(__FILE__)

bots = Array.new
Dir.entries(path).each{|e|
  bots.push(e) if File::ftype("#{path}/#{e}") == "directory" && !(e =~ /\.+/)
}

name = bots[rand(bots.size)]

puts 'post3gram:'+name
puts `ruby #{path}/#{name}/post3gram.rb`