Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 53 lines (46 sloc) 1.15 kB
585c4ae @icco Meh.
authored
1 #!/usr/bin/env ruby
564fcb4 @icco Switching from 3 space indenting to 2. Sorry this will be a bitch to …
authored
2 #
36929ab @icco Turing this into a sinatra app
authored
3 # An app for displaying one's resume
564fcb4 @icco Switching from 3 space indenting to 2. Sorry this will be a bitch to …
authored
4 # @author Nat Welch - https://github.com/icco/resume
36929ab @icco Turing this into a sinatra app
authored
5
8fb054c @icco Nice fail errors for gems
authored
6 begin
564fcb4 @icco Switching from 3 space indenting to 2. Sorry this will be a bitch to …
authored
7 require "rubygems"
8fb054c @icco Nice fail errors for gems
authored
8 rescue LoadError
564fcb4 @icco Switching from 3 space indenting to 2. Sorry this will be a bitch to …
authored
9 puts "Please install Ruby Gems to continue."
10 exit
8fb054c @icco Nice fail errors for gems
authored
11 end
12
13 # Check all of the gems we need are there.
099cbc0 @icco Cleaning up documentation a little.
authored
14 [ "sinatra", "less", "github/markup", "yaml" ].each {|gem|
564fcb4 @icco Switching from 3 space indenting to 2. Sorry this will be a bitch to …
authored
15 begin
16 require gem
17 rescue LoadError
18 puts "The gem #{gem} is not installed.\n"
19 exit
20 end
8fb054c @icco Nice fail errors for gems
authored
21 }
22
099cbc0 @icco Cleaning up documentation a little.
authored
23 # Include our configurations from config.yaml
69c8d3c @icco Redid how the app worked so it was more 'abstract'
authored
24 configure do
564fcb4 @icco Switching from 3 space indenting to 2. Sorry this will be a bitch to …
authored
25 set :config, YAML.load_file('config.yaml')['user_config']
69c8d3c @icco Redid how the app worked so it was more 'abstract'
authored
26 end
27
099cbc0 @icco Cleaning up documentation a little.
authored
28 # Render the main page.
dc056d7 @icco Whoopsee.
authored
29 get '/index.html' do
564fcb4 @icco Switching from 3 space indenting to 2. Sorry this will be a bitch to …
authored
30 rfile = settings.config['file']
31 name = settings.config['name']
32 title = "#{name}'s Resume"
33 resume = GitHub::Markup.render(rfile, File.read(rfile))
34 erb :index, :locals => {
35 :title => title,
36 :resume => resume,
37 :author => name,
38 :key => settings.config['gkey'],
39 :filename => rfile
40 }
36929ab @icco Turing this into a sinatra app
authored
41 end
42
099cbc0 @icco Cleaning up documentation a little.
authored
43 # We do this for our static site rendering.
dc056d7 @icco Whoopsee.
authored
44 get '/' do
564fcb4 @icco Switching from 3 space indenting to 2. Sorry this will be a bitch to …
authored
45 redirect '/index.html'
dc056d7 @icco Whoopsee.
authored
46 end
47
099cbc0 @icco Cleaning up documentation a little.
authored
48 # For the plain text version of our resumes
ccaa6da @icco Add plain text download.
authored
49 get '/resume.txt' do
564fcb4 @icco Switching from 3 space indenting to 2. Sorry this will be a bitch to …
authored
50 content_type 'text/plain', :charset => 'utf-8'
51 File.read(settings.config['file'])
ccaa6da @icco Add plain text download.
authored
52 end
Something went wrong with that request. Please try again.