bjork 0.1.2 → 0.1.3
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/lib/bjork/version.rb +1 -1
- data/lib/bjork.rb +31 -35
- metadata +2 -2
data/lib/bjork/version.rb
CHANGED
data/lib/bjork.rb
CHANGED
@@ -16,40 +16,42 @@ Tilt::CoffeeScriptTemplate.default_bare = true
|
|
16
16
|
|
17
17
|
module Bjork
|
18
18
|
class Server < Sinatra::Base
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
19
|
+
configure do
|
20
|
+
enable :logging
|
21
|
+
|
22
|
+
# Serve any assets that exist in our folders
|
23
|
+
# Middlewares always take place before anything else,
|
24
|
+
# so if the file exists locally in the following folders
|
25
|
+
# it will be served.
|
26
|
+
# If it is not found the request will continue to the rest of the app
|
27
|
+
use Bjork::TryStatic, :urls => %w[/]
|
28
|
+
|
29
|
+
asset_environment = Sprockets::Environment.new
|
30
|
+
asset_environment.cache = Sprockets::Cache::FileStore.new("tmp")
|
31
|
+
|
32
|
+
server_folder = File.expand_path(File.dirname(__FILE__))
|
33
|
+
|
34
|
+
# Internal (bjork server) Sprockets asset directories
|
35
|
+
%w[
|
36
|
+
javascripts
|
37
|
+
stylesheets
|
38
|
+
].each do |path|
|
39
|
+
asset_environment.append_path File.join(server_folder, path)
|
40
|
+
end
|
27
41
|
|
28
|
-
|
29
|
-
|
42
|
+
# External (host app which is running bjork) Sprockets asset directories
|
43
|
+
%w[
|
44
|
+
lib
|
45
|
+
source
|
46
|
+
].each do |path|
|
47
|
+
asset_environment.append_path path
|
48
|
+
end
|
30
49
|
|
31
|
-
|
50
|
+
set :assets, asset_environment
|
32
51
|
|
33
|
-
|
34
|
-
%w[
|
35
|
-
javascripts
|
36
|
-
stylesheets
|
37
|
-
].each do |path|
|
38
|
-
asset_environment.append_path File.join(server_folder, path)
|
52
|
+
set :haml, { :format => :html5 }
|
39
53
|
end
|
40
54
|
|
41
|
-
# External (host app which is running bjork) Sprockets asset directories
|
42
|
-
%w[
|
43
|
-
lib
|
44
|
-
source
|
45
|
-
].each do |path|
|
46
|
-
asset_environment.append_path path
|
47
|
-
end
|
48
|
-
|
49
|
-
set :assets, asset_environment
|
50
|
-
|
51
|
-
set :haml, { :format => :html5 }
|
52
|
-
|
53
55
|
get "/" do
|
54
56
|
haml :index
|
55
57
|
end
|
@@ -91,12 +93,6 @@ module Bjork
|
|
91
93
|
stylesheets
|
92
94
|
].each do |dir|
|
93
95
|
get "/#{dir}/*.*" do
|
94
|
-
# Keep Sprockets environment's paths up to date with
|
95
|
-
# any gems that have been required after we've initialized
|
96
|
-
(Sprockets.paths - settings.assets.paths).each do |asset_path|
|
97
|
-
settings.assets.append_path asset_path
|
98
|
-
end
|
99
|
-
|
100
96
|
path, extension = params[:splat]
|
101
97
|
|
102
98
|
if asset = settings.assets["#{path}.#{extension}"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bjork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
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-05-
|
12
|
+
date: 2013-05-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|