Sha256: e1e4235113508c7b29a6021cab916eff2a51e5faedf1bc3daafde815b26db057

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

<% if pattern.present? %>
  <%= link_to 'All specs', opal_spec_path %>
<% end %>

<h2>Running:</h2>
<ul>
  <% spec_files.each do |spec_file| %>
    <li>
      <% spec_file = clean_spec_path(spec_file) %>
      <%= link_to spec_file, opal_spec_path(pattern: spec_file) %>
    </li>
  <% end %>
</ul>

<%# The list of all asset dependency %>
<% all_specs = [] %>

<%# Track root assets that will need to be bootstrapped %>
<% root_assets = {} %>

<%# Collect all assets with their dependencies %>
<% builder.clean_spec_files.each do |require_path| %>
  <% asset = lookup_asset_for_path(require_path, type: :javascript) %>
  <% dependency_paths = asset.to_a.map { |a| a.logical_path } %>
  <% all_specs += dependency_paths  %>
  <% root_assets[dependency_paths.last] = require_path %>
<% end %>

<%# We'll ececute the boot code all at once in the end %>
<% load_code = [] %>

<%# Add include tags and boot code, we use #uniq as we don't want to source the same asset twice %>
<% all_specs.uniq.each do |asset_path| %>
  <%- root_asset = root_assets[asset_path] -%>
  <%= javascript_include_tag asset_path, skip_opal_loader: true %>
  <%- load_code << javascript_tag(Opal::Processor.load_asset_code(Rails.application.assets, root_asset)) if root_asset -%>
<% end %>

<%# Boot! %>
<%= load_code.join.html_safe %>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
opal-rails-0.8.1 app/views/opal_spec/run.html.erb
opal-rails-0.8.0 app/views/opal_spec/run.html.erb
opal-rails-0.8.0.rc1 app/views/opal_spec/run.html.erb