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: b0cb7ba351ab
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: da1178770f97
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Nov 11, 2014

  1. Stop using Opal::Sprockets::Environment

    Opal::Sprockets::Environment is on the way of deprecation.
    elia committed Nov 11, 2014
    Copy the full SHA
    d29ff74 View commit details
  2. Copy the full SHA
    da11787 View commit details
Showing with 16 additions and 4 deletions.
  1. +3 −1 lib/mspec/opal/rake_task.rb
  2. +13 −3 lib/opal/paths.rb
4 changes: 3 additions & 1 deletion lib/mspec/opal/rake_task.rb
Original file line number Diff line number Diff line change
@@ -93,7 +93,7 @@ def start_server
end
end

class Environment < ::Opal::Environment
class Environment < ::Sprockets::Environment
attr_reader :basedir, :pattern

def initialize(basedir = nil, pattern = nil)
@@ -113,6 +113,8 @@ def initialize(basedir = nil, pattern = nil)
ENV['OPAL_SPEC'] ||= files_to_run(pattern).join(',')

super()

::Opal.paths.each { |p| append_path p }
end

def stubs
16 changes: 13 additions & 3 deletions lib/opal/paths.rb
Original file line number Diff line number Diff line change
@@ -20,15 +20,25 @@ def self.append_path(path)
end

def self.use_gem(gem_name, include_dependecies = true)
require_paths_for_gem(gem_name, include_dependecies).each do |path|
append_path path
end
end

def self.require_paths_for_gem(gem_name, include_dependecies)
paths = []
spec = Gem::Specification.find_by_name(gem_name)

spec.runtime_dependencies.each do |dependency|
use_gem dependency.name
paths += require_paths_for_gem(dependency.name, include_dependecies)
end if include_dependecies

spec.require_paths.each do |path|
Opal.append_path File.join(spec.gem_dir, path)
gem_dir = spec.gem_dir
spec.require_paths.map do |path|
paths << File.join(gem_dir, path)
end

paths
end

# Private, don't add to these directly (use .append_path instead).