mumukit 2.32.0 → 2.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mumukit/server.rb +1 -0
- data/lib/mumukit/server/app.rb +0 -1
- data/lib/mumukit/server/with_assets.rb +40 -0
- data/lib/mumukit/version.rb +1 -1
- metadata +31 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 778c86c907fdff758ac82dda4d3de3ca433f3ac64069361af654628f492f217b
|
4
|
+
data.tar.gz: a371cabe9c539af371f83f8cd064273960fd04bcbc44d17d4b42e48e2d58603d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d369d8c576d65e2687784af6d8127e1201453e91e340df7a1704bbead73554e6953819bbee446e2e11fda7bf1819c3a692e8710913d760b41752cd73268a2e02
|
7
|
+
data.tar.gz: 3c8f84c5488fe9f76cc03748d9b7adcb5ab1c47bf4088c6f6d2ebb818db966863560f4933e3ad1e4d6c9f73c266d87224aeff735057bdfdab427675d51078d28
|
data/lib/mumukit/server.rb
CHANGED
data/lib/mumukit/server/app.rb
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
require 'mime/types'
|
3
|
+
require 'sinatra/cross_origin'
|
4
|
+
|
5
|
+
module Mumukit::Server::WithAssets
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
included do
|
9
|
+
register Sinatra::CrossOrigin
|
10
|
+
|
11
|
+
configure do
|
12
|
+
set :allow_origin, '*'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class_methods do
|
17
|
+
def get_asset(route, absolute_path, type=nil)
|
18
|
+
type ||= infer_asset_type_from(route)
|
19
|
+
get "/assets/#{route}" do
|
20
|
+
cross_origin
|
21
|
+
send_file absolute_path, type: type
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def infer_asset_type_from(route)
|
26
|
+
extension = File.extname(route)
|
27
|
+
MIME::Types.type_for(extension).first.content_type
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_local_asset(route, path, type=nil)
|
31
|
+
get_asset route, File.join(local_asset_dir, '..', path), type
|
32
|
+
end
|
33
|
+
|
34
|
+
def local_asset_dir
|
35
|
+
@local_asset_dir ||= File.dirname caller[1].split(':')[0]
|
36
|
+
# Had to use caller[1] because the first entry of the stack is from this file
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
data/lib/mumukit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumukit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.33.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Leonardo Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -178,6 +178,34 @@ dependencies:
|
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0.46'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: sinatra-cross_origin
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0.4'
|
188
|
+
type: :runtime
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0.4'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: mime-types
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '3.2'
|
202
|
+
type: :runtime
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - "~>"
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '3.2'
|
181
209
|
- !ruby/object:Gem::Dependency
|
182
210
|
name: mulang
|
183
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -301,6 +329,7 @@ files:
|
|
301
329
|
- lib/mumukit/server/response_builder.rb
|
302
330
|
- lib/mumukit/server/test_pipeline.rb
|
303
331
|
- lib/mumukit/server/test_server.rb
|
332
|
+
- lib/mumukit/server/with_assets.rb
|
304
333
|
- lib/mumukit/string.rb
|
305
334
|
- lib/mumukit/templates.rb
|
306
335
|
- lib/mumukit/templates/expectations_hook.rb
|