JosephPecoraro / scripts

Some scripts I have written and tend to keep up to date. They reside in my personal bin folder.

This URL has Read+Write access

scripts / inflate
100755 37 lines (31 sloc) 0.714 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env ruby
# Date: Saturday May 24, 2008
# Author: Joseph Pecoraro
# Contact: joepeck02@gmail.com
# Original Idea by defunkt - http://balloon.hobix.com/~defunkt
# Decription: Open or run a balloon.
 
require 'open-uri'
usage = <<USAGE
usage: inflate [-o] balloon
options: --open or -o open in browser, do not download
http://balloon.hobix.com/ for details.
USAGE
 
# No args, print usage
if ARGV.empty?
  puts usage
  exit 0
end
 
# State for the switch
open = false
if ARGV.first =~ /^-(-open|o)$/
  open = true
  ARGV.shift
end
 
# Work it!
url = 'http://balloon.hobix.com/'
url += ARGV.shift unless ARGV.empty?
if open
  `open #{url}`
else
  eval(open(url).read) rescue puts "** balloon not found"
end