tiltd 0.0.5 → 0.0.6
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/README.md +3 -3
- data/lib/tiltd/application.rb +3 -1
- data/lib/tiltd/version.rb +1 -1
- data/spec/application_spec.rb +11 -0
- metadata +4 -4
data/README.md
CHANGED
@@ -19,10 +19,10 @@ For demos, check out the `examples` folder
|
|
19
19
|
$ cd some-dir
|
20
20
|
$ echo '%h1 hello world' > index.haml
|
21
21
|
$ echo -e 'body\n\tcolor: blue' > style.css.sass
|
22
|
-
$ tiltd
|
22
|
+
$ tiltd -p 9000
|
23
23
|
|
24
|
-
index.haml can be found at http://localhost:
|
25
|
-
style.css.sass is at http://localhost:
|
24
|
+
index.haml can be found at http://localhost:9000/
|
25
|
+
style.css.sass is at http://localhost:9000/style.css
|
26
26
|
|
27
27
|
## Contributing
|
28
28
|
|
data/lib/tiltd/application.rb
CHANGED
@@ -4,7 +4,9 @@ module Tiltd
|
|
4
4
|
request = Rack::Request.new(env)
|
5
5
|
headers = {}
|
6
6
|
|
7
|
-
if
|
7
|
+
if File.exists?(request.path_info.gsub(%r{^/}, ''))
|
8
|
+
return Rack::File.new(Dir.pwd).call(env)
|
9
|
+
elsif content = Content.locate(request.path_info)
|
8
10
|
headers['Content-Type'] = content.mime_type
|
9
11
|
code = 200
|
10
12
|
body = content.body
|
data/lib/tiltd/version.rb
CHANGED
data/spec/application_spec.rb
CHANGED
@@ -10,6 +10,17 @@ describe Tiltd::Application do
|
|
10
10
|
Rack::Request.should_receive(:new).with(:env).and_return(request)
|
11
11
|
end
|
12
12
|
|
13
|
+
context "file exists" do
|
14
|
+
it "uses rack file" do
|
15
|
+
rack_file = mock(:rack_file)
|
16
|
+
File.should_receive(:exists?).with('foo/other').and_return(true)
|
17
|
+
Rack::File.should_receive(:new).with(Dir.pwd).and_return(rack_file)
|
18
|
+
rack_file.should_receive(:call).with(:env)
|
19
|
+
|
20
|
+
app.call(:env)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
13
24
|
context "content found" do
|
14
25
|
let(:content) { stub(body: 'content', mime_type: 'text/css') }
|
15
26
|
before { Tiltd::Content.should_receive(:locate).with('/foo/other').and_return(content)}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tiltd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -150,7 +150,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
150
150
|
version: '0'
|
151
151
|
segments:
|
152
152
|
- 0
|
153
|
-
hash:
|
153
|
+
hash: -401580461
|
154
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
155
|
none: false
|
156
156
|
requirements:
|
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
159
|
version: '0'
|
160
160
|
segments:
|
161
161
|
- 0
|
162
|
-
hash:
|
162
|
+
hash: -401580461
|
163
163
|
requirements: []
|
164
164
|
rubyforge_project:
|
165
165
|
rubygems_version: 1.8.24
|