-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rakefile for gen/compile/run of a single rb file
Conflicts: .gitignore
- Loading branch information
Showing
4 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
dependency-reduced-pom.xml | ||
tags | ||
build | ||
target | ||
*.swp | ||
*.swo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
require 'rake/clean' | ||
|
||
task :default => [:test] | ||
task :test do | ||
puts "TODO: test!" | ||
end | ||
|
||
CLEAN.include 'build' | ||
|
||
desc "Runs a single file" | ||
task :run, [:file_name] => [:compile] do |t, args| | ||
Dir.chdir("#{File.dirname(__FILE__)}") | ||
file_name = args[:file_name] | ||
raise "must specify file to run" unless file_name && File.exists?(file_name) | ||
Dir.chdir("#{File.dirname(__FILE__)}/build") | ||
sh "java #{File.basename(file_name, '.rb')}" | ||
end | ||
|
||
desc "Generate the java source file" | ||
task :generate, [:file_name] => [:jruby_check] do |t, args| | ||
Dir.chdir("#{File.dirname(__FILE__)}") | ||
file_name = args[:file_name] | ||
raise "must specify file to generate" unless file_name && File.exists?(file_name) | ||
sh "jruby -I target:src/main/ruby src/main/ruby/fast_ruby.rb #{file_name}" | ||
end | ||
|
||
desc "Compile the java source to bytecode" | ||
task :compile, [:file_name] => [:generate] do |t, args| | ||
Dir.chdir("#{File.dirname(__FILE__)}") | ||
file_name = args[:file_name] | ||
|
||
raise "must specify file to compile" unless file_name && File.exists?(file_name) | ||
Dir.chdir("#{File.dirname(__FILE__)}/build") | ||
sh "javac #{File.basename(file_name, '.rb')}.java" | ||
end | ||
|
||
|
||
task :jruby_check do |t| | ||
raise "Must have jruby installed" if `which jruby`.strip.empty? | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
if true | ||
puts "IF" | ||
else | ||
puts "HUH" | ||
end | ||
|