most 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Copying.txt +679 -0
- data/History.txt +15 -0
- data/Manifest.txt +95 -0
- data/PostInstall.txt +6 -0
- data/Rakefile +44 -0
- data/Readme.rdoc +146 -0
- data/bin/most +31 -0
- data/lib/most.rb +52 -0
- data/lib/most/context.rb +244 -0
- data/lib/most/core.rb +171 -0
- data/lib/most/di/container.rb +148 -0
- data/lib/most/di/proxy.rb +55 -0
- data/lib/most/di/service.rb +63 -0
- data/lib/most/di/service_factory.rb +40 -0
- data/lib/most/environment.rb +67 -0
- data/lib/most/executor.rb +80 -0
- data/lib/most/helpers/array.rb +31 -0
- data/lib/most/helpers/hash.rb +25 -0
- data/lib/most/helpers/kernel.rb +35 -0
- data/lib/most/helpers/memory_out.rb +93 -0
- data/lib/most/helpers/numeric.rb +59 -0
- data/lib/most/helpers/object.rb +65 -0
- data/lib/most/helpers/symbol.rb +31 -0
- data/lib/most/interfaces/meta_programmable.rb +59 -0
- data/lib/most/starter.rb +126 -0
- data/lib/most/structures/box.rb +199 -0
- data/lib/most/structures/submission.rb +117 -0
- data/lib/most/structures/test_case.rb +173 -0
- data/lib/most/structures/test_runner.rb +103 -0
- data/lib/most/structures/types/options.rb +67 -0
- data/lib/most/structures/types/path.rb +39 -0
- data/lib/most/structures/types/report.rb +84 -0
- data/lib/most/submissions/cpp_memory_out_sample.rb +34 -0
- data/lib/most/submissions/cpp_sample.rb +36 -0
- data/lib/most/submissions/cpp_timeout_sample.rb +34 -0
- data/lib/most/submissions/cs_sample.rb +36 -0
- data/lib/most/submissions/erlang_sample.rb +36 -0
- data/lib/most/submissions/haskell_sample.rb +36 -0
- data/lib/most/submissions/java_sample.rb +36 -0
- data/lib/most/submissions/lisp_sample.rb +32 -0
- data/lib/most/submissions/lua_sample.rb +36 -0
- data/lib/most/submissions/ocaml_sample.rb +36 -0
- data/lib/most/submissions/pascal_sample.rb +36 -0
- data/lib/most/submissions/perl_sample.rb +32 -0
- data/lib/most/submissions/php_sample.rb +32 -0
- data/lib/most/submissions/python_sample.rb +32 -0
- data/lib/most/submissions/ruby_sample.rb +32 -0
- data/lib/most/submissions/vb_sample.rb +36 -0
- data/lib/most/tasks/general/win/cs.rb +60 -0
- data/lib/most/tasks/general/win/erlang.rb +86 -0
- data/lib/most/tasks/general/win/gcc.rb +39 -0
- data/lib/most/tasks/general/win/haskell.rb +75 -0
- data/lib/most/tasks/general/win/java.rb +72 -0
- data/lib/most/tasks/general/win/lisp.rb +59 -0
- data/lib/most/tasks/general/win/lua.rb +75 -0
- data/lib/most/tasks/general/win/ocaml.rb +77 -0
- data/lib/most/tasks/general/win/pascal.rb +73 -0
- data/lib/most/tasks/general/win/perl.rb +61 -0
- data/lib/most/tasks/general/win/php.rb +59 -0
- data/lib/most/tasks/general/win/python.rb +59 -0
- data/lib/most/tasks/general/win/ruby.rb +61 -0
- data/lib/most/tasks/general/win/vb.rb +60 -0
- data/lib/most/tasks/general/win/vc.rb +79 -0
- data/lib/most/tasks/general/win/vs.rb +52 -0
- data/samples/problem/solutions/cpp/main.cpp +9 -0
- data/samples/problem/solutions/cpp/tests.yml +19 -0
- data/samples/problem/solutions/cs/main.cs +17 -0
- data/samples/problem/solutions/cs/tests.yml +19 -0
- data/samples/problem/solutions/erlang/main.erl +2 -0
- data/samples/problem/solutions/erlang/tests.yml +19 -0
- data/samples/problem/solutions/haskell/main.hs +5 -0
- data/samples/problem/solutions/haskell/tests.yml +19 -0
- data/samples/problem/solutions/java/Main.java +14 -0
- data/samples/problem/solutions/java/tests.yml +19 -0
- data/samples/problem/solutions/lisp/main.lisp +1 -0
- data/samples/problem/solutions/lisp/tests.yml +19 -0
- data/samples/problem/solutions/lua/main.lua +4 -0
- data/samples/problem/solutions/lua/tests.yml +19 -0
- data/samples/problem/solutions/ocaml/main.ml +3 -0
- data/samples/problem/solutions/ocaml/tests.yml +19 -0
- data/samples/problem/solutions/pascal/main.pas +5 -0
- data/samples/problem/solutions/pascal/tests.yml +19 -0
- data/samples/problem/solutions/perl/main.pl +2 -0
- data/samples/problem/solutions/perl/tests.yml +19 -0
- data/samples/problem/solutions/php/main.php +1 -0
- data/samples/problem/solutions/php/tests.yml +19 -0
- data/samples/problem/solutions/python/main.py +1 -0
- data/samples/problem/solutions/python/tests.yml +19 -0
- data/samples/problem/solutions/ruby/main.rb +1 -0
- data/samples/problem/solutions/ruby/tests.yml +19 -0
- data/samples/problem/solutions/vb/main.vb +14 -0
- data/samples/problem/solutions/vb/tests.yml +19 -0
- data/samples/time_memory/solutions/cpp/main.cpp +21 -0
- data/samples/time_memory/solutions/cpp/tests.yml +19 -0
- data/tasks/samples.rb +31 -0
- metadata +242 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Most - Modular Open Software Tester.
|
|
2
|
+
# Copyright (C) 2009 Dmitrii Toksaitov
|
|
3
|
+
#
|
|
4
|
+
# This file is part of Most.
|
|
5
|
+
#
|
|
6
|
+
# Most is free software: you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
# (at your option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# Most is distributed in the hope that it will be useful,
|
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
# GNU General Public License for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU General Public License
|
|
17
|
+
# along with Most. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
19
|
+
require 'rake/clean'
|
|
20
|
+
|
|
21
|
+
namespace :win do
|
|
22
|
+
namespace :lua do
|
|
23
|
+
|
|
24
|
+
task :prepare do
|
|
25
|
+
lua_home = nil
|
|
26
|
+
Most::DIRECTORIES[:vendors].each do |directory|
|
|
27
|
+
possible_path = File.join(directory, 'lua')
|
|
28
|
+
lua_home = possible_path if File.directory?(possible_path)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
unless lua_home.nil?
|
|
32
|
+
clibs_path = File.join(lua_home, 'clibs')
|
|
33
|
+
|
|
34
|
+
ENV['PATH'] ||= ''; ENV['PATH'] = "#{lua_home};#{clibs_path};#{ENV['PATH']}"
|
|
35
|
+
|
|
36
|
+
ENV['LUA_DEV'] = lua_home
|
|
37
|
+
ENV['LUA_PATH'] = ';;%LUA_DEV%\lua\?.luac'
|
|
38
|
+
ENV['LUA_MPATH'] = '?.mlua;%LUA_DEV%\lua\metalua\?.mlua'
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
task :compile, :source, :executable, :needs => [:prepare] do |task, args|
|
|
43
|
+
compilation_command = %{luac -o #{args.executable} #{args.source}}
|
|
44
|
+
|
|
45
|
+
service = Most::SERVICES[:open4]
|
|
46
|
+
service.popen4(compilation_command) do |stdin, stdout, stderr, pid|
|
|
47
|
+
$stdout.puts(stdout.read())
|
|
48
|
+
$stderr.puts(stderr.read())
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
task :run, :executable, :input do |task, args|
|
|
53
|
+
args.with_defaults(:input => '')
|
|
54
|
+
|
|
55
|
+
service = Most::SERVICES[:open4]
|
|
56
|
+
service.popen4(%{lua #{args.executable}}) do |stdin, stdout, stderr, pid|
|
|
57
|
+
Most::GLOBALS[:pid] = pid
|
|
58
|
+
|
|
59
|
+
unless args.input.is_a?(Most::Path)
|
|
60
|
+
stdin.write(args.input)
|
|
61
|
+
stdin.close()
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
process_stdout = stdout.read()
|
|
65
|
+
process_stderr = stderr.read()
|
|
66
|
+
|
|
67
|
+
Most::GLOBALS[:output] = process_stdout
|
|
68
|
+
|
|
69
|
+
$stdout.puts(process_stdout)
|
|
70
|
+
$stderr.puts(process_stderr)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Most - Modular Open Software Tester.
|
|
2
|
+
# Copyright (C) 2009 Dmitrii Toksaitov
|
|
3
|
+
#
|
|
4
|
+
# This file is part of Most.
|
|
5
|
+
#
|
|
6
|
+
# Most is free software: you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
# (at your option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# Most is distributed in the hope that it will be useful,
|
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
# GNU General Public License for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU General Public License
|
|
17
|
+
# along with Most. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
19
|
+
require 'rake/clean'
|
|
20
|
+
|
|
21
|
+
CLEAN.include('*.cmi')
|
|
22
|
+
CLEAN.include('*.cmo')
|
|
23
|
+
|
|
24
|
+
namespace :win do
|
|
25
|
+
namespace :ocaml do
|
|
26
|
+
|
|
27
|
+
task :prepare do
|
|
28
|
+
ocaml_home = nil
|
|
29
|
+
Most::DIRECTORIES[:vendors].each do |directory|
|
|
30
|
+
possible_path = File.join(directory, 'ocaml')
|
|
31
|
+
ocaml_home = possible_path if File.directory?(possible_path)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
unless ocaml_home.nil?
|
|
35
|
+
bin_path = File.join(ocaml_home, 'bin')
|
|
36
|
+
lib_path = File.join(ocaml_home, 'lib')
|
|
37
|
+
|
|
38
|
+
ENV['PATH'] ||= ''; ENV['PATH'] = "#{bin_path};#{ENV['PATH']}"
|
|
39
|
+
|
|
40
|
+
ENV['OCAMLLIB'] = lib_path
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
task :compile, :source, :executable, :needs => [:prepare] do |task, args|
|
|
45
|
+
compilation_command = %{ocamlc #{args.source} -o #{args.executable}}
|
|
46
|
+
|
|
47
|
+
service = Most::SERVICES[:open4]
|
|
48
|
+
service.popen4(compilation_command) do |stdin, stdout, stderr, pid|
|
|
49
|
+
$stdout.puts(stdout.read())
|
|
50
|
+
$stderr.puts(stderr.read())
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
task :run, :executable, :input do |task, args|
|
|
55
|
+
args.with_defaults(:input => '')
|
|
56
|
+
|
|
57
|
+
service = Most::SERVICES[:open4]
|
|
58
|
+
service.popen4(args.executable) do |stdin, stdout, stderr, pid|
|
|
59
|
+
Most::GLOBALS[:pid] = pid
|
|
60
|
+
|
|
61
|
+
unless args.input.is_a?(Most::Path)
|
|
62
|
+
stdin.write(args.input)
|
|
63
|
+
stdin.close()
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
process_stdout = stdout.read()
|
|
67
|
+
process_stderr = stderr.read()
|
|
68
|
+
|
|
69
|
+
Most::GLOBALS[:output] = process_stdout
|
|
70
|
+
|
|
71
|
+
$stdout.puts(process_stdout)
|
|
72
|
+
$stderr.puts(process_stderr)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Most - Modular Open Software Tester.
|
|
2
|
+
# Copyright (C) 2009 Dmitrii Toksaitov
|
|
3
|
+
#
|
|
4
|
+
# This file is part of Most.
|
|
5
|
+
#
|
|
6
|
+
# Most is free software: you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
# (at your option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# Most is distributed in the hope that it will be useful,
|
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
# GNU General Public License for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU General Public License
|
|
17
|
+
# along with Most. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
19
|
+
require 'rake/clean'
|
|
20
|
+
|
|
21
|
+
CLEAN.include('*.o')
|
|
22
|
+
|
|
23
|
+
namespace :win do
|
|
24
|
+
namespace :pascal do
|
|
25
|
+
|
|
26
|
+
task :prepare do
|
|
27
|
+
pascal_home = nil
|
|
28
|
+
Most::DIRECTORIES[:vendors].each do |directory|
|
|
29
|
+
possible_path = File.join(directory, 'pascal')
|
|
30
|
+
pascal_home = possible_path if File.directory?(possible_path)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
unless pascal_home.nil?
|
|
34
|
+
bin_path = File.join(pascal_home, 'bin', 'i386-Win32')
|
|
35
|
+
|
|
36
|
+
ENV['PATH'] ||= ''; ENV['PATH'] = "#{bin_path};#{ENV['PATH']}"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
task :compile, :source, :executable, :needs => [:prepare] do |task, args|
|
|
41
|
+
compilation_command = %{fpc -O3 -Mobjfpc #{args.source}}
|
|
42
|
+
|
|
43
|
+
service = Most::SERVICES[:open4]
|
|
44
|
+
service.popen4(compilation_command) do |stdin, stdout, stderr, pid|
|
|
45
|
+
$stdout.puts(stdout.read())
|
|
46
|
+
$stderr.puts(stderr.read())
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
task :run, :executable, :input do |task, args|
|
|
51
|
+
args.with_defaults(:input => '')
|
|
52
|
+
|
|
53
|
+
service = Most::SERVICES[:open4]
|
|
54
|
+
service.popen4(args.executable) do |stdin, stdout, stderr, pid|
|
|
55
|
+
Most::GLOBALS[:pid] = pid
|
|
56
|
+
|
|
57
|
+
unless args.input.is_a?(Most::Path)
|
|
58
|
+
stdin.write(args.input)
|
|
59
|
+
stdin.close()
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
process_stdout = stdout.read()
|
|
63
|
+
process_stderr = stderr.read()
|
|
64
|
+
|
|
65
|
+
Most::GLOBALS[:output] = process_stdout
|
|
66
|
+
|
|
67
|
+
$stdout.puts(process_stdout)
|
|
68
|
+
$stderr.puts(process_stderr)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Most - Modular Open Software Tester.
|
|
2
|
+
# Copyright (C) 2009 Dmitrii Toksaitov
|
|
3
|
+
#
|
|
4
|
+
# This file is part of Most.
|
|
5
|
+
#
|
|
6
|
+
# Most is free software: you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
# (at your option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# Most is distributed in the hope that it will be useful,
|
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
# GNU General Public License for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU General Public License
|
|
17
|
+
# along with Most. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
19
|
+
require 'rake/clean'
|
|
20
|
+
|
|
21
|
+
namespace :win do
|
|
22
|
+
namespace :perl do
|
|
23
|
+
|
|
24
|
+
task :prepare do
|
|
25
|
+
perl_home = nil
|
|
26
|
+
Most::DIRECTORIES[:vendors].each do |directory|
|
|
27
|
+
possible_path = File.join(directory, 'perl')
|
|
28
|
+
perl_home = possible_path if File.directory?(possible_path)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
unless perl_home.nil?
|
|
32
|
+
bin_path = File.join(perl_home, 'bin')
|
|
33
|
+
|
|
34
|
+
ENV['PATH'] ||= ''; ENV['PATH'] = "#{bin_path};#{ENV['PATH']}"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
task :run, :executable, :input, :needs => [:prepare] do |task, args|
|
|
39
|
+
args.with_defaults(:input => '')
|
|
40
|
+
|
|
41
|
+
service = Most::SERVICES[:open4]
|
|
42
|
+
service.popen4(%{perl #{args.executable}}) do |stdin, stdout, stderr, pid|
|
|
43
|
+
Most::GLOBALS[:pid] = pid
|
|
44
|
+
|
|
45
|
+
unless args.input.is_a?(Most::Path)
|
|
46
|
+
stdin.write(args.input)
|
|
47
|
+
stdin.close()
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
process_stdout = stdout.read()
|
|
51
|
+
process_stderr = stderr.read()
|
|
52
|
+
|
|
53
|
+
Most::GLOBALS[:output] = process_stdout
|
|
54
|
+
|
|
55
|
+
$stdout.puts(process_stdout)
|
|
56
|
+
$stderr.puts(process_stderr)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Most - Modular Open Software Tester.
|
|
2
|
+
# Copyright (C) 2009 Dmitrii Toksaitov
|
|
3
|
+
#
|
|
4
|
+
# This file is part of Most.
|
|
5
|
+
#
|
|
6
|
+
# Most is free software: you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
# (at your option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# Most is distributed in the hope that it will be useful,
|
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
# GNU General Public License for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU General Public License
|
|
17
|
+
# along with Most. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
19
|
+
require 'rake/clean'
|
|
20
|
+
|
|
21
|
+
namespace :win do
|
|
22
|
+
namespace :php do
|
|
23
|
+
|
|
24
|
+
task :prepare do
|
|
25
|
+
php_home = nil
|
|
26
|
+
Most::DIRECTORIES[:vendors].each do |directory|
|
|
27
|
+
possible_path = File.join(directory, 'php')
|
|
28
|
+
php_home = possible_path if File.directory?(possible_path)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
unless php_home.nil?
|
|
32
|
+
ENV['PATH'] ||= ''; ENV['PATH'] = "#{php_home};#{ENV['PATH']}"
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
task :run, :executable, :input, :needs => [:prepare] do |task, args|
|
|
37
|
+
args.with_defaults(:input => '')
|
|
38
|
+
|
|
39
|
+
service = Most::SERVICES[:open4]
|
|
40
|
+
service.popen4(%{php #{args.executable}}) do |stdin, stdout, stderr, pid|
|
|
41
|
+
Most::GLOBALS[:pid] = pid
|
|
42
|
+
|
|
43
|
+
unless args.input.is_a?(Most::Path)
|
|
44
|
+
stdin.write(args.input)
|
|
45
|
+
stdin.close()
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
process_stdout = stdout.read()
|
|
49
|
+
process_stderr = stderr.read()
|
|
50
|
+
|
|
51
|
+
Most::GLOBALS[:output] = process_stdout
|
|
52
|
+
|
|
53
|
+
$stdout.puts(process_stdout)
|
|
54
|
+
$stderr.puts(process_stderr)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Most - Modular Open Software Tester.
|
|
2
|
+
# Copyright (C) 2009 Dmitrii Toksaitov
|
|
3
|
+
#
|
|
4
|
+
# This file is part of Most.
|
|
5
|
+
#
|
|
6
|
+
# Most is free software: you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
# (at your option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# Most is distributed in the hope that it will be useful,
|
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
# GNU General Public License for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU General Public License
|
|
17
|
+
# along with Most. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
19
|
+
require 'rake/clean'
|
|
20
|
+
|
|
21
|
+
namespace :win do
|
|
22
|
+
namespace :python do
|
|
23
|
+
|
|
24
|
+
task :prepare do
|
|
25
|
+
python_home = nil
|
|
26
|
+
Most::DIRECTORIES[:vendors].each do |directory|
|
|
27
|
+
possible_path = File.join(directory, 'python')
|
|
28
|
+
python_home = possible_path if File.directory?(possible_path)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
unless python_home.nil?
|
|
32
|
+
ENV['PATH'] ||= ''; ENV['PATH'] = "#{python_home};#{ENV['PATH']}"
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
task :run, :executable, :input, :needs => [:prepare] do |task, args|
|
|
37
|
+
args.with_defaults(:input => '')
|
|
38
|
+
|
|
39
|
+
service = Most::SERVICES[:open4]
|
|
40
|
+
service.popen4(%{python -O #{args.executable}}) do |stdin, stdout, stderr, pid|
|
|
41
|
+
Most::GLOBALS[:pid] = pid
|
|
42
|
+
|
|
43
|
+
unless args.input.is_a?(Most::Path)
|
|
44
|
+
stdin.write(args.input)
|
|
45
|
+
stdin.close()
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
process_stdout = stdout.read()
|
|
49
|
+
process_stderr = stderr.read()
|
|
50
|
+
|
|
51
|
+
Most::GLOBALS[:output] = process_stdout
|
|
52
|
+
|
|
53
|
+
$stdout.puts(process_stdout)
|
|
54
|
+
$stderr.puts(process_stderr)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Most - Modular Open Software Tester.
|
|
2
|
+
# Copyright (C) 2009 Dmitrii Toksaitov
|
|
3
|
+
#
|
|
4
|
+
# This file is part of Most.
|
|
5
|
+
#
|
|
6
|
+
# Most is free software: you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
# (at your option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# Most is distributed in the hope that it will be useful,
|
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
# GNU General Public License for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU General Public License
|
|
17
|
+
# along with Most. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
19
|
+
require 'rake/clean'
|
|
20
|
+
|
|
21
|
+
namespace :win do
|
|
22
|
+
namespace :ruby do
|
|
23
|
+
|
|
24
|
+
task :prepare do
|
|
25
|
+
ruby_home = nil
|
|
26
|
+
Most::DIRECTORIES[:vendors].each do |directory|
|
|
27
|
+
possible_path = File.join(directory, 'ruby')
|
|
28
|
+
ruby_home = possible_path if File.directory?(possible_path)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
unless ruby_home.nil?
|
|
32
|
+
bin_path = File.join(ruby_home, 'bin')
|
|
33
|
+
|
|
34
|
+
ENV['PATH'] ||= ''; ENV['PATH'] = "#{ruby_home};#{ENV['PATH']}"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
task :run, :executable, :input, :needs => [:prepare] do |task, args|
|
|
39
|
+
args.with_defaults(:input => '')
|
|
40
|
+
|
|
41
|
+
service = Most::SERVICES[:open4]
|
|
42
|
+
service.popen4(%{ruby #{args.executable}}) do |stdin, stdout, stderr, pid|
|
|
43
|
+
Most::GLOBALS[:pid] = pid
|
|
44
|
+
|
|
45
|
+
unless args.input.is_a?(Most::Path)
|
|
46
|
+
stdin.write(args.input)
|
|
47
|
+
stdin.close()
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
process_stdout = stdout.read()
|
|
51
|
+
process_stderr = stderr.read()
|
|
52
|
+
|
|
53
|
+
Most::GLOBALS[:output] = process_stdout
|
|
54
|
+
|
|
55
|
+
$stdout.puts(process_stdout)
|
|
56
|
+
$stderr.puts(process_stderr)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
end
|
|
61
|
+
end
|