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.
Files changed (96) hide show
  1. data/Copying.txt +679 -0
  2. data/History.txt +15 -0
  3. data/Manifest.txt +95 -0
  4. data/PostInstall.txt +6 -0
  5. data/Rakefile +44 -0
  6. data/Readme.rdoc +146 -0
  7. data/bin/most +31 -0
  8. data/lib/most.rb +52 -0
  9. data/lib/most/context.rb +244 -0
  10. data/lib/most/core.rb +171 -0
  11. data/lib/most/di/container.rb +148 -0
  12. data/lib/most/di/proxy.rb +55 -0
  13. data/lib/most/di/service.rb +63 -0
  14. data/lib/most/di/service_factory.rb +40 -0
  15. data/lib/most/environment.rb +67 -0
  16. data/lib/most/executor.rb +80 -0
  17. data/lib/most/helpers/array.rb +31 -0
  18. data/lib/most/helpers/hash.rb +25 -0
  19. data/lib/most/helpers/kernel.rb +35 -0
  20. data/lib/most/helpers/memory_out.rb +93 -0
  21. data/lib/most/helpers/numeric.rb +59 -0
  22. data/lib/most/helpers/object.rb +65 -0
  23. data/lib/most/helpers/symbol.rb +31 -0
  24. data/lib/most/interfaces/meta_programmable.rb +59 -0
  25. data/lib/most/starter.rb +126 -0
  26. data/lib/most/structures/box.rb +199 -0
  27. data/lib/most/structures/submission.rb +117 -0
  28. data/lib/most/structures/test_case.rb +173 -0
  29. data/lib/most/structures/test_runner.rb +103 -0
  30. data/lib/most/structures/types/options.rb +67 -0
  31. data/lib/most/structures/types/path.rb +39 -0
  32. data/lib/most/structures/types/report.rb +84 -0
  33. data/lib/most/submissions/cpp_memory_out_sample.rb +34 -0
  34. data/lib/most/submissions/cpp_sample.rb +36 -0
  35. data/lib/most/submissions/cpp_timeout_sample.rb +34 -0
  36. data/lib/most/submissions/cs_sample.rb +36 -0
  37. data/lib/most/submissions/erlang_sample.rb +36 -0
  38. data/lib/most/submissions/haskell_sample.rb +36 -0
  39. data/lib/most/submissions/java_sample.rb +36 -0
  40. data/lib/most/submissions/lisp_sample.rb +32 -0
  41. data/lib/most/submissions/lua_sample.rb +36 -0
  42. data/lib/most/submissions/ocaml_sample.rb +36 -0
  43. data/lib/most/submissions/pascal_sample.rb +36 -0
  44. data/lib/most/submissions/perl_sample.rb +32 -0
  45. data/lib/most/submissions/php_sample.rb +32 -0
  46. data/lib/most/submissions/python_sample.rb +32 -0
  47. data/lib/most/submissions/ruby_sample.rb +32 -0
  48. data/lib/most/submissions/vb_sample.rb +36 -0
  49. data/lib/most/tasks/general/win/cs.rb +60 -0
  50. data/lib/most/tasks/general/win/erlang.rb +86 -0
  51. data/lib/most/tasks/general/win/gcc.rb +39 -0
  52. data/lib/most/tasks/general/win/haskell.rb +75 -0
  53. data/lib/most/tasks/general/win/java.rb +72 -0
  54. data/lib/most/tasks/general/win/lisp.rb +59 -0
  55. data/lib/most/tasks/general/win/lua.rb +75 -0
  56. data/lib/most/tasks/general/win/ocaml.rb +77 -0
  57. data/lib/most/tasks/general/win/pascal.rb +73 -0
  58. data/lib/most/tasks/general/win/perl.rb +61 -0
  59. data/lib/most/tasks/general/win/php.rb +59 -0
  60. data/lib/most/tasks/general/win/python.rb +59 -0
  61. data/lib/most/tasks/general/win/ruby.rb +61 -0
  62. data/lib/most/tasks/general/win/vb.rb +60 -0
  63. data/lib/most/tasks/general/win/vc.rb +79 -0
  64. data/lib/most/tasks/general/win/vs.rb +52 -0
  65. data/samples/problem/solutions/cpp/main.cpp +9 -0
  66. data/samples/problem/solutions/cpp/tests.yml +19 -0
  67. data/samples/problem/solutions/cs/main.cs +17 -0
  68. data/samples/problem/solutions/cs/tests.yml +19 -0
  69. data/samples/problem/solutions/erlang/main.erl +2 -0
  70. data/samples/problem/solutions/erlang/tests.yml +19 -0
  71. data/samples/problem/solutions/haskell/main.hs +5 -0
  72. data/samples/problem/solutions/haskell/tests.yml +19 -0
  73. data/samples/problem/solutions/java/Main.java +14 -0
  74. data/samples/problem/solutions/java/tests.yml +19 -0
  75. data/samples/problem/solutions/lisp/main.lisp +1 -0
  76. data/samples/problem/solutions/lisp/tests.yml +19 -0
  77. data/samples/problem/solutions/lua/main.lua +4 -0
  78. data/samples/problem/solutions/lua/tests.yml +19 -0
  79. data/samples/problem/solutions/ocaml/main.ml +3 -0
  80. data/samples/problem/solutions/ocaml/tests.yml +19 -0
  81. data/samples/problem/solutions/pascal/main.pas +5 -0
  82. data/samples/problem/solutions/pascal/tests.yml +19 -0
  83. data/samples/problem/solutions/perl/main.pl +2 -0
  84. data/samples/problem/solutions/perl/tests.yml +19 -0
  85. data/samples/problem/solutions/php/main.php +1 -0
  86. data/samples/problem/solutions/php/tests.yml +19 -0
  87. data/samples/problem/solutions/python/main.py +1 -0
  88. data/samples/problem/solutions/python/tests.yml +19 -0
  89. data/samples/problem/solutions/ruby/main.rb +1 -0
  90. data/samples/problem/solutions/ruby/tests.yml +19 -0
  91. data/samples/problem/solutions/vb/main.vb +14 -0
  92. data/samples/problem/solutions/vb/tests.yml +19 -0
  93. data/samples/time_memory/solutions/cpp/main.cpp +21 -0
  94. data/samples/time_memory/solutions/cpp/tests.yml +19 -0
  95. data/tasks/samples.rb +31 -0
  96. metadata +242 -0
