happo 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97302068d4c34f670c8ce49747ca263a1f5f6c36
4
- data.tar.gz: 03bb8213cfac918a790c72d392b86ee9d96429e5
3
+ metadata.gz: bfa1d5f7b53de566a64a6710794a4deea0a756db
4
+ data.tar.gz: db582e13b81de2322f8da87531e37230eea83800
5
5
  SHA512:
6
- metadata.gz: 5ddc0e81b2412b3f604ae335a7ad1e712d52e364ebd832684c8ad3a0493b20beb345b15981ef89a89dfe9a169cd296307adb4f11bef98df752775e35f9220553
7
- data.tar.gz: 9e530f6b12ddc037be582ea0536eaab077438ba601a03fe30dedf301f99ee27c1baec84bf29162e06a585fb80a31f0213755b249d3ce425e38442789569d525c
6
+ metadata.gz: 762fc9435e4b284e6c2d3c5bb475d1b0e7d8bd23215acb9404b767311fa6328440c328450ce2f1f14ebd0cbb60fa13624c06c3bedf78ea0831f8b9f8ecb5f795
7
+ data.tar.gz: cb059925a90d2398b09bb5a0aac0297911a8e221d4bdd73fff1920e722baefc715f0922caf653e14cef95de6540e8e3a3ba6f453cbdf8996d08cf96e4d98034d
data/lib/happo/server.rb CHANGED
@@ -39,18 +39,22 @@ module Happo
39
39
  end
40
40
 
41
41
  get '/*' do
42
- config = Happo::Utils.config
42
+ # If this file is part of Happo itself (e.g. some bit of JavaScript), we
43
+ # want to give that precedence so that Happo can work properly.
43
44
  file = params[:splat].first
44
- if File.exist?(file)
45
- send_file file
46
- else
47
- config['public_directories'].each do |pub_dir|
48
- filepath = File.join(Dir.pwd, pub_dir, file)
49
- if File.exist?(filepath)
50
- send_file filepath
51
- end
52
- end
45
+ return send_file(file) if File.exist?(file)
46
+
47
+ # The requested file is not part of Happo, so let's look in the configured
48
+ # public directories. This is useful for serving up e.g. custom font files
49
+ # that your components depend on to be rendered correctly.
50
+ config = Happo::Utils.config
51
+ config['public_directories'].each do |pub_dir|
52
+ filepath = File.join(Dir.pwd, pub_dir, file)
53
+ return send_file(filepath) if File.exist?(filepath)
53
54
  end
55
+
56
+ status 404 # not found
57
+ body '404 error: not found'
54
58
  end
55
59
 
56
60
  run!
data/lib/happo/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # Defines the gem version.
2
2
  module Happo
3
- VERSION = '2.0.2'
3
+ VERSION = '2.0.3'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: happo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henric Trotzig
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-07-22 00:00:00.000000000 Z
12
+ date: 2016-07-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chunky_png