-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Oren Golan
committed
Mar 24, 2011
1 parent
9a5ff1e
commit 65610d9
Showing
15 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
remove config from git and update wiki | ||
db - change :value to :content | ||
|
||
window.owenFunctions.foo = function(){} | ||
window['owenVars'] = { test: 'string' } | ||
|
||
|
||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'sinatra' | ||
require_relative 'routes/init' | ||
require_relative 'helpers/init' | ||
require_relative 'models/init' | ||
|
||
class MyApp < Sinatra::Base | ||
configure :development do | ||
end | ||
|
||
configure :qa do | ||
end | ||
|
||
configure :production do | ||
end | ||
|
||
end | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require File.join(File.dirname(__FILE__), 'app.rb') | ||
run MyApp.new | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
def clear; '<div class="clear"><!-- --></div>' end | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
def update_session | ||
session[:path] = params['project'] | ||
|
||
comma = params['project'] =~ /,/ | ||
if comma | ||
session[:project] = params['project'].slice(0,comma) | ||
else | ||
session[:project] = params['project'] | ||
end | ||
end | ||
|
||
# return string of kerberos user or false | ||
def authenticate | ||
if ENV['RACK_ENV'] == 'development' or ENV['RACK_ENV'] == 'qa' | ||
return settings.user | ||
end | ||
|
||
user = request.env["HTTP_AUTHORIZATION"] | ||
|
||
if user | ||
user = Base64.decode64(user[6,user.length-6])[/\w+/] | ||
return user | ||
end | ||
|
||
return false | ||
end | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require_relative 'helper1' |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require_relative 'user' | ||
require_relative 'admin' |
Empty file.
Empty file.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class MyApp < Sinatra::Base | ||
|
||
get '/admin' do | ||
erb :admin | ||
end | ||
|
||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
require_relative 'admin' | ||
require_relative 'user' | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class MyApp < Sinatra::Base | ||
|
||
get '/' do | ||
erb :index | ||
end | ||
|
||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<h2>This is a neat Sinatra template!</h2> | ||
|
||
<pre> | ||
app.rb # require sinatra, haml, vendor'd gems, models/init, routes/init, helpers/init | ||
helpers/ | ||
init.rb # Requires each helper file | ||
helper1.rb # Related helper methods | ||
|
||
models/ | ||
init.rb # Require sequel, set up the DB; require each model, in controlled order | ||
foo.rb # One or more Sequel models | ||
bar.rb # One or more related models | ||
|
||
routes/ | ||
init.rb # Require each route, in controlled order | ||
admin.rb # One or more routes related to administration | ||
foo.rb # One or more routes related to some feature | ||
|
||
views/ | ||
layout.haml # Common layout | ||
foo.haml # Specific view | ||
bar.haml # Specific view | ||
|
||
|
||
Install | ||
------- | ||
git clone git@github.com:oren/sinatra-template.git | ||
rvm install ruby-1.9.2-p136 | ||
cd sinatra-template | ||
rvm gemset import | ||
|
||
Run | ||
--- | ||
shotgun | ||
|
||
Enjoy | ||
----- | ||
http://127.0.0.1:9393 | ||
</pre> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<html> | ||
<head> | ||
|
||
<link href="/css/main.css" rel='stylesheet'> | ||
|
||
<title>Sinatra Template</title> | ||
</head> | ||
|
||
<body> | ||
|
||
<div id='container'> | ||
<%= yield %> | ||
</div> | ||
|
||
</body> | ||
</html> | ||
|
||
|
Shouldn't these helpers be in a module (or at least a helpers do ... end block) so they're properly scoped to give access to the session, etc?