roda-component 0.1.6 → 0.1.7
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.
- checksums.yaml +4 -4
- data/lib/roda/component/version.rb +1 -1
- data/lib/roda/plugins/component.rb +13 -3
- data/test/dummy/app.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb40f8e16ac85061c67bd1682713ccb3f2b2ac5d
|
4
|
+
data.tar.gz: a59a3965324bc99366e09b30cd35c78ac6e0b1c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87300a93107f87aacde85afb7b8cf0c1348c8e4abe8cec88a0d4b639564e9c977263b795bfc5aee45d9c3e18ef2d215ee9ecb73ba46b0fa68137eeab77938a59
|
7
|
+
data.tar.gz: 86bcf3339b5abdda5341041f44689dadd60ea80a77516c47eb38fe0962df4f2cf5738ba6baa1492f72c3a2d07616c9371cd1924ec16217949d89be414e682aad
|
@@ -24,6 +24,7 @@ class Roda
|
|
24
24
|
opts[:cache] = app.thread_safe_cache if opts.fetch(:cache, true)
|
25
25
|
opts[:path] ||= 'components'
|
26
26
|
opts[:route] ||= 'components'
|
27
|
+
opts[:debug] ||= false
|
27
28
|
opts[:assets_route] ||= 'assets/components'
|
28
29
|
opts[:class] ||= Roda::Component
|
29
30
|
opts[:settings] ||= {}
|
@@ -183,8 +184,13 @@ class Roda
|
|
183
184
|
def components
|
184
185
|
opal = Opal::Server.new do |s|
|
185
186
|
# Append the gems path
|
186
|
-
|
187
|
-
|
187
|
+
if scope.component_opts[:debug]
|
188
|
+
s.debug = true
|
189
|
+
s.source_map = true
|
190
|
+
else
|
191
|
+
s.source_map = false
|
192
|
+
end
|
193
|
+
|
188
194
|
s.append_path Gem::Specification.find_by_name("roda-component").gem_dir + '/lib'
|
189
195
|
|
190
196
|
# Append the path to the components folder
|
@@ -198,7 +204,11 @@ class Roda
|
|
198
204
|
|
199
205
|
if path[/\.js\Z/]
|
200
206
|
run opal.sprockets
|
201
|
-
|
207
|
+
elsif scope.component_opts[:debug]
|
208
|
+
if path[/\.rb\Z/] && js_file = scope.request.env['PATH_INFO'].scan(/(.*\.map)/)
|
209
|
+
scope.request.env['PATH_INFO'] = path.gsub(js_file.last.first, '').gsub("/#{scope.component_opts[:assets_route]}", '')
|
210
|
+
end
|
211
|
+
|
202
212
|
run Opal::SourceMapServer.new(opal.sprockets, path)
|
203
213
|
end
|
204
214
|
end
|
data/test/dummy/app.rb
CHANGED
@@ -41,7 +41,7 @@ class TestApp < Roda
|
|
41
41
|
secret: "na"
|
42
42
|
|
43
43
|
plugin :csrf, header: 'X-CSRF-TOKEN', skip: ['POST:/faye']
|
44
|
-
plugin :component, { path: 'components', token: '687^*&SAD876asd87as6d*&8asd' }
|
44
|
+
plugin :component, { path: 'components', token: '687^*&SAD876asd87as6d*&8asd', debug: true }
|
45
45
|
plugin :assets, {
|
46
46
|
path: "#{path}/../public/chat",
|
47
47
|
css_dir: '',
|