Rakefile in opal-0.1.0 vs Rakefile in opal-0.2.0
- old
+ new
@@ -1,154 +1,41 @@
require 'rubygems'
require 'rake'
-# require 'spec/rake/spectask'
-# require 'ftools'
require 'yard'
-#
-# Dir[File.join(File.dirname(__FILE__), 'tasks', '**', '*.rb')].each do |t|
-# require t
-# end
begin
require 'jeweler'
Jeweler::Tasks.new do |gemspec|
gemspec.name = "opal"
gemspec.summary = "Ruby compiler and runtime for the browser"
gemspec.description = "Ruby compiler and runtime for the browser."
gemspec.email = "adam@adambeynon.com"
gemspec.homepage = "http://opalscript.org"
gemspec.authors = ["Adam Beynon"]
+ gemspec.files.include 'opals/opal/**/*'
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler not available. Install it with: sudo gem install jeweler"
end
-desc "Simple task to require vienna framework. Uses local, not installed."
+
+
+desc "Simple task to require opal gem. Uses local, not installed."
task :opal_gem do
require File.join(File.dirname(__FILE__), 'lib', 'opal')
end
-# desc "Run all specs"
-# Spec::Rake::SpecTask.new('spec') do |t|
-# t.spec_files = FileList['spec/**/*.rb']
-# end
desc "Rebuild ruby parser (using racc)"
task :ruby_parser do
%x{racc -E lib/vienna/builders/ruby/ruby_parser.rb.y -o lib/vienna/builders/ruby/ruby_parser.rb}
end
-# desc "Rebuild vienna.js runtime file"
-# task :vienna do
-# File.open('build/vienna.js', 'w') do |out|
-# # pre
-# out.puts "var vienna = { };"
-# out.puts "(function(global, exports) {"
-#
-# # runtime
-# out.puts File.read('runtime/vienna.js')
-#
-# # post
-# out.puts "})(window, vienna);"
-#
-# # Core library - use all rb files in core dir, but ensure kerenl.rb and
-# # module.rb are first in line as most other things rely on them
-# ['core/kernel.rb', 'core/module.rb'].concat(Dir.glob('core/**/*.rb')).uniq!.each do |rb|
-# builder = Vienna::CherryKit::RubyBuilder.new(rb, nil, nil)
-# out.puts "// #{rb}"
-# out.puts "#{builder.build!}.apply(vienna.top_self);"
-# end
-# end
-# # puts "need to rebuild vienna.js"
-# end
-desc "build opal"
-task :opal => :opal_gem do
- raise "currently disabled. use simple_opal"
- opal = Vienna::Opal.new File.join(File.dirname(__FILE__),'frameworks', 'opal')
- opal.build! :build_dir => File.join(File.dirname(__FILE__), 'build')
-end
-
-desc "build simple_opal test opal purely for testing opal etc"
-task :simple_opal => :opal_gem do
- project = Vienna::Project.new(File.join(File.dirname(__FILE__), 'apps', 'simple_opal'), :build_mode => :debug)
- p project
- p project.targets
- project.build!
- # root = File.join(File.dirname(__FILE__), 'apps', 'simple_opal')
- # Vienna::Tools.new(root).build :simple_opal
-end
-
-desc "build simple_opal test opal purely for testing opal etc"
-task :simple_opal_spec => :opal_gem do
- project = Vienna::Project.new(File.join(File.dirname(__FILE__), 'apps', 'simple_opal'), :build_mode => :spec)
- p project
- p project.targets
- project.build!
- # root = File.join(File.dirname(__FILE__), 'apps', 'simple_opal')
- # V
-end
-
-desc "rebuild opal_spec package"
-task :opal_spec => :opal_gem do
- # opal framework root
- opal_root = File.join(File.dirname(__FILE__), 'frameworks', 'opal')
- # custom build root
- tmp_root = File.join(File.dirname(__FILE__), 'tmp', 'opal_spec')
- # our project
- project = Vienna::Project.new opal_root, :build_mode => :spec,
- :build_root => tmp_root
-
- project.build!
-end
-
-desc "Browser Specs"
-task :browser_spec => :opal_gem do
- browser_root = File.join(File.dirname(__FILE__), 'frameworks', 'browser')
-
- tmp_root = File.join(File.dirname(__FILE__), 'tmp', 'browser_spec')
-
- project = Vienna::Project.new browser_root, :build_mode => :spec,
- :build_root => tmp_root
-
- project.build!
-end
-
-desc "Foundation Specs"
-task :foundation_spec => :opal_gem do
- browser_root = File.join(File.dirname(__FILE__), 'frameworks', 'foundation')
-
- tmp_root = File.join(File.dirname(__FILE__), 'tmp', 'foundation_spec')
-
- project = Vienna::Project.new browser_root, :build_mode => :spec,
- :build_root => tmp_root
-
- project.build!
-end
-
-YARD::Rake::YardocTask.new do |t|
- YARD::Templates::Engine.register_template_path(File.join(Dir.getwd, 'yard_templates'))
- t.files = ['core/**/*.rb'] # optional
- # t.options = ['--any', '--extra', '--opts'] # optional
- t.options = ['-o./doc/vienna', '-tvienna']
- t.options += ['--title', 'Vienna Documentation']
-end
-
-# YARD::Rake::YardocTask.new(:cherry_kit) do |t|
-# t.files = ['lib/**/*.rb', OTHER_PATHS] # optional
-# t.options = ['--any', '--extra', '--opts'] # optional
-# end
-
-desc "Testing compiler etc"
-task :test => :vienna do
- test = Vienna::CherryKit::RubyBuilder.new('test/test_vienna.rb', nil, nil)
- puts test.build!
-end
-
namespace :doc do
# rebuild demos
desc "Rebuild demos"
task :demos => :opal_gem do
@@ -219,23 +106,44 @@
from = File.join(File.dirname(__FILE__), 'opals', 'spec', 'resources', 'index.html')
FileUtils.copy from, File.join(build_root, 'index.html')
end
end
-
- # desc "rebuild opal_spec package"
- # task :opal_spec => :opal_gem do
- # # opal framework root
- # opal_root = File.join(File.dirname(__FILE__), 'frameworks', 'opal')
- # # custom build root
- # tmp_root = File.join(File.dirname(__FILE__), 'tmp', 'opal_spec')
- # # our project
- # project = Vienna::Project.new opal_root, :build_mode => :spec,
- # :build_root => tmp_root
- #
- # project.build!
- # end
-
+ end
+end
+
+desc "Rebuild opal.js for deployment"
+task :opal => :opal_gem do
+ opal_root = File.join(File.dirname(__FILE__), 'opals', 'opal', 'browser')
+ build_root = File.join(File.dirname(__FILE__), 'doc')
+
+ # debug build
+ project = Vienna::Project.new opal_root, :build_mode => :debug,
+ :build_root => build_root
+
+ project.options :javascripts_prefix => '',
+ :javascript_name => 'opal.debug.js',
+ :bin_file => nil
+ project.build!
+ project.clean!
+
+ # release build
+ project = Vienna::Project.new opal_root, :build_mode => :release,
+ :build_root => build_root
+
+ project.options :javascripts_prefix => '',
+ :javascript_name => 'opal.js',
+ :bin_file => nil
+ project.build!
+ project.clean!
+
+ # minify!
+ %x{java -jar extras/compiler.jar --js=doc/opal.js --js_output_file=doc/opal.min.js}
+
+
+ # Also place all three into gen directory
+ %w{opal.min.js opal.debug.js}.each do |src|
+ FileUtils.copy "doc/#{src}", "gen/browser/__PROJECT_NAME__/javascripts/#{src}"
end
end
task :doc => ['doc:browser', 'doc:opal', 'doc:demos'] do
# go through each set of generated docs, and replace the style.css file