serve 0.9.7 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +9 -0
- data/Manifest.txt +6 -0
- data/Quickstart.textile +4 -4
- data/README.txt +18 -2
- data/bin/serve +0 -0
- data/lib/serve/handlers/dynamic_handler.rb +11 -4
- data/lib/serve/version.rb +1 -1
- data/lib/serve/webrick/extensions.rb +0 -0
- data/script/destroy +0 -0
- data/script/generate +0 -0
- data/script/txt2html +0 -0
- data/test_project/_layout.haml +7 -0
- data/test_project/erb/_layout.html.erb +10 -0
- data/test_project/erb/index.html.erb +5 -0
- data/test_project/test.haml +3 -0
- data/test_project/test.html.erb +3 -0
- data/test_project/view_helpers.rb +5 -0
- metadata +20 -5
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== 0.9.8 (July 18, 2008)
|
2
|
+
|
3
|
+
* Added experimental support for ERB layouts. [Lawjoskar]
|
4
|
+
|
5
|
+
== 0.9.7 (July 17, 2008)
|
6
|
+
|
7
|
+
* Added experimental support for view helpers. [aiwilliams]
|
8
|
+
* Added limited support for ERB. Layouts are not yet supported. [jlong]
|
9
|
+
|
1
10
|
== 0.9.6 (February 20, 2008)
|
2
11
|
|
3
12
|
* Changed default port to 4000 so that serve plays nicely with Rails apps.
|
data/Manifest.txt
CHANGED
@@ -32,3 +32,9 @@ tasks/environment.rake
|
|
32
32
|
tasks/rspec.rake
|
33
33
|
tasks/undefine.rake
|
34
34
|
tasks/website.rake
|
35
|
+
test_project/_layout.haml
|
36
|
+
test_project/erb/_layout.html.erb
|
37
|
+
test_project/erb/index.html.erb
|
38
|
+
test_project/test.haml
|
39
|
+
test_project/test.html.erb
|
40
|
+
test_project/view_helpers.rb
|
data/Quickstart.textile
CHANGED
@@ -50,7 +50,7 @@ h3. Creating Our First Screen
|
|
50
50
|
|
51
51
|
Now that we have the prototype directory set up, let's create our first page so that you can get a feel for how Serve works. This will be a simple HTML login page for our application.
|
52
52
|
|
53
|
-
Insert the following HTML into an file named "login.html":
|
53
|
+
Insert the following HTML into an file named "login.html.erb":
|
54
54
|
|
55
55
|
<pre><code>
|
56
56
|
<form action="/dashboard/" method="put">
|
@@ -96,7 +96,7 @@ Name Last modified Size
|
|
96
96
|
Parent Directory 2008/02/23 15:35 -
|
97
97
|
images/ 2008/02/23 15:35 -
|
98
98
|
javascripts/ 2008/02/23 15:35 -
|
99
|
-
login.html
|
99
|
+
login.html.erb 2008/02/23 15:36 346
|
100
100
|
stylesheets/ 2008/02/23 15:35 -
|
101
101
|
</pre>
|
102
102
|
|
@@ -111,7 +111,7 @@ h3. Layouts
|
|
111
111
|
|
112
112
|
One thing to note about the source that I gave you for the login page. I intentionally left out the <html>, <head>, and <body> tags because they belong a layout---not the source file. Let's go ahead and create that layout now.
|
113
113
|
|
114
|
-
Insert the following HTML into a file named "_layout.html" in the root directory of your prototype:
|
114
|
+
Insert the following HTML into a file named "_layout.html.erb" in the root directory of your prototype:
|
115
115
|
|
116
116
|
<pre><code>
|
117
117
|
<html>
|
@@ -129,7 +129,7 @@ This layout includes a small amount of ERB(Embedded Ruby) to indicate the title
|
|
129
129
|
|
130
130
|
Embedded Ruby is delineated with the opening and closing sequence <% and %> respectively. Sequences that begin with an addition equals sign insert their output directly into the HTML. In this case we want to render the @title variable as the title in the head and as the first heading in the document body. The yield keyword is used to insert the content of the page at that point.
|
131
131
|
|
132
|
-
We need to make one small change to our login page before continuing. Insert the following line at the top of login.html file:
|
132
|
+
We need to make one small change to our login page before continuing. Insert the following line at the top of login.html.erb file:
|
133
133
|
|
134
134
|
<pre>
|
135
135
|
<% @title = "Login" %>
|
data/README.txt
CHANGED
@@ -52,12 +52,24 @@ Serve presently does special processing for files with following extensions:
|
|
52
52
|
|
53
53
|
textile :: Evaluates the document as Textile (requires the Redcloth gem)
|
54
54
|
markdown :: Evaluates the document as Markdown (requires the Bluecloth gem)
|
55
|
+
erb :: Experimental support for ERB is partial implemented
|
55
56
|
haml :: Evaluates the document as Haml (requires the Haml gem)
|
56
57
|
sass :: Evaluates the document as Sass (requires the Haml gem)
|
57
|
-
email :: Evaluates the document as if it is an e-mail message; the format is
|
58
|
+
email :: Evaluates the document as if it is an e-mail message; the format is identical to a plain/text e-mail message's source
|
58
59
|
redirect :: Redirects to the URL contained in the document
|
59
60
|
|
60
61
|
|
62
|
+
== View Helpers
|
63
|
+
|
64
|
+
If you drop a file called view_helpers.rb in the root of a project, you can define custom helpers for your Haml and ERB views. Just declare the ViewHelpers module and begin declaring your helpers:
|
65
|
+
|
66
|
+
module ViewHelpers
|
67
|
+
def custom_method
|
68
|
+
"Request object: #{request.headers['user-agent']}"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
|
61
73
|
=== Installation and Setup
|
62
74
|
|
63
75
|
It is recommended that you install serve via RubyGems:
|
@@ -76,10 +88,14 @@ Or visit the project page here:
|
|
76
88
|
|
77
89
|
* http://rubyforge.org/projects/serve
|
78
90
|
|
91
|
+
All development now takes place on GitHub:
|
92
|
+
|
93
|
+
* http://github.com/jlong/serve
|
94
|
+
|
79
95
|
|
80
96
|
=== License
|
81
97
|
|
82
|
-
Serve is released under the MIT license and is copyright (c) 2006-
|
98
|
+
Serve is released under the MIT license and is copyright (c) 2006-2008
|
83
99
|
John W. Long. A copy of the MIT license can be found in the License.txt file.
|
84
100
|
|
85
101
|
|
data/bin/serve
CHANGED
File without changes
|
@@ -33,11 +33,18 @@ module Serve #:nodoc:
|
|
33
33
|
root = Dir.pwd
|
34
34
|
path = filename[root.size..-1]
|
35
35
|
layout = nil
|
36
|
-
|
36
|
+
|
37
|
+
until layout or path == "/"
|
37
38
|
path = File.dirname(path)
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
|
40
|
+
possible_layouts = ['_layout.haml', '_layout.html.erb'].map do |l|
|
41
|
+
possible_layout = File.join(root, path, l)
|
42
|
+
File.file?(possible_layout) ? possible_layout : false
|
43
|
+
end
|
44
|
+
|
45
|
+
layout = possible_layouts.detect {|o| o }
|
46
|
+
end
|
47
|
+
|
41
48
|
layout
|
42
49
|
end
|
43
50
|
|
data/lib/serve/version.rb
CHANGED
File without changes
|
data/script/destroy
CHANGED
File without changes
|
data/script/generate
CHANGED
File without changes
|
data/script/txt2html
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serve
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John W. Long
|
@@ -30,10 +30,19 @@ cert_chain:
|
|
30
30
|
qXI=
|
31
31
|
-----END CERTIFICATE-----
|
32
32
|
|
33
|
-
date: 2008-07-
|
33
|
+
date: 2008-07-18 00:00:00 -04:00
|
34
34
|
default_executable:
|
35
|
-
dependencies:
|
36
|
-
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: hoe
|
38
|
+
type: :development
|
39
|
+
version_requirement:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 1.7.0
|
45
|
+
version:
|
37
46
|
description: Serve is a small Ruby script that makes it easy to start up a WEBrick server in any directory. Serve is ideal for HTML prototyping and simple file sharing. If the haml, redcloth, and bluecloth gems are installed serve can handle Haml, Sass, Textile, and Markdown (in addition to HTML).
|
38
47
|
email: me@johnwlong.com
|
39
48
|
executables:
|
@@ -80,6 +89,12 @@ files:
|
|
80
89
|
- tasks/rspec.rake
|
81
90
|
- tasks/undefine.rake
|
82
91
|
- tasks/website.rake
|
92
|
+
- test_project/_layout.haml
|
93
|
+
- test_project/erb/_layout.html.erb
|
94
|
+
- test_project/erb/index.html.erb
|
95
|
+
- test_project/test.haml
|
96
|
+
- test_project/test.html.erb
|
97
|
+
- test_project/view_helpers.rb
|
83
98
|
has_rdoc: true
|
84
99
|
homepage: http://serve.rubyforge.org
|
85
100
|
post_install_message:
|
@@ -103,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
118
|
requirements: []
|
104
119
|
|
105
120
|
rubyforge_project: serve
|
106
|
-
rubygems_version: 1.0
|
121
|
+
rubygems_version: 1.2.0
|
107
122
|
signing_key:
|
108
123
|
specification_version: 2
|
109
124
|
summary: Serve is a small Ruby script that makes it easy to start up a WEBrick server in any directory. Serve is ideal for HTML prototyping and simple file sharing. If the haml, redcloth, and bluecloth gems are installed serve can handle Haml, Sass, Textile, and Markdown (in addition to HTML).
|
metadata.gz.sig
CHANGED
Binary file
|