roda-component 0.1.6 → 0.1.7

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
  SHA1:
3
- metadata.gz: d0d11690e0fcadcb8e039e0da837a1e66d87f128
4
- data.tar.gz: 383600a90a2d5ba621a5ad2208923a056e5a7416
3
+ metadata.gz: fb40f8e16ac85061c67bd1682713ccb3f2b2ac5d
4
+ data.tar.gz: a59a3965324bc99366e09b30cd35c78ac6e0b1c8
5
5
  SHA512:
6
- metadata.gz: dfbd1b842323e8bd39b3f822e80cd1c7e537bb7c6e4df5f729fe3df69793867d17d30dfcb22e4776150cbc6339a9785305a6a9459ca2e06583043a2a3cb0bb6d
7
- data.tar.gz: 8d37da4c0faf072c3cfa0553404f5f7ad1b01a1913ba9f6e5df4f264a11cb97ff29859968e60f324851f4e1ec900eb90ea0649005620f1d21e7de4277258cb79
6
+ metadata.gz: 87300a93107f87aacde85afb7b8cf0c1348c8e4abe8cec88a0d4b639564e9c977263b795bfc5aee45d9c3e18ef2d215ee9ecb73ba46b0fa68137eeab77938a59
7
+ data.tar.gz: 86bcf3339b5abdda5341041f44689dadd60ea80a77516c47eb38fe0962df4f2cf5738ba6baa1492f72c3a2d07616c9371cd1924ec16217949d89be414e682aad
@@ -1,5 +1,5 @@
1
1
  class Roda
2
2
  class Component
3
- VERSION = "0.1.6"
3
+ VERSION = "0.1.7"
4
4
  end
5
5
  end
@@ -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
- s.debug = true
187
- s.source_map = true
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
- else
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: '',
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roda-component
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - cj