Created
October 15, 2009 02:23
-
-
Save eladmeidar/210612 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
#!/usr/bin/env ruby | |
require 'rubygems' | |
BLOCK_LIST = ["facebook.com", "twitter.com"] | |
ALLOWED_ACTIONS = ["start", "stop"] | |
begin | |
action = ARGV[0].to_s.downcase | |
if action.nil? || !(ALLOWED_ACTIONS.include?(action.downcase)) | |
puts "USAGE: ruby b-productive.rb start|stop" | |
end | |
gem 'ghost' | |
require 'ghost' | |
case action | |
when "start" | |
BLOCK_LIST.each do |block_target| | |
Host.add(block_target, '127.0.0.1') | |
end | |
puts "Productivity enhanced +10!!!, (Blocked: #{BLOCK_LIST.join(', ')})" | |
when "stop" | |
BLOCK_LIST.each do |block_target| | |
Host.delete(block_target) | |
end | |
puts "Productivity degraded -10, (Now available for distraction: #{BLOCK_LIST.join(', ')})" | |
end | |
rescue Gem::LoadError | |
puts "you need to install the ghost gem from http://github.com/bjeanes/ghost" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment