websin 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/websin/version.rb +1 -1
  3. data/lib/websin.rb +17 -5
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 151a2fe6dab2e1bebfd8414a01b152fdf23d8b29
4
- data.tar.gz: 4494f2962dac4fdbf764692caabc76a13a00baed
3
+ metadata.gz: 5f5c87d264dee8e22349123e56c618ddc7d7b9ed
4
+ data.tar.gz: a8daf42a84ebaf6a359978acfdc1bde662f0255e
5
5
  SHA512:
6
- metadata.gz: 27fe791b9ae0c7677c8ee08572e71932c1fdc2db2514f319041ef6c287b0b79f0bd6422bc21be9e63801a244390f6b604736d41284d0384d3fcaf77cbb89a9b9
7
- data.tar.gz: ba20c45839d97ef7e88ea14f857a82143e497b56f2ff678b387046d35d573ff694688b9c3a6d9e2616f09feaa5137bb1f80b8e76d7333a32cd9497de29ac25f2
6
+ metadata.gz: 58767bfd19c15e8c197091eac713bf732d12ce8c4d8fb12dfafc716f65c78abf7944b50ad1cf733983f869967f67f307fddea84e6d01dbcad6ec1f75876dd68b
7
+ data.tar.gz: 769376ec8cdd71b824a84241e32a20a62ab19c63c91418c2ccfe2dcdac44e47ed7707719ba5b5add865fde0d5c72d485fa5f8f412dddf93c67c434f1768b576e
@@ -1,3 +1,3 @@
1
1
  module Websin
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.4"
3
3
  end
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' then return Sass.compile_file(file)
21
- when '.js', '.css' then return File.read(file)
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', '.js' then render_css_or_js(name, path)
40
- else slim :"#{path}/#{name[0] ? name : 'index'}"
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.2
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-19 00:00:00.000000000 Z
11
+ date: 2014-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler