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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6935e6d5b7d47a46915f985a112f9954249f796047be73993840d2ae00269f37
4
- data.tar.gz: 79d2b51eea3e7ea059d7ae5eacc481c009ee37490e6a9e1abbc94ae521dc192c
3
+ metadata.gz: 778c86c907fdff758ac82dda4d3de3ca433f3ac64069361af654628f492f217b
4
+ data.tar.gz: a371cabe9c539af371f83f8cd064273960fd04bcbc44d17d4b42e48e2d58603d
5
5
  SHA512:
6
- metadata.gz: 7f3fb6d8f390a60300b1e777ced8c0e43151a1c7cf95a29658de842c3b7e7ef2aad61edcfb18940b0082c730bb01005e85f00cd5cc3943eed40d76688d81ac71
7
- data.tar.gz: 00ff848a493bb492b6715f867baf0239452eb8dac59dc8c223d1dafb3b776d183f533d87aad42480c35d9b5952ccd92844950d713c562fb83e1cbd99c1c590e5
6
+ metadata.gz: d369d8c576d65e2687784af6d8127e1201453e91e340df7a1704bbead73554e6953819bbee446e2e11fda7bf1819c3a692e8710913d760b41752cd73268a2e02
7
+ data.tar.gz: 3c8f84c5488fe9f76cc03748d9b7adcb5ab1c47bf4088c6f6d2ebb818db966863560f4933e3ad1e4d6c9f73c266d87224aeff735057bdfdab427675d51078d28
@@ -6,3 +6,4 @@ end
6
6
  require_relative './server/response_builder'
7
7
  require_relative './server/test_pipeline'
8
8
  require_relative './server/test_server'
9
+ require_relative './server/with_assets'
@@ -2,7 +2,6 @@ require 'sinatra/base'
2
2
  require 'yaml'
3
3
  require 'json'
4
4
 
5
-
6
5
  class Mumukit::Server::App < Sinatra::Base
7
6
  configure do
8
7
  set :mumuki_url, 'http://mumuki.io'
@@ -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
+
@@ -1,3 +1,3 @@
1
1
  module Mumukit
2
- VERSION = '2.32.0'
2
+ VERSION = '2.33.0'
3
3
  end
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.32.0
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-04-25 00:00:00.000000000 Z
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