lib/opal/rake_task.rb in opal-0.3.22 vs lib/opal/rake_task.rb in opal-0.3.25
- old
+ new
@@ -4,16 +4,17 @@
module Opal
class RakeTask
include Rake::DSL if defined? Rake::DSL
- attr_accessor :name, :build_dir, :specs_dir, :files, :dependencies
+ attr_accessor :name, :build_dir, :specs_dir, :files, :dependencies, :parser, :dir
def initialize(namespace = nil)
@project_dir = Dir.getwd
@name = File.basename(@project_dir)
+ @dir = @project_dir
@build_dir = 'build'
@specs_dir = 'spec'
@files = Dir['lib/**/*.{rb,js,erb}']
@dependencies = []
@@ -38,11 +39,11 @@
def define_tasks
desc "Build opal project"
task 'opal:build' do
out = File.join @build_dir, "#{ @name }.js"
puts " * #{out}"
- write_code Opal.build_files(@files), out
+ write_code Opal.build_files(@files, @dir), out
end
desc "Build specs"
task 'opal:spec' do
out = File.join @build_dir, 'specs.js'
@@ -53,9 +54,16 @@
desc "Build dependencies"
task 'opal:dependencies' do
out = File.join @build_dir, 'opal.js'
puts " * #{out}"
write_code Opal.runtime, out
+
+ # build opal-parser?
+ if @parser
+ out = File.join @build_dir, 'opal-parser.js'
+ puts " * #{out}"
+ write_code Opal.parser_code, out
+ end
@dependencies.each { |dep| build_gem dep }
end
desc "Build opal files, dependencies and specs"
\ No newline at end of file