data/History.txt ADDED
@@ -0,0 +1,15 @@
1
+ == 0.7.3 2009-23-11
2
+
3
+ * The �Numeric� class was extended with the following useful methods for the �Timeout� module:
4
+ * Numeric#milliseconds,
5
+ * Numeric#seconds,
6
+ * Numeric#minutes,
7
+ * Numeric#hours.
8
+ * An ability to show start and end time in the �verbose� mode was added to the default CLI starter class.
9
+ * Added start time (�:started�) entry to the �TestBox� report section.
10
+ * �IO.popen� was replaced with the Open4 libraries. Open4 and Win32/Open3 gems were added to the dependency list.
11
+ * Scheme task and Scheme sample submission were removed due to problems with �gsi.exe� piping.
12
+
13
+ == 0.7.2 2009-23-10
14
+
15
+ * Initial release
data/Manifest.txt ADDED
@@ -0,0 +1,95 @@
1
+ Copying.txt
2
+ History.txt
3
+ Manifest.txt
4
+ PostInstall.txt
5
+ Rakefile
6
+ Readme.rdoc
7
+ bin/most
8
+ lib/most.rb
9
+ lib/most/context.rb
10
+ lib/most/core.rb
11
+ lib/most/di/container.rb
12
+ lib/most/di/proxy.rb
13
+ lib/most/di/service.rb
14
+ lib/most/di/service_factory.rb
15
+ lib/most/environment.rb
16
+ lib/most/executor.rb
17
+ lib/most/helpers/array.rb
18
+ lib/most/helpers/hash.rb
19
+ lib/most/helpers/kernel.rb
20
+ lib/most/helpers/memory_out.rb
21
+ lib/most/helpers/numeric.rb
22
+ lib/most/helpers/object.rb
23
+ lib/most/helpers/symbol.rb
24
+ lib/most/interfaces/meta_programmable.rb
25
+ lib/most/starter.rb
26
+ lib/most/structures/box.rb
27
+ lib/most/structures/submission.rb
28
+ lib/most/structures/test_case.rb
29
+ lib/most/structures/test_runner.rb
30
+ lib/most/structures/types/options.rb
31
+ lib/most/structures/types/path.rb
32
+ lib/most/structures/types/report.rb
33
+ lib/most/submissions/cpp_memory_out_sample.rb
34
+ lib/most/submissions/cpp_sample.rb
35
+ lib/most/submissions/cpp_timeout_sample.rb
36
+ lib/most/submissions/cs_sample.rb
37
+ lib/most/submissions/erlang_sample.rb
38
+ lib/most/submissions/haskell_sample.rb
39
+ lib/most/submissions/java_sample.rb
40
+ lib/most/submissions/lisp_sample.rb
41
+ lib/most/submissions/lua_sample.rb
42
+ lib/most/submissions/ocaml_sample.rb
43
+ lib/most/submissions/pascal_sample.rb
44
+ lib/most/submissions/perl_sample.rb
45
+ lib/most/submissions/php_sample.rb
46
+ lib/most/submissions/python_sample.rb
47
+ lib/most/submissions/ruby_sample.rb
48
+ lib/most/submissions/vb_sample.rb
49
+ lib/most/tasks/general/win/cs.rb
50
+ lib/most/tasks/general/win/erlang.rb
51
+ lib/most/tasks/general/win/gcc.rb
52
+ lib/most/tasks/general/win/haskell.rb
53
+ lib/most/tasks/general/win/java.rb
54
+ lib/most/tasks/general/win/lisp.rb
55
+ lib/most/tasks/general/win/lua.rb
56
+ lib/most/tasks/general/win/ocaml.rb
57
+ lib/most/tasks/general/win/pascal.rb
58
+ lib/most/tasks/general/win/perl.rb
59
+ lib/most/tasks/general/win/php.rb
60
+ lib/most/tasks/general/win/python.rb
61
+ lib/most/tasks/general/win/ruby.rb
62
+ lib/most/tasks/general/win/vb.rb
63
+ lib/most/tasks/general/win/vc.rb
64
+ lib/most/tasks/general/win/vs.rb
65
+ samples/problem/solutions/cpp/main.cpp
66
+ samples/problem/solutions/cpp/tests.yml
67
+ samples/problem/solutions/cs/main.cs
68
+ samples/problem/solutions/cs/tests.yml
69
+ samples/problem/solutions/erlang/main.erl
70
+ samples/problem/solutions/erlang/tests.yml
71
+ samples/problem/solutions/haskell/main.hs
72
+ samples/problem/solutions/haskell/tests.yml
73
+ samples/problem/solutions/java/Main.java
74
+ samples/problem/solutions/java/tests.yml
75
+ samples/problem/solutions/lisp/main.lisp
76
+ samples/problem/solutions/lisp/tests.yml
77
+ samples/problem/solutions/lua/main.lua
78
+ samples/problem/solutions/lua/tests.yml
79
+ samples/problem/solutions/ocaml/main.ml
80
+ samples/problem/solutions/ocaml/tests.yml
81
+ samples/problem/solutions/pascal/main.pas
82
+ samples/problem/solutions/pascal/tests.yml
83
+ samples/problem/solutions/perl/main.pl
84
+ samples/problem/solutions/perl/tests.yml
85
+ samples/problem/solutions/php/main.php
86
+ samples/problem/solutions/php/tests.yml
87
+ samples/problem/solutions/python/main.py
88
+ samples/problem/solutions/python/tests.yml
89
+ samples/problem/solutions/ruby/main.rb
90
+ samples/problem/solutions/ruby/tests.yml
91
+ samples/problem/solutions/vb/main.vb
92
+ samples/problem/solutions/vb/tests.yml
93
+ samples/time_memory/solutions/cpp/main.cpp
94
+ samples/time_memory/solutions/cpp/tests.yml
95
+ tasks/samples.rb
data/PostInstall.txt ADDED
@@ -0,0 +1,6 @@
1
+ Thank you for installing the Most system
2
+
3
+ Please be sure to read Readme.rdoc and History.rdoc
4
+ for useful information about this release.
5
+
6
+ For more information on Most, see http:/85.17.184.9/most
data/Rakefile ADDED
@@ -0,0 +1,44 @@
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 'rubygems'
20
+
21
+ gem 'hoe', '>= 2.1.0'
22
+ require 'hoe'
23
+
24
+ MOST_ROOT = File.expand_path(File.dirname(__FILE__))
25
+ require File.expand_path(File.join(MOST_ROOT, 'lib', 'most'))
26
+
27
+ Hoe.plugin :newgem
28
+
29
+ # Generate all the Rake tasks
30
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
31
+ $hoe = Hoe.spec Most::UNIX_NAME do
32
+ self.developer Most::AUTHOR, Most::EMAIL
33
+ self.post_install_message = File.read('PostInstall.txt')
34
+
35
+ self.extra_deps = [['sys-proctable', '>= 0.9.0'],
36
+ ['open4', '>= 1.0.1'],
37
+ ['win32-open3', '>= 0.3.1']]
38
+
39
+ self.extra_dev_deps = [['newgem', '>= 1.5.1']]
40
+ end
41
+
42
+ require 'newgem/tasks'
43
+
44
+ Dir[File.join(MOST_ROOT, 'tasks', '**', '*.{rb,task,tasks}')].each do |file| require(file) end
data/Readme.rdoc ADDED
@@ -0,0 +1,146 @@
1
+ = Most, the Core
2
+
3
+ == Description
4
+
5
+ Most is a simple academic modular open software tester.
6
+
7
+ Most, the Core is the main part of the system. Most provides
8
+ the environment and interface bridges for modules that will
9
+ implement the basic functionality of the testing system.
10
+
11
+ In general Most, the Core consists form two main interfaces:
12
+ the connector and the tester.
13
+
14
+ The connector interface offers the basic bridge to make
15
+ an implementation of a module which will act as a controlling
16
+ interface of the system. It can be a command line interface or
17
+ it can be a module which will set up a server providing a network
18
+ access for end users.
19
+
20
+ The tester interface allows building an implementation of
21
+ the software validator. By default the Most ships with
22
+ the tester compliant with the ICPC Validator Standard. The Most system
23
+ proposes to implement a testing system following this standard, but
24
+ it is not obligatory. The 3-rd party implementation can vary
25
+ significantly considering the user preferences.
26
+
27
+ It is possible to build other interface bridges using the abstract
28
+ interface classes provided by the Most system to extend
29
+ the functionality of the modules. For example the implementation of
30
+ the connector interface in the form of the network server can build
31
+ a tunnel interface bridge, so that developers can make implementations,
32
+ for example, of a SSH tunnel in order to provide a secure connection
33
+ with the testing system.
34
+
35
+ The default system bundle is shipped with a number of basic interface
36
+ implementations (modules). Please, consider taking a look on realize
37
+ notes for the list of supplied modules.
38
+
39
+ == Features:
40
+
41
+ * Test-agnostic cross-platform testing application and library
42
+ * Ruby domain specific language (DSL) interface for test specifications
43
+ * YAML support for test specs and test reports
44
+ * Support of 16 languages out of the box with the predefined Rake Task bundles for compilation and execution
45
+ * Bundled sample test specifications for each language, which can help you to write your own specs
46
+
47
+ == Requirements
48
+
49
+ * Ruby 1.8.6 or later
50
+
51
+ === Extra Dependencies
52
+
53
+ * sys-proctable (version 0.9.0 or later)
54
+
55
+ * open4 (version 1.0.1 or later) for *nix operation systems
56
+ * win32-open3 (version 0.3.1 or later) for Windows 2000 or later operation systems
57
+
58
+ === Extra Development Dependencies
59
+
60
+ * newgem (version 1.5.1 or later)
61
+
62
+ == Installation
63
+
64
+ === Gem Installation
65
+
66
+ The preferred method of the Most installation is through
67
+ the Gem file. For this you will need to have RubyGems installed.
68
+ If you have it, then you can install the system in the following way:
69
+
70
+ gem install most
71
+
72
+ Note that you must have the correspondent account privileges
73
+ on your system in order to use this commands.
74
+
75
+ For other software bundles (including links for the source code packages)
76
+ consider visiting the official page of the project.
77
+
78
+ * http://85.17.184.9/most
79
+
80
+ == Synopsis
81
+
82
+ Most can be used as a standalone command line application
83
+ or as a library.
84
+
85
+ === Library Usage
86
+
87
+ To get access to the core interface of the system you need to access
88
+ the +Core+ class by specifying its name to the +SERVICES+ dependency injection (DI) container:
89
+
90
+ require 'most'
91
+
92
+ most_core = Most::SERVICES[:core]
93
+
94
+ This will return a reference to the new +Core+ instance through which you can control the entire
95
+ testing system.
96
+
97
+ === Configuration
98
+
99
+ The default path for the configuration files is the <em>.most</em> directory under
100
+ the system user's home folder.
101
+
102
+ === Command Line Usage
103
+
104
+ The list of command line options can be obtained from the Most executable by one of the following calls:
105
+
106
+ most -h
107
+ most --help
108
+
109
+ == Development
110
+
111
+ === Source Repositories
112
+
113
+ Most is currently hosted at RubyForge and GitHub.
114
+
115
+ The RubyForge page is
116
+ * http://rubyforge.org/projects/most
117
+
118
+ The github web page is
119
+ * http://github.com/tda/most
120
+
121
+ The public git clone URL is
122
+ * http://github.com/tda/most.git
123
+
124
+ == Additional Information
125
+
126
+ Author:: Toksaitov Dmitrii Alexandrovich <toksaitov.d@gmail.com>
127
+
128
+ Project web site:: http://85.17.184.9/most
129
+ Project forum:: http://groups.google.com/group/most-system
130
+
131
+ == License
132
+
133
+ (The GNU General Public License)
134
+
135
+ Most is a simple academic modular open software tester.
136
+ Copyright (C) 2009 Toksaitov Dmitrii Alexandrovich
137
+
138
+ This program is free software: you can redistribute it and/or modify
139
+ it under the terms of the GNU General Public License as published by
140
+ the Free Software Foundation, either version 3 of the License, or
141
+ (at your option) any later version.
142
+
143
+ This program is distributed in the hope that it will be useful,
144
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
145
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
146
+ GNU General Public License for more details.
data/bin/most ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Most - Modular Open Software Tester.
4
+ # Copyright (C) 2009 Dmitrii Toksaitov
5
+ #
6
+ # This file is part of Most.
7
+ #
8
+ # Most is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # Most is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with Most. If not, see <http://www.gnu.org/licenses/>.
20
+
21
+ begin
22
+ require(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'most')))
23
+
24
+ Most::SERVICES[:starter].run()
25
+
26
+ exit_code = Most::GLOBALS[:exit_code] || 0
27
+ rescue Exception => e
28
+ exit_code = 1; puts "Fatal error: #{e.message}", e.backtrace
29
+ end
30
+
31
+ exit!(exit_code)
data/lib/most.rb ADDED
@@ -0,0 +1,52 @@
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 'rubygems'
20
+
21
+ partial_path = File.dirname(__FILE__)
22
+ full_path = File.expand_path(partial_path)
23
+
24
+ $LOAD_PATH.unshift(partial_path) unless $LOAD_PATH.include?(partial_path) or
25
+ $LOAD_PATH.include?(full_path)
26
+
27
+ require 'most/helpers/object'
28
+ require 'most/helpers/numeric'
29
+ require 'most/helpers/kernel'
30
+ require 'most/helpers/array'
31
+ require 'most/helpers/symbol'
32
+ require 'most/helpers/hash'
33
+
34
+ require 'most/interfaces/meta_programmable'
35
+
36
+ module Most
37
+ FULL_NAME = 'Most, the Core'
38
+ UNIX_NAME = 'most'
39
+ VERSION = '0.7.3'
40
+
41
+ AUTHOR = 'Toksaitov Dmitrii Alexandrovich'
42
+
43
+ EMAIL = "#{UNIX_NAME}.support@85.17.184.9"
44
+ URL = "http://85.17.184.9/#{UNIX_NAME}"
45
+
46
+ COPYRIGHT = "Copyright (C) 2009 #{AUTHOR}"
47
+
48
+ USER_BASE_DIRECTORY = ENV['MOST_USER_BASE'] || File.join('~', ".#{UNIX_NAME}")
49
+ GLOBALS = {}
50
+ end
51
+
52
+ require 'most/context'
@@ -0,0 +1,244 @@
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 'most/di/container'
20
+
21
+ module Most
22
+ DIRECTORIES = DI::Container.new do
23
+ asset :user_base do
24
+ path = File.expand_path(USER_BASE_DIRECTORY)
25
+
26
+ Dir.mkdir(path) unless File.directory?(path)
27
+
28
+ path
29
+ end
30
+
31
+ asset :submissions do
32
+ paths = []
33
+
34
+ paths << File.expand_path(File.join(File.dirname(__FILE__), 'submissions'))
35
+ paths << File.expand_path(File.join(DIRECTORIES[:user_base], 'submissions'))
36
+
37
+ Dir.mkdir(paths.last) unless File.directory?(paths.last) rescue nil
38
+
39
+ paths
40
+ end
41
+
42
+ asset :tasks do
43
+ paths = []
44
+
45
+ paths << File.expand_path(File.join(File.dirname(__FILE__), 'tasks'))
46
+ paths << File.expand_path(File.join(DIRECTORIES[:user_base], 'tasks'))
47
+
48
+ Dir.mkdir(paths.last) unless File.directory?(paths.last) rescue nil
49
+
50
+ paths
51
+ end
52
+
53
+ asset :vendors do
54
+ path = File.expand_path(File.join(DIRECTORIES[:user_base], 'vendors'))
55
+
56
+ Dir.mkdir(path) unless File.directory?(path) rescue nil
57
+
58
+ result = path.nil? ? [] : path.to_a()
59
+ end
60
+
61
+ asset :temp do
62
+ path = File.expand_path(File.join(DIRECTORIES[:user_base], 'temp'))
63
+
64
+ Dir.mkdir(path) unless File.directory?(path) rescue nil
65
+
66
+ result = path.nil? ? [] : path.to_a()
67
+ end
68
+ end
69
+
70
+ FILES = DI::Container.new do
71
+ asset :log do
72
+ File.join(DIRECTORIES[:user_base], 'application.log')
73
+ end
74
+
75
+ asset :options do
76
+ File.join(DIRECTORIES[:user_base], 'options.yml')
77
+ end
78
+
79
+ asset :modes do
80
+ File.join(DIRECTORIES[:user_base], 'modes.yml')
81
+ end
82
+ end
83
+
84
+ SERVICES = DI::Container.new do
85
+ service :environment do
86
+ on_creation do
87
+ require 'most/environment'; Environment.instance()
88
+ end
89
+
90
+ interface :log_error do |instance, exception, message|
91
+ instance.log_error(exception, message)
92
+ end
93
+
94
+ interface :log_warning do |instance, text|
95
+ instance.log_warning(text)
96
+ end
97
+
98
+ interface :log_message do |instance, text|
99
+ instance.log_message(text)
100
+ end
101
+
102
+ interface :show_message do |instance, text, is_log_data|
103
+ instance.show_message(text, is_log_data)
104
+ end
105
+ end
106
+
107
+ service :starter do
108
+ on_creation do
109
+ require 'most/starter'; Starter.new()
110
+ end
111
+
112
+ interface :run do |instance|
113
+ instance.run()
114
+ end
115
+
116
+ interface :usage do |instance|
117
+ instance.options
118
+ end
119
+ end
120
+
121
+ service :core do
122
+ on_creation do
123
+ require 'most/core'; Core.new()
124
+ end
125
+
126
+ interface :run do |instance|
127
+ instance.run()
128
+ end
129
+ end
130
+
131
+ service :executor do
132
+ on_creation do
133
+ require 'most/executor'; Executor.new()
134
+ end
135
+
136
+ interface :run do |instance|
137
+ instance.run()
138
+ end
139
+ end
140
+
141
+ service :logger do
142
+ on_creation do
143
+ require 'logger'
144
+
145
+ logger = Logger.new(FILES[:log], 10, 1048576)
146
+
147
+ logger.level = Logger::INFO
148
+
149
+ logger
150
+ end
151
+
152
+ interface :error do |instance, message|
153
+ instance.error(message)
154
+ end
155
+
156
+ interface :warn do |instance, message|
157
+ instance.warn(message)
158
+ end
159
+
160
+ interface :info do |instance, message|
161
+ instance.info(message)
162
+ end
163
+ end
164
+
165
+ service :diff do
166
+ on_creation do
167
+ begin
168
+ require('diff/lcs'); Diff::LCS
169
+ rescue nil; end
170
+ end
171
+
172
+ interface :diff do |instance, first_sequence, second_sequence|
173
+ instance.diff(first_sequence, second_sequence)
174
+ end
175
+ end
176
+
177
+ service :open4 do
178
+ on_creation do
179
+ if RUBY_PLATFORM.downcase.include?("mswin")
180
+ require 'win32/open3'; Open4
181
+ else
182
+ require 'open4'; Open4
183
+ end
184
+ end
185
+
186
+ interface :popen4 do |instance, args, block|
187
+ instance.popen4(*args, &block)
188
+ end
189
+ end
190
+
191
+ service :process_table do
192
+ on_creation do
193
+ require 'sys/proctable'; Sys::ProcTable
194
+ end
195
+
196
+ interface :info do |instance, pid|
197
+ result = instance.ps(pid)
198
+ end
199
+
200
+ interface :memory do |instance, pid|
201
+ result = 0
202
+
203
+ if RUBY_PLATFORM.downcase.include?("mswin")
204
+ result = instance.ps(pid).working_set_size
205
+ else
206
+ result = instance.ps(pid).size
207
+ end
208
+
209
+ result
210
+ end
211
+
212
+ interface :virtual_memory do |instance, pid|
213
+ result = 0
214
+
215
+ if RUBY_PLATFORM.downcase.include?("mswin")
216
+ result = instance.ps(pid).page_file_usage
217
+ else
218
+ result = instance.ps(pid).rss
219
+ end
220
+
221
+ result
222
+ end
223
+ end
224
+ end
225
+
226
+ PARAMETERS = DI::Container.new do
227
+ asset :options, :file => FILES[:options] do
228
+ {:submission => nil,
229
+ :submission_parameters => [],
230
+ :output_file => nil}
231
+ end
232
+
233
+ asset :modes, :file => FILES[:modes] do
234
+ {:verbose => false,
235
+ :quiet => false,
236
+ :debug => false}
237
+ end
238
+
239
+ asset :tasks do
240
+ {:show_version => false,
241
+ :show_help => false}
242
+ end
243
+ end
244
+ end