serve 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +4 -0
- data/QUICKSTART.rdoc +1 -1
- data/README.rdoc +1 -0
- data/VERSION +1 -1
- data/lib/serve/file_resolver.rb +5 -3
- data/lib/serve/handlers/sass_handler.rb +12 -2
- data/spec/serve_spec.rb +1 -1
- metadata +2 -2
data/CHANGELOG.rdoc
CHANGED
data/QUICKSTART.rdoc
CHANGED
@@ -16,7 +16,7 @@ To get started we need to download and install the Ruby gem for Serve:
|
|
16
16
|
|
17
17
|
After we've done that it's probably a good idea to install a couple of additional gems so that Serve will play nicely with HAML, Markdown, and Textile:
|
18
18
|
|
19
|
-
$ sudo gem install haml
|
19
|
+
$ sudo gem install haml BlueCloth RedCloth
|
20
20
|
|
21
21
|
|
22
22
|
== Project Directory Structure
|
data/README.rdoc
CHANGED
@@ -55,6 +55,7 @@ markdown :: Evaluates the document as Markdown (requires the Bluecloth gem)
|
|
55
55
|
erb :: Experimental support for ERB
|
56
56
|
haml :: Evaluates the document as Haml (requires the Haml gem)
|
57
57
|
sass :: Evaluates the document as Sass (requires the Haml gem)
|
58
|
+
scss :: Evaluates the document as Scss (requires the Haml gem)
|
58
59
|
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
|
59
60
|
redirect :: Redirects to the URL contained in the document
|
60
61
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.
|
1
|
+
0.10.1
|
data/lib/serve/file_resolver.rb
CHANGED
@@ -12,9 +12,11 @@ module Serve
|
|
12
12
|
path = File.join(path) # path may be array
|
13
13
|
return nil if path =~ /\.\./
|
14
14
|
path = path.sub(%r{/\Z}, '')
|
15
|
-
if path =~ /\.css\Z/ && !File.file?(File.join(root, path))
|
16
|
-
|
17
|
-
sass_path
|
15
|
+
if path =~ /\.css\Z/ && !File.file?(File.join(root, path)) # if .css not found, try .scss, .sass:
|
16
|
+
alternates = %w{.scss .sass}.map { |ext| path.sub(/\.css\Z/, ext) }
|
17
|
+
sass_path = alternates.find do |p|
|
18
|
+
File.file?(File.join(root, p))
|
19
|
+
end
|
18
20
|
elsif File.directory?(File.join(root, path))
|
19
21
|
resolve(root, File.join(path, 'index'))
|
20
22
|
else
|
@@ -1,17 +1,27 @@
|
|
1
1
|
module Serve #:nodoc:
|
2
2
|
class SassHandler < FileTypeHandler #:nodoc:
|
3
|
-
extension 'sass'
|
3
|
+
extension 'sass', 'scss'
|
4
4
|
|
5
5
|
def parse(string)
|
6
6
|
require 'sass'
|
7
7
|
engine = Sass::Engine.new(string,
|
8
8
|
:load_paths => [@root_path],
|
9
9
|
:style => :expanded,
|
10
|
-
:filename => @script_filename
|
10
|
+
:filename => @script_filename,
|
11
|
+
:syntax => syntax(@script_filename)
|
11
12
|
)
|
12
13
|
engine.render
|
13
14
|
end
|
14
15
|
|
16
|
+
def syntax(filename)
|
17
|
+
ext = File.extname(@script_filename)
|
18
|
+
if ext == '.scss'
|
19
|
+
:scss
|
20
|
+
else
|
21
|
+
:sass
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
15
25
|
def content_type
|
16
26
|
'text/css'
|
17
27
|
end
|
data/spec/serve_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe "Serve" do
|
|
4
4
|
|
5
5
|
it "should register all of the file type handlers" do
|
6
6
|
Serve::WEBrick::Server.register_handlers
|
7
|
-
handlers = ["cgi", "email", "erb", "haml", "html.erb", "html.haml", "markdown", "redirect", "rhtml", "sass", "textile"]
|
7
|
+
handlers = ["cgi", "email", "erb", "haml", "html.erb", "html.haml", "markdown", "redirect", "rhtml", "sass", "scss", "textile"]
|
8
8
|
table = WEBrick::HTTPServlet::FileHandler::HandlerTable
|
9
9
|
table.keys.sort.should == handlers
|
10
10
|
end
|
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.10.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John W. Long
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2010-05-13 00:00:00 -04:00
|
14
14
|
default_executable: serve
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|