Skip to content

Commit

Permalink
Web application skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarobp committed Jul 24, 2013
1 parent bc86263 commit 99ac99d
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 2 deletions.
8 changes: 7 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ source 'https://rubygems.org'

gem 'rebay'

# Web
gem 'compass', '~> 0.12.2'
gem 'sinatra', '~> 1.4.3'
gem 'haml', '~> 4.0.3'
gem 'zurb-foundation', '~> 4.3.1'

group :test do
gem 'rspec'
gem 'rspec', '~> 2.14.1'
end
25 changes: 24 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
GEM
remote: https://rubygems.org/
specs:
chunky_png (1.2.8)
compass (0.12.2)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
diff-lcs (1.2.4)
fssm (0.2.10)
haml (4.0.3)
tilt
json (1.8.0)
rack (1.5.2)
rack-protection (1.5.0)
rack
rebay (1.2.0)
json
rspec (2.14.1)
Expand All @@ -13,10 +24,22 @@ GEM
rspec-expectations (2.14.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.1)
sass (3.2.9)
sinatra (1.4.3)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
tilt (1.4.1)
zurb-foundation (4.3.1)
sass (>= 3.2.0)

PLATFORMS
ruby

DEPENDENCIES
compass (~> 0.12.2)
haml (~> 4.0.3)
rebay
rspec
rspec (~> 2.14.1)
sinatra (~> 1.4.3)
zurb-foundation (~> 4.3.1)
4 changes: 4 additions & 0 deletions config.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require File.dirname(__FILE__) + '/config/boot'
require File.dirname(__FILE__) + '/web'

run Web::Application
3 changes: 3 additions & 0 deletions config/boot.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$: << File.dirname(__FILE__) + '/../lib'

require 'discovery'
9 changes: 9 additions & 0 deletions web.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$: << File.dirname(__FILE__)

module Web
def self.root
File.join(File.dirname(__FILE__), 'web')
end
end

require 'web/application'
26 changes: 26 additions & 0 deletions web/application.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require 'sinatra'
require 'compass'
require 'haml'
require 'zurb-foundation'

module Web
class Application < Sinatra::Base
configure do
set :root, Web.root
set :views, File.join(root, 'views')
set :public_folder, File.join(root, 'public')
set :haml, { :format => :html5, :escape_html => true }
set :scss, { :style => :compact, :debug_info => false }
Compass.add_project_configuration(File.join(Sinatra::Application.root, "config", "compass.rb"))
end

get '/stylesheets/:name.css' do
content_type 'text/css', :charset => 'utf-8'
scss(:"stylesheets/#{params[:name]}" )
end

get '/' do
haml :index
end
end
end
17 changes: 17 additions & 0 deletions web/config/compass.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
if defined?(Sinatra)
# This is the configuration to use when running within sinatra
project_path = Web::Application.root
environment = :development
else
# this is the configuration to use when running within the compass command line tool.
css_dir = File.join 'public', 'stylesheets'
relative_assets = true
environment = :production
end

# This is common configuration
sass_dir = File.join 'assets', 'stylesheets'
images_dir = File.join 'public', 'images'
http_path = "/"
http_images_path = "/images"
http_stylesheets_path = "/stylesheets"
1 change: 1 addition & 0 deletions web/views/index.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello PDM!

0 comments on commit 99ac99d

Please sign in to comment.