Skip to content

Instantly share code, notes, and snippets.

@andoneve
Last active December 21, 2015 12:29
Show Gist options
  • Save andoneve/6306216 to your computer and use it in GitHub Desktop.
Save andoneve/6306216 to your computer and use it in GitHub Desktop.
require "bundler/gem_tasks"
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:test)
namespace :rexical do
task :clean do
`rm lib/lani/parser/lexer.rb`
end
task :regenerate do
has_rexical = `which rexical`
if has_rexical
`rex lib/lani/parser/lani.rex -o lib/lani/parser/lexer.rb`
else
puts "You need Rexical. Install it by doing:"
puts
puts "\t\tgem install rexical"
puts
puts "Or just type `bundle install`."
end
end
end
namespace :racc do
task :clean do
`rm lib/lani/parser/parser.rb`
end
task :regenerate do
has_racc = `which racc`
if has_racc
`racc lib/lani/parser/lani.y -o lib/lani/parser/parser.rb`
else
puts "You need Racc. Install it by doing:"
puts
puts "\t\tgem install racc"
puts
puts "Or just type `bundle install`."
end
end
end
task :test => ["rex:regenerate", "racc:regenerate"]
task :default => :test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment