Sha256: 28061377e63dde5b4fd6ac5706b5ed2ecbd608deff08aa3b0c6e621cf4fffedf
Contents?: true
Size: 1.92 KB
Versions: 1
Compression:
Stored size: 1.92 KB
Contents
# For spec.. mode :spec do # opal must require the spec opal itself. Also, we are the main target, so we # can set the bin file aswell (to use the spec's bin ruby file) config :runtime, :required => [:spec], :bin_file => :spec # Configure :spec to include its bin file, so opal can use it config :spec, :include_bin => true end namespace :build do # opal needs a completely custom opal (gem) builder as its not actually an # opal..ish...kinda task :opal do # puts "building opal for opal" FileUtils.mkdir_p File.dirname(@dst_path) # Get all ruby sources, then sort them (kernel.rb then module.rb then any) rb_sources = @build_item.source_items.select do |item| item.resource == :ruby end # make sure these two are at the start ['lib/kernel.rb', 'lib/module.rb'].reverse.each do |order| rb_sources.unshift rb_sources.select { |item| item.filename == order }.first end # make sure we remove the duplicates left over rb_sources.uniq! File.open(@dst_path, 'w') do |out| js_sources = %w(pre_opal opal browser debug post_opal) js_str = [] js_sources.each do |src| # puts @target.target_root, 'runtime', js_str << File.read(File.join(@target.target_root, 'runtime', "#{src}.js")) end out.puts js_str.join # out.puts "var opal = {};" # out.puts "(function(global, exports) {" # js_sources.each do |js| # puts js.filename # out.puts File.read(js.stage!.staging_path) # end # out.puts "})(this.window || global, opal);" rb_sources.each do |rb| out.puts "// ##################### #{rb.filename} #####################" out.puts "opal.load_raw_file('opal/#{rb.filename}', " out.puts File.read(rb.stage!.staging_path) out.puts ");" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
opal-0.1.0 | opals/runtime/Opalfile |