-
-
Save stefanpenner/210690 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'ghost' | |
module Productivity | |
BLOCK_LIST = %W{ facebook.com twitter.com } | |
def start | |
puts "Blocked:" | |
BLOCK_LIST.each do |host| | |
Host.add(host,'127.0.0.1') | |
puts ' - ' + host | |
end | |
end | |
def stop | |
puts "un-blocked:" | |
BLOCK_LIST.each do |host| | |
Host.delete(host) | |
puts ' - ' + host | |
end | |
end | |
end | |
if __FILE__ == $0 | |
include Productivity | |
case ARGV[0] | |
when /^start$/i then start | |
when /^stop$/i then stop | |
else | |
puts "USAGE: ruby b-productive.rb start|stop" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment