Skip to content

Commit

Permalink
basic demo
Browse files Browse the repository at this point in the history
  • Loading branch information
jlong committed Sep 13, 2011
0 parents commit 8127387
Show file tree
Hide file tree
Showing 25 changed files with 919 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .gitignore
@@ -0,0 +1,25 @@
## MAC OS
.DS_Store

## TEXTMATE
*.tmproj
tmtags

## EMACS
*~
\#*
.\#*

## VIM
*.swp

## PROJECT::GENERAL
.sass-cache
coverage
rdoc
pkg

## PROJECT::SPECIFIC
*.gem
.rvmrc
.bundle
26 changes: 26 additions & 0 deletions Gemfile
@@ -0,0 +1,26 @@
source :rubygems

gem 'serve', '1.5.1'

# Use edge instead:
# gem 'serve', :git => 'git://github.com/jlong/serve.git'

# Use Compass and Sass
gem 'compass'

# Markdown and Textile
# gem 'rdiscount' # Markdown
# gem 'RedCloth' # Textile

# Other templating languages
# gem 'erubis'
# gem 'haml'
# gem 'slim'
# gem 'radius'
# gem 'less'

# Coffee Script
gem 'coffee-script'

# Use mongrel for the Web server
# gem 'mongrel'
40 changes: 40 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,40 @@
GEM
remote: http://rubygems.org/
specs:
activesupport (3.1.0)
multi_json (~> 1.0)
chunky_png (1.2.1)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.1.2)
compass (0.11.5)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
execjs (1.2.6)
multi_json (~> 1.0)
fssm (0.2.7)
i18n (0.6.0)
multi_json (1.0.3)
rack (1.3.2)
rack-test (0.6.1)
rack (>= 1.0)
sass (3.1.7)
serve (1.5.1)
activesupport (~> 3.0)
i18n
rack (~> 1.2)
rack-test (~> 0.5)
tilt (~> 1.3)
tzinfo
tilt (1.3.3)
tzinfo (0.3.29)

PLATFORMS
ruby

DEPENDENCIES
coffee-script
compass
serve (= 1.5.1)
82 changes: 82 additions & 0 deletions README.md
@@ -0,0 +1,82 @@
What is this?
=============

This is a simple HTML prototype written in HAML or ERB that is designed to be
viewed with Serve.

What is Serve? Serve is an open-source rapid prototyping framework for Web
applications. It makes it easy to prototype functionality without writing a
single line of backend code.


How do I install and run Serve?
-------------------------------

Serve is distributed as a Ruby gem to make it easy to get up and running. You
must have Ruby installed in order to download and use Serve. The Ruby download
page provides instructions for getting Ruby setup on different platforms:

<http://www.ruby-lang.org/en/downloads/>

After you have Ruby installed, open up the command prompt and type:

gem install serve

(OSX and Unix users may need to prefix the command with `sudo`.)

After Serve is installed, you can start it up in a given directory like this:

serve

This will start Serve on port 4000. You can now view the prototype in your
Web browser at this URL:

<http://localhost:4000>


Compass and Sass
----------------

This prototype uses Compass and Sass to generate CSS. Both are distributed as
Ruby gems and can be easily installed from the command prompt. Since the
Compass gem depends on Sass, you can install them both with one command:

gem install compass

Learn more about Sass:

<http://sass-lang.org>

Learn more about Compass:

<http://compass-style.org>


Rack and Passenger
------------------

Astute users may notice that this project is also a simple Rack application.
This means that it is easy to deploy it on Passenger or in any other
Rack-friendly environment. Rack it up with the `rackup` command. For more
information about using Serve and Passenger see:

<http://bit.ly/serve-and-passenger>


Exporting
---------

To export your project, use the new "export" command:

serve export project output

Where "project" is the path to the project and "output" is the path to the
directory where you would like your HTML and CSS generated.


Learning More
-------------

You can learn more about Serve on the GitHub project page:

<http://github.com/jlong/serve>
28 changes: 28 additions & 0 deletions compass.config
@@ -0,0 +1,28 @@
#
# Compass Configuration
#

# HTTP paths
http_path = '/'
http_stylesheets_path = '/stylesheets'
http_images_path = '/images'
http_javascripts_path = '/javascripts'

# File system locations
sass_dir = 'stylesheets'
css_dir = 'public/stylesheets'
images_dir = 'public/images'
javascripts_dir = 'public/javascripts'

# Set to true for easier debugging
line_comments = false

# CSS output style - :nested, :expanded, :compact, or :compressed
output_style = :expanded

# Determine whether Compass asset helper functions generate relative
# or absolute paths
relative_assets = true

# Learn more:
# http://compass-style.org/docs/tutorials/configuration-reference/
47 changes: 47 additions & 0 deletions config.ru
@@ -0,0 +1,47 @@
#\ -p 4000

require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end

require 'serve'
require 'serve/rack'

# The project root directory
root = ::File.dirname(__FILE__)

# Compile Sass on the fly with the Sass plugin. Some production environments
# don't allow you to write to the file system on the fly (like Heroku).
# Remove this conditional if you want to compile Sass in production.
if ENV['RACK_ENV'] != 'production'
require 'sass'
require 'sass/plugin/rack'
require 'compass'

Compass.add_project_configuration(root + '/compass.config')
Compass.configure_sass_plugin!

use Sass::Plugin::Rack # Sass Middleware
end

# Other Rack Middleware
use Rack::ShowStatus # Nice looking 404s and other messages
use Rack::ShowExceptions # Nice looking errors

# Rack Application
if ENV['SERVER_SOFTWARE'] =~ /passenger/i
# Passenger only needs the adapter
run Serve::RackAdapter.new(root + '/views')
else
# Use Rack::Cascade and Rack::Directory on other platforms for static assets
run Rack::Cascade.new([
Serve::RackAdapter.new(root + '/views'),
Rack::Directory.new(root + '/public')
])
end
1 change: 1 addition & 0 deletions public/.htaccess
@@ -0,0 +1 @@
Options +MultiViews
Binary file added public/images/serve-logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8127387

Please sign in to comment.