Permalink
Browse files

upgrade to latest version of Serve; test out syntax highlighting with…

… pygments
  • Loading branch information...
1 parent 6f9a8b2 commit 66f82de6d1f363812152368d8ed84a1bdf4cbb0b @jlong committed Jul 24, 2011
View
@@ -7,13 +7,14 @@ tmtags
## EMACS
*~
-#*
-.#*
+\#*
+.\#*
## VIM
*.swp
## PROJECT::GENERAL
+.sass-cache
coverage
rdoc
pkg
@@ -22,4 +23,3 @@ pkg
*.gem
.rvmrc
.bundle
-.sass-cache
View
@@ -1,5 +1,28 @@
-source "http://rubygems.org"
+source :rubygems
-gem 'serve', '~> 1.0.0'
-gem 'haml', '~> 3.0.23'
-gem 'compass', '~> 0.10.6'
+gem 'serve', '1.5.1'
+
+# Use edge instead:
+# gem 'serve', :git => 'git://github.com/jlong/serve.git'
+
+# Use Compass and Sass
+gem 'compass'
+
+gem 'rack-codehighlighter'
+
+# 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'
View
@@ -1,23 +1,36 @@
GEM
remote: http://rubygems.org/
specs:
- activesupport (3.0.5)
- compass (0.10.6)
- haml (>= 3.0.4)
- haml (3.0.25)
- i18n (0.4.2)
- rack (1.2.2)
- serve (1.0.0)
- activesupport (~> 3.0.1)
- i18n (~> 0.4.1)
- rack (~> 1.2.1)
- tzinfo (~> 0.3.23)
- tzinfo (0.3.25)
+ activesupport (3.0.9)
+ chunky_png (1.2.0)
+ compass (0.11.5)
+ chunky_png (~> 1.2)
+ fssm (>= 0.2.7)
+ sass (~> 3.1)
+ fssm (0.2.7)
+ i18n (0.6.0)
+ nokogiri (1.5.0)
+ rack (1.3.1)
+ rack-codehighlighter (0.4.7)
+ nokogiri (>= 1.4.1)
+ rack (>= 1.0.0)
+ rack-test (0.6.0)
+ rack (>= 1.0)
+ sass (3.1.4)
+ serve (1.5.1)
+ activesupport (~> 3.0)
+ i18n
+ rack (~> 1.2)
+ rack-test (~> 0.5)
+ tilt (~> 1.3)
+ tzinfo
+ tilt (1.3.2)
+ tzinfo (0.3.29)
PLATFORMS
ruby
DEPENDENCIES
- compass (~> 0.10.6)
- haml (~> 3.0.23)
- serve (~> 1.0.0)
+ compass
+ rack-codehighlighter
+ serve (= 1.5.1)
View
@@ -1,20 +0,0 @@
-Copyright (c) 2011 John W. Long
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
@@ -1,46 +0,0 @@
-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 a rapid prototyping framework for Rails applications.
-It is designed to compliment Rails development and enforce a strict separation
-of concerns between designer and developer. Using Serve with Rails allows the
-designer to happily work in his own space creating an HTML prototype of the
-application, while the developer works on the Rails application and copies
-over HTML from the prototype as needed. This allows the designer to focus on
-presentation and flow while the developer can focus on the implementation.
-
-
-How do I install and run Serve?
--------------------------------
-
-Serve is distributed as a gem to make it easy to get up and running. To
-install, type the following at the command prompt:
-
- 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>
-
-Click around. You will find that Serve enables you to prototype most
-functionality without writing a single line of backend code.
-
-
-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 rack it up with the
-`rackup` command. For more information about using Serve and Passenger see:
-
-<http://bit.ly/serve-and-passenger>
View
@@ -0,0 +1,87 @@
+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 this project to pure HTML and CSS you will need the prerelease
+version of Serve. To get started with the prerelease version:
+
+ gem install --pre serve
+
+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>
View
@@ -9,7 +9,7 @@ http_images_path = '/images'
http_javascripts_path = '/javascripts'
# File system locations
-sass_dir = 'sass'
+sass_dir = 'stylesheets'
css_dir = 'public/stylesheets'
images_dir = 'public/images'
javascripts_dir = 'public/javascripts'
View
@@ -1,32 +1,49 @@
#\ -p 4000
-gem 'activesupport'
-gem 'serve'
+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__)
-# Common Rack Middleware
-use Rack::ShowStatus # Nice looking 404s and other messages
-use Rack::ShowExceptions # Nice looking errors
-
-if ENV['RACK_ENV'] == "production"
- # Use Rack::Static with Heroku
- use Rack::Static, :urls => ["/images", "/javascripts", "/stylesheets"], :root => "public"
- run Serve::RackAdapter.new(root + '/views')
-else
- # Compile Sass on the fly
+# 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
- # Use Rack::Cascade and Rack::Directory to handle
- # files in public directory gracefully
+ use Sass::Plugin::Rack # Sass Middleware
+end
+
+# Syntax highlighting with Codehiglighter
+require 'rack/codehighlighter'
+use Rack::Codehighlighter, :pygments_api, :element => "pre", :pattern => /\A:::(\w+)\s*\n/, :logging => false
+
+# 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
+ # Passendger 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')
View
@@ -0,0 +1 @@
+Options +MultiViews
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.

0 comments on commit 66f82de

Please sign in to comment.