websin 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/websin/version.rb +1 -1
- data/lib/websin.rb +17 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f5c87d264dee8e22349123e56c618ddc7d7b9ed
|
4
|
+
data.tar.gz: a8daf42a84ebaf6a359978acfdc1bde662f0255e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58767bfd19c15e8c197091eac713bf732d12ce8c4d8fb12dfafc716f65c78abf7944b50ad1cf733983f869967f67f307fddea84e6d01dbcad6ec1f75876dd68b
|
7
|
+
data.tar.gz: 769376ec8cdd71b824a84241e32a20a62ab19c63c91418c2ccfe2dcdac44e47ed7707719ba5b5add865fde0d5c72d485fa5f8f412dddf93c67c434f1768b576e
|
data/lib/websin/version.rb
CHANGED
data/lib/websin.rb
CHANGED
@@ -17,8 +17,10 @@ class WebSin < Sinatra::Base
|
|
17
17
|
Dir[File.join(settings.views, path, "#{name}.*")].each do |file|
|
18
18
|
ext = File.extname(file)
|
19
19
|
case ext
|
20
|
-
when '.sass', '.scss'
|
21
|
-
|
20
|
+
when '.sass', '.scss'
|
21
|
+
return Sass.compile_file(file)
|
22
|
+
when '.js', '.css'
|
23
|
+
return File.read(file)
|
22
24
|
when '.coffee'
|
23
25
|
return CoffeeScript.compile File.read(file)
|
24
26
|
else raise RuntimeError, "File #{File.join(path, _name)} no found!"
|
@@ -28,7 +30,7 @@ class WebSin < Sinatra::Base
|
|
28
30
|
end
|
29
31
|
|
30
32
|
get '/*' do
|
31
|
-
ext = File.extname(params[:captures].first)
|
33
|
+
ext = File.extname(params[:captures].first).downcase
|
32
34
|
if params[:captures].first.end_with?('/')
|
33
35
|
path, name = params[:captures].first, 'index'
|
34
36
|
else
|
@@ -36,8 +38,18 @@ class WebSin < Sinatra::Base
|
|
36
38
|
end
|
37
39
|
|
38
40
|
case ext
|
39
|
-
when '.css'
|
40
|
-
|
41
|
+
when '.css'
|
42
|
+
content_type :css
|
43
|
+
render_css_or_js(name, path)
|
44
|
+
when '.js'
|
45
|
+
content_type :js
|
46
|
+
render_css_or_js(name, path)
|
47
|
+
when '.png', '.jpg', '.jpeg', '.gif'
|
48
|
+
content_type "image/#{ext[1..-1]}"
|
49
|
+
File.read(File.join(settings.views, params[:captures]))
|
50
|
+
when '' then slim :"#{path}/#{name[0] ? name : 'index'}"
|
51
|
+
else
|
52
|
+
File.read(File.join(settings.views, params[:captures]))
|
41
53
|
end
|
42
54
|
end
|
43
55
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: websin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Mrozek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|