Sha256: 9f9ee1c32870873bb0faff17bc4b2af4764f2c1f136e55aebcf95ba138e0610d
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
require 'opal/rspec/rake_task' class Opal::RSpec::RakeTask # Monkey patching the constructor without duplicating it here alias_method :orig_init, :initialize def initialize(name = 'opal:rspec', &block) # We'll add our formatter set code before any main code that uses this task runs. This also should work # out of the box with opal-rails, which uses a different server.main util than others runner_block = lambda do |server| block[server] if block run_before_this = server.main # TODO: Surely a better way than environment variables to pass this on? ENV['opal_rspec_after_formatter_set'] = run_before_this server.main = 'opal/rspec/sprockets_runner_customformat' regexes = ENV['SPEC_OPTS'].scan /--append_exp_from_load_path (\S+)/ regexes.each do |r| exp = Regexp.new(Regexp.escape(r[0])) matches = $:.select {|path| exp.match(path)} matches.each do |load_path| server.append_path load_path end end end orig_init name, &runner_block end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
opal-rspec-formatter-1.0.0 | lib/opal/rspec-formatter/rake_task.rb |