bjork 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +28 -2
- data/lib/bjork/tasks.rb +16 -0
- data/lib/bjork/version.rb +1 -1
- data/lib/bjork.rb +34 -17
- metadata +3 -2
data/README.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
# Bjork
|
2
2
|
|
3
|
-
|
3
|
+
Magical HTML local game server. Serves up your CoffeeScript, JavaScript, image and sound assets.
|
4
|
+
|
5
|
+
Put your files in:
|
6
|
+
|
7
|
+
data
|
8
|
+
images
|
9
|
+
sounds
|
10
|
+
music
|
11
|
+
source
|
12
|
+
|
13
|
+
and they will be served by Bjork.
|
4
14
|
|
5
15
|
## Installation
|
6
16
|
|
@@ -18,7 +28,23 @@ Or install it yourself as:
|
|
18
28
|
|
19
29
|
## Usage
|
20
30
|
|
21
|
-
|
31
|
+
Start the server and it will serve up your game. In your Rakefile
|
32
|
+
|
33
|
+
require "bjork/tasks"
|
34
|
+
|
35
|
+
Then on the command line
|
36
|
+
|
37
|
+
rake start
|
38
|
+
|
39
|
+
This will start the bjork server.
|
40
|
+
|
41
|
+
Your game will be accessible at http://localhost:4567
|
42
|
+
|
43
|
+
## FAQ
|
44
|
+
|
45
|
+
Q. Why no umlaut?
|
46
|
+
|
47
|
+
A. Umlauts are hell on Rubygems
|
22
48
|
|
23
49
|
## Contributing
|
24
50
|
|
data/lib/bjork/tasks.rb
ADDED
data/lib/bjork/version.rb
CHANGED
data/lib/bjork.rb
CHANGED
@@ -17,15 +17,25 @@ module Bjork
|
|
17
17
|
class Server < Sinatra::Base
|
18
18
|
local_folder = File.expand_path(File.dirname(__FILE__))
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
asset_environment = Sprockets::Environment.new
|
21
|
+
asset_environment.cache = Sprockets::Cache::FileStore.new("/tmp")
|
22
|
+
|
23
|
+
set :assets, asset_environment
|
22
24
|
|
23
25
|
# Configure sprockets
|
24
26
|
settings.assets.append_path "#{local_folder}/javascripts"
|
25
27
|
settings.assets.append_path "#{local_folder}/stylesheets"
|
26
28
|
|
27
|
-
# External
|
28
|
-
|
29
|
+
# External Sprockets Source directories
|
30
|
+
%w[
|
31
|
+
data
|
32
|
+
images
|
33
|
+
music
|
34
|
+
sounds
|
35
|
+
source
|
36
|
+
].each do |path|
|
37
|
+
settings.assets.append_path path
|
38
|
+
end
|
29
39
|
|
30
40
|
set :public_folder, local_folder
|
31
41
|
|
@@ -35,19 +45,6 @@ module Bjork
|
|
35
45
|
haml :index
|
36
46
|
end
|
37
47
|
|
38
|
-
get "/javascripts/*.*" do
|
39
|
-
content_type "application/javascript"
|
40
|
-
|
41
|
-
path, extension = params[:splat]
|
42
|
-
|
43
|
-
settings.assets["#{path}.#{extension}"]
|
44
|
-
end
|
45
|
-
|
46
|
-
get "/stylesheets/:file.css" do
|
47
|
-
content_type "text/css"
|
48
|
-
settings.assets["#{params[:file]}.css"]
|
49
|
-
end
|
50
|
-
|
51
48
|
get '/debug_console' do
|
52
49
|
haml :debug
|
53
50
|
end
|
@@ -60,6 +57,26 @@ module Bjork
|
|
60
57
|
end
|
61
58
|
end
|
62
59
|
|
60
|
+
%w[
|
61
|
+
data
|
62
|
+
images
|
63
|
+
javascripts
|
64
|
+
music
|
65
|
+
sounds
|
66
|
+
stylesheets
|
67
|
+
].each do |dir|
|
68
|
+
get "/#{dir}/*.*" do
|
69
|
+
path, extension = params[:splat]
|
70
|
+
|
71
|
+
if asset = settings.assets["#{path}.#{extension}"]
|
72
|
+
content_type extension
|
73
|
+
asset
|
74
|
+
else
|
75
|
+
status 404
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
63
80
|
# TODO: handle saving directory
|
64
81
|
# post '/levels' do
|
65
82
|
# data = params["data"]
|
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.0
|
4
|
+
version: 0.1.0
|
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-04-
|
12
|
+
date: 2013-04-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -154,6 +154,7 @@ files:
|
|
154
154
|
- bjork.gemspec
|
155
155
|
- lib/bjork.rb
|
156
156
|
- lib/bjork/source_maps.rb
|
157
|
+
- lib/bjork/tasks.rb
|
157
158
|
- lib/bjork/version.rb
|
158
159
|
- lib/stylesheets/all.css
|
159
160
|
- lib/views/debug.haml
|