Created
December 24, 2009 01:47
-
-
Save dmerrick/262951 to your computer and use it in GitHub Desktop.
This file contains hidden or 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' | |
| require 'sinatra' | |
| require 'haml' | |
| configure do | |
| set :folder_name, 'pictures_of_me' | |
| set :root, File.dirname(__FILE__) | |
| set :public, Proc.new { File.join(root, folder_name) and FileUtils.mkdir_p(folder_name) } | |
| enable :static | |
| end | |
| get '/?*' do | |
| # hacky | |
| camcapture = `source #{ENV['HOME']}/.bash_profile && which camcapture`.chomp | |
| @now = Date.today.strftime | |
| abort "You need camcapture in your $PATH after sourcing ~/.bash_profile" if camcapture.nil? | |
| system "#{camcapture} -t png #{options.root}/#{options.folder_name}/#{@now}" | |
| haml :index | |
| end | |
| __END__ | |
| @@ layout | |
| !!! 1.1 | |
| %html | |
| %head | |
| %title I SEE YOU | |
| %body | |
| = yield | |
| #err.warning= env['sinatra.error'] | |
| #footer | |
| %small © DM | |
| @@ index | |
| %a{:href => '/'} | |
| %img{:src => "/#{@now}.png"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment