lib/mspec/opal/rake_task.rb in opal-0.7.0.beta1 vs lib/mspec/opal/rake_task.rb in opal-0.7.0.beta2
- old
+ new
@@ -1,32 +1,8 @@
-require 'opal/nodes'
-class Opal::Nodes::CallNode
- # Rubyspec uses this call to load in language specific features at runtime.
- # We can't do this at runtime, so handle it during compilation
- add_special :language_version do
- if meth == :language_version and scope.top?
- lang_type = arglist[2][1]
- target = "corelib/language/versions/#{lang_type}_1.9"
-
- if File.exist?(target)
- compiler.requires << target
- end
-
- push fragment("nil")
- end
- end
-
- add_special :not_supported_on do
- unless meth == :not_supported_on and arglist[1][1] == :opal
- compile_default!
- end
- end
-end
-
-
require 'rack'
require 'webrick'
+require 'mspec/opal/special_calls'
module MSpec
module Opal
DEFAULT_BASEDIR = 'spec'
@@ -115,11 +91,11 @@
:Logger => WEBrick::Log.new("/dev/null"))
end
end
end
- class Environment < ::Opal::Environment
+ class Environment < ::Sprockets::Environment
attr_reader :basedir, :pattern
def initialize(basedir = nil, pattern = nil)
::Opal::Processor.arity_check_enabled = true
::Opal::Processor.dynamic_require_severity = :error
@@ -135,10 +111,12 @@
end
ENV['OPAL_SPEC'] ||= files_to_run(pattern).join(',')
super()
+
+ ::Opal.paths.each { |p| append_path p }
end
def stubs
# missing stdlib
stubs = %w[fileutils iconv yaml]
@@ -203,19 +181,20 @@
# add any filters in spec/filters of specs we dont want to run
add_files paths_from_glob("#{basedir}/filters/**/*.rb"), :filters
if pattern
# add custom opal specs from spec/
- add_files paths_from_glob(pattern) & rubyspec_white_list, :rubyspec_custom_pattern
- add_files paths_from_glob(pattern).grep(/(?!spec\/(corelib|stdlib)\/)/), :other_custom_pattern
+ add_files paths_from_glob(pattern) & rubyspec_white_list, :rubyspec_custom
+ add_files paths_from_glob(pattern).grep(/(?!spec\/(corelib|stdlib)\/)/), :other_custom
else
# add opal specific specs
- add_files paths_from_glob("#{basedir}/opal/**/*_spec.rb"), 'opal/*'
- add_files paths_from_glob("#{basedir}/lib/{lexer_spec.rb,parser/**/*_spec.rb}"), 'lib/{lexer,parser}'
+ add_files paths_from_glob("#{basedir}/opal/**/*_spec.rb"), :shared
+ add_files paths_from_glob("#{basedir}/lib/lexer_spec.rb"), :lexer
+ add_files paths_from_glob("#{basedir}/lib/parser/**/*_spec.rb"), :parser
# add any rubyspecs we want to run (defined in spec/rubyspecs)
- add_files rubyspec_white_list, :rubyspec_white_list
+ add_files rubyspec_white_list, :rubyspecs
end
end
def build_specs file = "#{basedir}/build/specs.js"
code = specs.to_s