Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 556c85cc6071
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1558aed22999
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Nov 23, 2014

  1. Fix sprockets based cache

    adambeynon committed Nov 23, 2014
    Copy the full SHA
    955e335 View commit details
  2. Fix opal-repl

    adambeynon committed Nov 23, 2014

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1558aed View commit details
Showing with 7 additions and 6 deletions.
  1. +2 −2 bin/opal-repl
  2. +2 −1 lib/opal/builder.rb
  3. +1 −2 lib/opal/sprockets/cache_store.rb
  4. +2 −1 lib/opal/sprockets/processor.rb
4 changes: 2 additions & 2 deletions bin/opal-repl
Original file line number Diff line number Diff line change
@@ -57,8 +57,8 @@ module Opal

def eval_ruby(str)
code = Opal::Builder.new.build_str(str, '(irb)', :irb => true, :const_missing => true)
code.processed[0...-1].each{ |c| @v8.eval(c.to_s) }
@v8.eval "var $_result = #{code.processed.last.to_s} ($_result == null ? 'nil' : $_result.$inspect());"
code.assets[0...-1].each{ |c| @v8.eval(c.to_s) }
@v8.eval "var $_result = #{code.assets.last.to_s} ($_result == null ? 'nil' : $_result.$inspect());"
rescue => e
puts "#{e.message}\n\t#{e.backtrace.join("\n\t")}"
end
3 changes: 2 additions & 1 deletion lib/opal/builder.rb
Original file line number Diff line number Diff line change
@@ -53,6 +53,7 @@ def build_str(source, filename, options = {})

process_requires asset, fname, options
@assets << asset
self
end

def build_require(path, options = {})
@@ -105,7 +106,7 @@ def cached_asset(path)
asset = yield

# TODO: cache asset (should check for cache_store first)
# cache_store[path] = asset
cache_store[path] = asset

asset
end
3 changes: 1 addition & 2 deletions lib/opal/sprockets/cache_store.rb
Original file line number Diff line number Diff line change
@@ -9,8 +9,7 @@ def initialize(environment)
end

def []=(key, asset)
environment.cache_set("opal/#{key}.cache", {
:contents => contents, :requires => requires})
environment.cache_set("opal/#{key}.cache", asset.encode)
end

def [](key)
3 changes: 2 additions & 1 deletion lib/opal/sprockets/processor.rb
Original file line number Diff line number Diff line change
@@ -108,7 +108,8 @@ def self.new_builder(context)
}

path_reader = ::Opal::Sprockets::PathReader.new(context.environment, context)
cache_store = ::Opal::Sprockets::CacheStore.new(context.environment)
# cache_store = ::Opal::Sprockets::CacheStore.new(context.environment)
cache_store = nil

return Builder.new(
compiler_options: compiler_options,