forked from ericsperano/ruby-newt
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Rakefile
38 lines (32 loc) · 926 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require 'io/console'
require 'rake/extensiontask'
require 'rake/testtask'
require 'rubygems'
Rake::ExtensionTask.new 'ruby_newt' do |ext|
ext.lib_dir = 'lib/ruby_newt'
end
Rake::TestTask.new do |t|
t.name = :test_task
t.test_files = FileList['test/**/*_test.rb']
t.libs << 'test'
end
task :test_interactive do
scripts = FileList['examples/test*-e.rb', 'examples/test_method/*.rb']
.select { |name| FileTest.executable?(name) }
run_scripts(scripts)
end
task :test_interactive_jp do
scripts = FileList['examples/test*-j.rb', 'examples/test_method/*.rb']
run_scripts(scripts)
end
def run_scripts(scripts)
scripts.each do |script|
system('clear') || system('cls')
system("ruby -Ilib #{script}")
puts "\nExecuted '#{script}'"
puts 'Press a key to continue or ESC to exit.'
break if STDIN.getch == "\e"
end
end
task :default => :compile
task :test => [:compile, :test_task]