Skip to content
This repository was archived by the owner on Nov 16, 2018. It is now read-only.

Commit ff69cc5

Browse files
committed
initial import from rails to sinatra
0 parents  commit ff69cc5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+4777
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
local.db
2+
.bundle

Gemfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
source "http://rubygems.org"
2+
3+
gem "sinatra"
4+
gem "dm-core"
5+
gem "dm-serializer"
6+
gem "dm-migrations"
7+
gem "dm-validations"
8+
gem "dm-timestamps"
9+
10+
group :production do
11+
gem "pg"
12+
gem "dm-postgres-adapter"
13+
end
14+
15+
group :development do
16+
gem "sqlite3-ruby"
17+
gem "dm-sqlite-adapter"
18+
gem "shotgun"
19+
end
20+

Gemfile.lock

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
GEM
2+
remote: http://rubygems.org/
3+
specs:
4+
addressable (2.2.6)
5+
data_objects (0.10.6)
6+
addressable (~> 2.1)
7+
dm-core (1.1.0)
8+
addressable (~> 2.2.4)
9+
dm-do-adapter (1.1.0)
10+
data_objects (~> 0.10.2)
11+
dm-core (~> 1.1.0)
12+
dm-migrations (1.1.0)
13+
dm-core (~> 1.1.0)
14+
dm-postgres-adapter (1.1.0)
15+
dm-do-adapter (~> 1.1.0)
16+
do_postgres (~> 0.10.2)
17+
dm-serializer (1.1.0)
18+
dm-core (~> 1.1.0)
19+
fastercsv (~> 1.5.4)
20+
json (~> 1.4.6)
21+
dm-sqlite-adapter (1.1.0)
22+
dm-do-adapter (~> 1.1.0)
23+
do_sqlite3 (~> 0.10.2)
24+
dm-timestamps (1.1.0)
25+
dm-core (~> 1.1.0)
26+
dm-validations (1.1.0)
27+
dm-core (~> 1.1.0)
28+
do_postgres (0.10.6)
29+
data_objects (= 0.10.6)
30+
do_sqlite3 (0.10.6)
31+
data_objects (= 0.10.6)
32+
fastercsv (1.5.4)
33+
json (1.4.6)
34+
pg (0.11.0)
35+
rack (1.3.3)
36+
shotgun (0.9)
37+
rack (>= 1.0)
38+
sinatra (1.2.6)
39+
rack (~> 1.1)
40+
tilt (>= 1.2.2, < 2.0)
41+
sqlite3 (1.3.4)
42+
sqlite3-ruby (1.3.3)
43+
sqlite3 (>= 1.3.3)
44+
tilt (1.3.3)
45+
46+
PLATFORMS
47+
ruby
48+
49+
DEPENDENCIES
50+
dm-core
51+
dm-migrations
52+
dm-postgres-adapter
53+
dm-serializer
54+
dm-sqlite-adapter
55+
dm-timestamps
56+
dm-validations
57+
pg
58+
shotgun
59+
sinatra
60+
sqlite3-ruby

app.rb

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
require 'sinatra'
2+
3+
require 'dm-core'
4+
require 'dm-serializer/to_json'
5+
require 'dm-migrations'
6+
require 'dm-validations'
7+
require 'dm-timestamps'
8+
9+
## -- DATABASE STUFF --
10+
11+
DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/local.db")
12+
13+
class Version
14+
include DataMapper::Resource
15+
property :version, String
16+
property :current, Boolean, :key => true
17+
property :created_at, DateTime
18+
end
19+
20+
DataMapper.auto_upgrade!
21+
22+
class GitApp < Sinatra::Base
23+
24+
def get_version
25+
@version = '1.7.6.1'
26+
@date = "2011-08-24"
27+
end
28+
29+
get '/' do
30+
get_version
31+
erb :index
32+
end
33+
34+
get '/course/:action' do
35+
@action = params[:action]
36+
@action.gsub!('.html', '')
37+
erb :"#{@action}", :layout => :course
38+
end
39+
40+
get '/:action' do
41+
@action = params[:action]
42+
get_version if @action == 'download'
43+
erb :"#{@action}"
44+
end
45+
46+
end

config.ru

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
require "rubygems"
2+
require "bundler"
3+
Bundler.setup
4+
5+
Bundler.require(:runtime)
6+
7+
require './app'
8+
9+
use Rack::Static, :urls => ["/css", "/images", "/js"], :root => "public"
10+
11+
run GitApp
12+

public/404.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3+
4+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5+
6+
<head>
7+
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
8+
<title>The page you were looking for doesn't exist (404)</title>
9+
<style type="text/css">
10+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
11+
div.dialog {
12+
width: 25em;
13+
padding: 0 4em;
14+
margin: 4em auto 0 auto;
15+
border: 1px solid #ccc;
16+
border-right-color: #999;
17+
border-bottom-color: #999;
18+
}
19+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
20+
</style>
21+
</head>
22+
23+
<body>
24+
<!-- This file lives in public/404.html -->
25+
<div class="dialog">
26+
<h1>The page you were looking for doesn't exist.</h1>
27+
<p>You may have mistyped the address or the page may have moved.</p>
28+
</div>
29+
</body>
30+
</html>

public/422.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3+
4+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5+
6+
<head>
7+
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
8+
<title>The change you wanted was rejected (422)</title>
9+
<style type="text/css">
10+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
11+
div.dialog {
12+
width: 25em;
13+
padding: 0 4em;
14+
margin: 4em auto 0 auto;
15+
border: 1px solid #ccc;
16+
border-right-color: #999;
17+
border-bottom-color: #999;
18+
}
19+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
20+
</style>
21+
</head>
22+
23+
<body>
24+
<!-- This file lives in public/422.html -->
25+
<div class="dialog">
26+
<h1>The change you wanted was rejected.</h1>
27+
<p>Maybe you tried to change something you didn't have access to.</p>
28+
</div>
29+
</body>
30+
</html>

public/500.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3+
4+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5+
6+
<head>
7+
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
8+
<title>We're sorry, but something went wrong (500)</title>
9+
<style type="text/css">
10+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
11+
div.dialog {
12+
width: 25em;
13+
padding: 0 4em;
14+
margin: 4em auto 0 auto;
15+
border: 1px solid #ccc;
16+
border-right-color: #999;
17+
border-bottom-color: #999;
18+
}
19+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
20+
</style>
21+
</head>
22+
23+
<body>
24+
<!-- This file lives in public/500.html -->
25+
<div class="dialog">
26+
<h1>We're sorry, but something went wrong.</h1>
27+
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
28+
</div>
29+
</body>
30+
</html>

public/blueprint/ie.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* -----------------------------------------------------------------------
2+
3+
Blueprint CSS Framework 0.7.1
4+
http://blueprintcss.googlecode.com
5+
6+
* Copyright (c) 2007-2008. See LICENSE for more info.
7+
* See README for instructions on how to use Blueprint.
8+
* For credits and origins, see AUTHORS.
9+
* This is a compressed file. See the sources in the 'src' directory.
10+
11+
----------------------------------------------------------------------- */
12+
13+
/* ie.css */
14+
body {text-align:center;}
15+
.container {text-align:left;}
16+
* html .column {overflow-x:hidden;}
17+
* html legend {margin:-18px -8px 16px 0;padding:0;}
18+
ol {margin-left:2em;}
19+
sup {vertical-align:text-top;}
20+
sub {vertical-align:text-bottom;}
21+
html>body p code {*white-space:normal;}
22+
hr {margin:-8px auto 11px;}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Fancy Type
2+
3+
* Gives you classes to use if you'd like some
4+
extra fancy typography.
5+
6+
Credits and instructions are specified above each class
7+
in the fancy-type.css file in this directory.
8+
9+
10+
Usage
11+
----------------------------------------------------------------
12+
13+
1) Add this plugin to lib/settings.yml.
14+
See compress.rb for instructions.

0 commit comments

Comments
 (0)