execjs-rails 0.2.2.4 → 0.2.2.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: edcd38dcf951e540b8604db101dc7e23cae51dff
4
- data.tar.gz: 873c0f6f9749f71dfb8e1b74b64048e41b1d74bd
3
+ metadata.gz: 120bd14e5651e22fc932ad2b1f8398786076e5dc
4
+ data.tar.gz: ca746742249bb33eb3aa69a824bb3ac46bfb99e6
5
5
  SHA512:
6
- metadata.gz: 1b1367fde842f20fa01441a7c2919ad104723a69bb4b3dfae153dbbe38fd264794822dbc0ff9583d6ccc12417a0acacd56ecdc7bba03c4bd419a307d20560694
7
- data.tar.gz: ea0662cada9b72036dfe81250dc59922e4194f9fef980646a7567de844e061f971befd1048d688280df91f0735cab1d5988fd73458438df68935e0f831db2674
6
+ metadata.gz: 9ec0fc17857912a94ac386c2618d838f8b05231f892ac8ce4dad07eda872c56d3d001281c73a0eb78130c0ca9a6088c7c2b729786de5e41cbb21c10eb7a5fc5e
7
+ data.tar.gz: b496dd3abc8a788bd4196959bd15c75ff5e7a342076ec5d0fe1f65271b1d224947321d6ad93c3c3e1adbcda5d7ad6c967e654c98883c6ba975d53e868dc4f191
@@ -62,7 +62,18 @@ module ExecJS
62
62
  config.after_initialize do |app|
63
63
  app.config.execjs_rails.build_source ||= lambda do
64
64
  app.config.execjs_rails.server_javascripts.map do |filename|
65
- app.assets[filename].to_s
65
+ # TODO: I hope there is a way to write this that depends much less on knowledge of Rails internals.
66
+ # Surely there is a terser way to tell Rails to us know that there's a precompiled asset or not?
67
+ precompiled_assets_path = "#{app.root}/public/#{app.config.assets.prefix}"
68
+ # If there is a precompile manifest, directly read the precompiled asset file.
69
+ if manifest = Dir["#{precompiled_assets_path}/.sprockets-manifest-*.json"].first
70
+ filename = ActiveSupport::JSON.decode(File.read(manifest))["assets"][filename]
71
+ File.read("#{precompiled_assets_path}/#{filename}")
72
+ # Otherwise let Sprockets build it.
73
+ else
74
+ puts "[execjs_rails] Requesting `#{filename}` from the asset cache."
75
+ app.assets[filename].to_s
76
+ end
66
77
  end.join(";")
67
78
  end
68
79
  Renderer.setup!(app.config.execjs_rails)
@@ -1,5 +1,5 @@
1
1
  module ExecJS
2
2
  module Rails
3
- VERSION = '0.2.2.4'
3
+ VERSION = '0.2.2.5'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: execjs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2.4
4
+ version: 0.2.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Revelry Labs, LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-10 00:00:00.000000000 Z
11
+ date: 2015-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: execjs