activesambaldap 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. data/Gemfile +21 -0
  2. data/NEWS.en +1 -1
  3. data/NEWS.ja +1 -1
  4. data/README.en +12 -8
  5. data/README.ja +6 -3
  6. data/Rakefile +27 -121
  7. data/lib/active_samba_ldap.rb +1 -1
  8. data/lib/active_samba_ldap/get_text_support.rb +1 -1
  9. data/lib/active_samba_ldap/version.rb +1 -1
  10. data/license/lgpl-2.1.txt +165 -0
  11. data/po/ja/active-samba-ldap.po +2 -2
  12. data/test/run-test.rb +3 -3
  13. metadata +145 -277
  14. data/bin/asl-groupadd.help +0 -16
  15. data/bin/asl-groupdel.help +0 -13
  16. data/bin/asl-groupmod.help +0 -19
  17. data/bin/asl-groupshow.help +0 -11
  18. data/bin/asl-passwd.help +0 -15
  19. data/bin/asl-populate.help +0 -28
  20. data/bin/asl-purge.help +0 -11
  21. data/bin/asl-samba-computeradd.help +0 -13
  22. data/bin/asl-samba-groupadd.help +0 -11
  23. data/bin/asl-samba-groupdel.help +0 -11
  24. data/bin/asl-samba-groupmod.help +0 -15
  25. data/bin/asl-samba-useradd.help +0 -13
  26. data/bin/asl-samba-userdel.help +0 -11
  27. data/bin/asl-samba-usermod.help +0 -15
  28. data/bin/asl-useradd.help +0 -49
  29. data/bin/asl-userdel.help +0 -18
  30. data/bin/asl-usermod.help +0 -47
  31. data/bin/asl-usershow.help +0 -11
  32. data/data/locale/ja/LC_MESSAGES/active-samba-ldap.mo +0 -0
  33. data/example/asl-admin/README +0 -243
  34. data/example/asl-admin/Rakefile +0 -10
  35. data/example/asl-admin/app/controllers/application_controller.rb +0 -10
  36. data/example/asl-admin/app/controllers/samba_controller.rb +0 -12
  37. data/example/asl-admin/app/helpers/application_helper.rb +0 -3
  38. data/example/asl-admin/app/helpers/samba_helper.rb +0 -2
  39. data/example/asl-admin/app/models/computer.rb +0 -3
  40. data/example/asl-admin/app/models/dc.rb +0 -3
  41. data/example/asl-admin/app/models/group.rb +0 -3
  42. data/example/asl-admin/app/models/idmap.rb +0 -3
  43. data/example/asl-admin/app/models/ou.rb +0 -3
  44. data/example/asl-admin/app/models/unix_id_pool.rb +0 -3
  45. data/example/asl-admin/app/models/user.rb +0 -3
  46. data/example/asl-admin/app/views/samba/index.html.erb +0 -17
  47. data/example/asl-admin/app/views/samba/populate.html.erb +0 -15
  48. data/example/asl-admin/app/views/samba/purge.html.erb +0 -10
  49. data/example/asl-admin/config/boot.rb +0 -110
  50. data/example/asl-admin/config/database.yml +0 -22
  51. data/example/asl-admin/config/environment.rb +0 -48
  52. data/example/asl-admin/config/environments/development.rb +0 -17
  53. data/example/asl-admin/config/environments/production.rb +0 -28
  54. data/example/asl-admin/config/environments/test.rb +0 -28
  55. data/example/asl-admin/config/initializers/backtrace_silencers.rb +0 -7
  56. data/example/asl-admin/config/initializers/inflections.rb +0 -10
  57. data/example/asl-admin/config/initializers/mime_types.rb +0 -5
  58. data/example/asl-admin/config/initializers/new_rails_defaults.rb +0 -19
  59. data/example/asl-admin/config/initializers/session_store.rb +0 -15
  60. data/example/asl-admin/config/ldap.yml.sample +0 -24
  61. data/example/asl-admin/config/locales/en.yml +0 -5
  62. data/example/asl-admin/config/routes.rb +0 -43
  63. data/example/asl-admin/log/test.log +0 -5
  64. data/example/asl-admin/public/404.html +0 -30
  65. data/example/asl-admin/public/422.html +0 -30
  66. data/example/asl-admin/public/500.html +0 -30
  67. data/example/asl-admin/public/favicon.ico +0 -0
  68. data/example/asl-admin/public/images/rails.png +0 -0
  69. data/example/asl-admin/public/index.html +0 -275
  70. data/example/asl-admin/public/javascripts/application.js +0 -2
  71. data/example/asl-admin/public/javascripts/controls.js +0 -963
  72. data/example/asl-admin/public/javascripts/dragdrop.js +0 -973
  73. data/example/asl-admin/public/javascripts/effects.js +0 -1128
  74. data/example/asl-admin/public/javascripts/prototype.js +0 -4320
  75. data/example/asl-admin/public/robots.txt +0 -5
  76. data/example/asl-admin/script/about +0 -4
  77. data/example/asl-admin/script/console +0 -3
  78. data/example/asl-admin/script/dbconsole +0 -3
  79. data/example/asl-admin/script/destroy +0 -3
  80. data/example/asl-admin/script/generate +0 -3
  81. data/example/asl-admin/script/performance/benchmarker +0 -3
  82. data/example/asl-admin/script/performance/profiler +0 -3
  83. data/example/asl-admin/script/plugin +0 -3
  84. data/example/asl-admin/script/runner +0 -3
  85. data/example/asl-admin/script/server +0 -3
  86. data/example/asl-admin/test/performance/browsing_test.rb +0 -9
  87. data/example/asl-admin/test/test_helper.rb +0 -38
  88. data/po/active-samba-ldap.pot +0 -463
  89. data/rails_generators/scaffold_active_samba_ldap/scaffold_active_samba_ldap_generator.rb +0 -28
  90. data/rails_generators/scaffold_active_samba_ldap/templates/computer.rb +0 -3
  91. data/rails_generators/scaffold_active_samba_ldap/templates/dc.rb +0 -3
  92. data/rails_generators/scaffold_active_samba_ldap/templates/group.rb +0 -3
  93. data/rails_generators/scaffold_active_samba_ldap/templates/idmap.rb +0 -3
  94. data/rails_generators/scaffold_active_samba_ldap/templates/ldap.yml +0 -24
  95. data/rails_generators/scaffold_active_samba_ldap/templates/ou.rb +0 -3
  96. data/rails_generators/scaffold_active_samba_ldap/templates/samba_controller.rb +0 -12
  97. data/rails_generators/scaffold_active_samba_ldap/templates/samba_helper.rb +0 -2
  98. data/rails_generators/scaffold_active_samba_ldap/templates/samba_index.html.erb +0 -17
  99. data/rails_generators/scaffold_active_samba_ldap/templates/samba_populate.html.erb +0 -15
  100. data/rails_generators/scaffold_active_samba_ldap/templates/samba_purge.html.erb +0 -10
  101. data/rails_generators/scaffold_active_samba_ldap/templates/unix_id_pool.rb +0 -3
  102. data/rails_generators/scaffold_active_samba_ldap/templates/user.rb +0 -3
  103. data/setup.rb +0 -1585
  104. data/test-unit/History.txt +0 -107
  105. data/test-unit/README.txt +0 -52
  106. data/test-unit/Rakefile +0 -40
  107. data/test-unit/TODO +0 -5
  108. data/test-unit/bin/testrb +0 -5
  109. data/test-unit/lib/test/unit.rb +0 -342
  110. data/test-unit/lib/test/unit/assertionfailederror.rb +0 -14
  111. data/test-unit/lib/test/unit/assertions.rb +0 -1149
  112. data/test-unit/lib/test/unit/attribute.rb +0 -125
  113. data/test-unit/lib/test/unit/autorunner.rb +0 -344
  114. data/test-unit/lib/test/unit/collector.rb +0 -43
  115. data/test-unit/lib/test/unit/collector/descendant.rb +0 -23
  116. data/test-unit/lib/test/unit/collector/dir.rb +0 -108
  117. data/test-unit/lib/test/unit/collector/load.rb +0 -137
  118. data/test-unit/lib/test/unit/collector/objectspace.rb +0 -34
  119. data/test-unit/lib/test/unit/color-scheme.rb +0 -90
  120. data/test-unit/lib/test/unit/color.rb +0 -96
  121. data/test-unit/lib/test/unit/diff.rb +0 -538
  122. data/test-unit/lib/test/unit/error.rb +0 -126
  123. data/test-unit/lib/test/unit/exceptionhandler.rb +0 -39
  124. data/test-unit/lib/test/unit/failure.rb +0 -110
  125. data/test-unit/lib/test/unit/fixture.rb +0 -176
  126. data/test-unit/lib/test/unit/notification.rb +0 -125
  127. data/test-unit/lib/test/unit/omission.rb +0 -143
  128. data/test-unit/lib/test/unit/pending.rb +0 -146
  129. data/test-unit/lib/test/unit/priority.rb +0 -181
  130. data/test-unit/lib/test/unit/runner/console.rb +0 -52
  131. data/test-unit/lib/test/unit/runner/emacs.rb +0 -8
  132. data/test-unit/lib/test/unit/runner/tap.rb +0 -8
  133. data/test-unit/lib/test/unit/testcase.rb +0 -425
  134. data/test-unit/lib/test/unit/testresult.rb +0 -89
  135. data/test-unit/lib/test/unit/testsuite.rb +0 -110
  136. data/test-unit/lib/test/unit/ui/console/outputlevel.rb +0 -14
  137. data/test-unit/lib/test/unit/ui/console/testrunner.rb +0 -278
  138. data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +0 -49
  139. data/test-unit/lib/test/unit/ui/tap/testrunner.rb +0 -92
  140. data/test-unit/lib/test/unit/ui/testrunner.rb +0 -20
  141. data/test-unit/lib/test/unit/ui/testrunnermediator.rb +0 -77
  142. data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +0 -41
  143. data/test-unit/lib/test/unit/util/backtracefilter.rb +0 -41
  144. data/test-unit/lib/test/unit/util/method-owner-finder.rb +0 -28
  145. data/test-unit/lib/test/unit/util/observable.rb +0 -90
  146. data/test-unit/lib/test/unit/util/procwrapper.rb +0 -48
  147. data/test-unit/lib/test/unit/version.rb +0 -7
  148. data/test-unit/sample/adder.rb +0 -13
  149. data/test-unit/sample/subtracter.rb +0 -12
  150. data/test-unit/sample/tc_adder.rb +0 -18
  151. data/test-unit/sample/tc_subtracter.rb +0 -18
  152. data/test-unit/sample/test_user.rb +0 -22
  153. data/test-unit/sample/ts_examples.rb +0 -7
  154. data/test-unit/test/collector/test-descendant.rb +0 -135
  155. data/test-unit/test/collector/test-load.rb +0 -329
  156. data/test-unit/test/collector/test_dir.rb +0 -406
  157. data/test-unit/test/collector/test_objectspace.rb +0 -98
  158. data/test-unit/test/run-test.rb +0 -13
  159. data/test-unit/test/test-attribute.rb +0 -86
  160. data/test-unit/test/test-color-scheme.rb +0 -60
  161. data/test-unit/test/test-color.rb +0 -47
  162. data/test-unit/test/test-diff.rb +0 -477
  163. data/test-unit/test/test-emacs-runner.rb +0 -60
  164. data/test-unit/test/test-fixture.rb +0 -287
  165. data/test-unit/test/test-notification.rb +0 -33
  166. data/test-unit/test/test-omission.rb +0 -81
  167. data/test-unit/test/test-pending.rb +0 -70
  168. data/test-unit/test/test-priority.rb +0 -119
  169. data/test-unit/test/test-testcase.rb +0 -507
  170. data/test-unit/test/test_assertions.rb +0 -1082
  171. data/test-unit/test/test_error.rb +0 -26
  172. data/test-unit/test/test_failure.rb +0 -33
  173. data/test-unit/test/test_testresult.rb +0 -113
  174. data/test-unit/test/test_testsuite.rb +0 -129
  175. data/test-unit/test/testunit-test-util.rb +0 -14
  176. data/test-unit/test/ui/test_testrunmediator.rb +0 -20
  177. data/test-unit/test/util/test-method-owner-finder.rb +0 -38
  178. data/test-unit/test/util/test_backtracefilter.rb +0 -41
  179. data/test-unit/test/util/test_observable.rb +0 -102
  180. data/test-unit/test/util/test_procwrapper.rb +0 -36
@@ -1,125 +0,0 @@
1
- module Test
2
- module Unit
3
- module Attribute
4
- class << self
5
- def included(base)
6
- base.extend(BaseClassMethods)
7
- base.extend(ClassMethods)
8
- end
9
- end
10
-
11
- module BaseClassMethods
12
- def attributes_table
13
- {}
14
- end
15
- end
16
-
17
- module ClassMethods
18
- def method_added(name)
19
- super
20
- return unless defined?(@current_attributes)
21
-
22
- attributes = {}
23
- kept_attributes = {}
24
- @current_attributes.each do |attribute_name, attribute|
25
- attributes[attribute_name] = attribute[:value]
26
- kept_attributes[attribute_name] = attribute if attribute[:keep]
27
- end
28
- set_attributes(name, attributes)
29
- @current_attributes = kept_attributes
30
- end
31
-
32
- def attribute(name, value, options={}, *method_names)
33
- unless options.is_a?(Hash)
34
- method_names << options
35
- options = {}
36
- end
37
- @current_attributes ||= {}
38
- if method_names.empty?
39
- @current_attributes[name] = options.merge(:value => value)
40
- else
41
- method_names.each do |method_name|
42
- set_attributes(method_name, {name => value})
43
- end
44
- end
45
- end
46
-
47
- def attributes_table
48
- @attributes_table ||= {}
49
- super.merge(@attributes_table)
50
- end
51
-
52
- def set_attributes(method_name, new_attributes)
53
- return if new_attributes.empty?
54
- method_name = normalize_method_name(method_name)
55
- @attributes_table ||= {}
56
- @attributes_table[method_name] ||= {}
57
- current_attributes = @attributes_table[method_name]
58
- new_attributes.each do |key, value|
59
- key = normalize_attribute_name(key)
60
- observers = attribute_observers(key) || []
61
- observers.each do |observer|
62
- observer.call(self,
63
- key,
64
- (attributes(method_name) || {})[key],
65
- value,
66
- method_name)
67
- end
68
- current_attributes[key] = value
69
- end
70
- end
71
-
72
- def attributes(method_name)
73
- method_name = normalize_method_name(method_name)
74
- attributes = attributes_table[method_name]
75
- ancestors[1..-1].each do |ancestor|
76
- if ancestor.is_a?(Class) and ancestor < Test::Unit::Attribute
77
- parent_attributes = ancestor.attributes(method_name)
78
- if attributes
79
- attributes = (parent_attributes || {}).merge(attributes)
80
- else
81
- attributes = parent_attributes
82
- end
83
- break
84
- end
85
- end
86
- attributes
87
- end
88
-
89
- def get_attribute(method_name, attribute_name)
90
- attribute_name = normalize_attribute_name(attribute_name)
91
- (attributes(method_name) || {})[attribute_name]
92
- end
93
-
94
- @@attribute_observers = {}
95
- def register_attribute_observer(attribute_name, observer=Proc.new)
96
- attribute_name = normalize_attribute_name(attribute_name)
97
- @@attribute_observers[attribute_name] ||= []
98
- @@attribute_observers[attribute_name] << observer
99
- end
100
-
101
- def attribute_observers(attribute_name)
102
- attribute_name = normalize_attribute_name(attribute_name)
103
- @@attribute_observers[attribute_name]
104
- end
105
-
106
- private
107
- def normalize_attribute_name(name)
108
- name.to_s
109
- end
110
-
111
- def normalize_method_name(name)
112
- name.to_s
113
- end
114
- end
115
-
116
- def attributes
117
- self.class.attributes(@method_name) || {}
118
- end
119
-
120
- def [](name)
121
- self.class.get_attribute(@method_name, name)
122
- end
123
- end
124
- end
125
- end
@@ -1,344 +0,0 @@
1
- require 'test/unit/color-scheme'
2
- require 'optparse'
3
-
4
- module Test
5
- module Unit
6
- class AutoRunner
7
- RUNNERS = {}
8
- COLLECTORS = {}
9
- ADDITIONAL_OPTIONS = []
10
-
11
- class << self
12
- def register_runner(id, runner_builder=Proc.new)
13
- RUNNERS[id] = runner_builder
14
- RUNNERS[id.to_s] = runner_builder
15
- end
16
-
17
- def runner(id)
18
- RUNNERS[id.to_s]
19
- end
20
-
21
- def register_collector(id, collector_builder=Proc.new)
22
- COLLECTORS[id] = collector_builder
23
- COLLECTORS[id.to_s] = collector_builder
24
- end
25
-
26
- def collector(id)
27
- COLLECTORS[id.to_s]
28
- end
29
-
30
- def register_color_scheme(id, scheme)
31
- ColorScheme[id] = scheme
32
- end
33
-
34
- def setup_option(option_builder=Proc.new)
35
- ADDITIONAL_OPTIONS << option_builder
36
- end
37
- end
38
-
39
- def self.run(force_standalone=false, default_dir=nil, argv=ARGV, &block)
40
- r = new(force_standalone || standalone?, &block)
41
- r.base = default_dir
42
- r.process_args(argv)
43
- r.run
44
- end
45
-
46
- def self.standalone?
47
- return false unless("-e" == $0)
48
- ObjectSpace.each_object(Class) do |klass|
49
- return false if(klass < TestCase)
50
- end
51
- true
52
- end
53
-
54
- register_collector(:descendant) do |auto_runner|
55
- require 'test/unit/collector/descendant'
56
- collector = Collector::Descendant.new
57
- collector.filter = auto_runner.filters
58
- collector.collect($0.sub(/\.rb\Z/, ''))
59
- end
60
-
61
- register_collector(:load) do |auto_runner|
62
- require 'test/unit/collector/load'
63
- collector = Collector::Load.new
64
- collector.patterns.concat(auto_runner.pattern) if auto_runner.pattern
65
- collector.excludes.concat(auto_runner.exclude) if auto_runner.exclude
66
- collector.base = auto_runner.base
67
- collector.filter = auto_runner.filters
68
- collector.collect(*auto_runner.to_run)
69
- end
70
-
71
- # deprecated
72
- register_collector(:object_space) do |auto_runner|
73
- require 'test/unit/collector/objectspace'
74
- c = Collector::ObjectSpace.new
75
- c.filter = auto_runner.filters
76
- c.collect($0.sub(/\.rb\Z/, ''))
77
- end
78
-
79
- # deprecated
80
- register_collector(:dir) do |auto_runner|
81
- require 'test/unit/collector/dir'
82
- c = Collector::Dir.new
83
- c.filter = auto_runner.filters
84
- c.pattern.concat(auto_runner.pattern) if auto_runner.pattern
85
- c.exclude.concat(auto_runner.exclude) if auto_runner.exclude
86
- c.base = auto_runner.base
87
- $:.push(auto_runner.base) if auto_runner.base
88
- c.collect(*(auto_runner.to_run.empty? ? ['.'] : auto_runner.to_run))
89
- end
90
-
91
- attr_reader :suite, :runner_options
92
- attr_accessor :filters, :to_run, :pattern, :exclude, :base, :workdir
93
- attr_accessor :color_scheme
94
- attr_writer :runner, :collector
95
-
96
- def initialize(standalone)
97
- Unit.run = true
98
- @standalone = standalone
99
- @runner = default_runner
100
- @collector = default_collector
101
- @filters = []
102
- @to_run = []
103
- @color_scheme = ColorScheme.default
104
- @runner_options = {}
105
- @default_arguments = []
106
- @workdir = nil
107
- config_file = "test-unit.yml"
108
- if File.exist?(config_file)
109
- load_config(config_file)
110
- else
111
- global_config_file = File.expand_path("~/.test-unit.xml")
112
- load_config(global_config_file) if File.exist?(global_config_file)
113
- end
114
- yield(self) if block_given?
115
- end
116
-
117
- def process_args(args = ARGV)
118
- default_arguments = @default_arguments.dup
119
- begin
120
- @default_arguments.concat(args)
121
- options.order!(@default_arguments) {|arg| @to_run << arg}
122
- rescue OptionParser::ParseError => e
123
- puts e
124
- puts options
125
- exit(false)
126
- else
127
- @filters << proc{false} unless(@filters.empty?)
128
- end
129
- not @to_run.empty?
130
- ensure
131
- @default_arguments = default_arguments
132
- end
133
-
134
- def options
135
- @options ||= OptionParser.new do |o|
136
- o.banner = "Test::Unit automatic runner."
137
- o.banner << "\nUsage: #{$0} [options] [-- untouched arguments]"
138
-
139
- o.on
140
- o.on('-r', '--runner=RUNNER', RUNNERS,
141
- "Use the given RUNNER.",
142
- "(" + keyword_display(RUNNERS) + ")") do |r|
143
- @runner = r
144
- end
145
-
146
- if (@standalone)
147
- o.on('-b', '--basedir=DIR', "Base directory of test suites.") do |b|
148
- @base = b
149
- end
150
-
151
- o.on('-w', '--workdir=DIR', "Working directory to run tests.") do |w|
152
- @workdir = w
153
- end
154
-
155
- o.on('-a', '--add=TORUN', Array,
156
- "Add TORUN to the list of things to run;",
157
- "can be a file or a directory.") do |a|
158
- @to_run.concat(a)
159
- end
160
-
161
- @pattern = []
162
- o.on('-p', '--pattern=PATTERN', Regexp,
163
- "Match files to collect against PATTERN.") do |e|
164
- @pattern << e
165
- end
166
-
167
- @exclude = []
168
- o.on('-x', '--exclude=PATTERN', Regexp,
169
- "Ignore files to collect against PATTERN.") do |e|
170
- @exclude << e
171
- end
172
- end
173
-
174
- o.on('-n', '--name=NAME', String,
175
- "Runs tests matching NAME.",
176
- "(patterns may be used).") do |n|
177
- n = (%r{\A/(.*)/\Z} =~ n ? Regexp.new($1) : n)
178
- case n
179
- when Regexp
180
- @filters << proc{|t| n =~ t.method_name ? true : nil}
181
- else
182
- @filters << proc{|t| n == t.method_name ? true : nil}
183
- end
184
- end
185
-
186
- o.on('-t', '--testcase=TESTCASE', String,
187
- "Runs tests in TestCases matching TESTCASE.",
188
- "(patterns may be used).") do |n|
189
- n = (%r{\A/(.*)/\Z} =~ n ? Regexp.new($1) : n)
190
- case n
191
- when Regexp
192
- @filters << proc{|t| n =~ t.class.name ? true : nil}
193
- else
194
- @filters << proc{|t| n == t.class.name ? true : nil}
195
- end
196
- end
197
-
198
- priority_filter = Proc.new do |test|
199
- if @filters.size > 2
200
- nil
201
- else
202
- Priority::Checker.new(test).need_to_run? or nil
203
- end
204
- end
205
- o.on("--[no-]priority-mode",
206
- "Runs some tests based on their priority.") do |priority_mode|
207
- if priority_mode
208
- Priority.enable
209
- @filters |= [priority_filter]
210
- else
211
- Priority.disable
212
- @filters -= [priority_filter]
213
- end
214
- end
215
-
216
- o.on("--default-priority=PRIORITY",
217
- Priority.available_values,
218
- "Uses PRIORITY as default priority",
219
- "(#{keyword_display(Priority.available_values)})") do |priority|
220
- Priority.default = priority
221
- end
222
-
223
- o.on('-I', "--load-path=DIR[#{File::PATH_SEPARATOR}DIR...]",
224
- "Appends directory list to $LOAD_PATH.") do |dirs|
225
- $LOAD_PATH.concat(dirs.split(File::PATH_SEPARATOR))
226
- end
227
-
228
- color_schemes = ColorScheme.all
229
- o.on("--color-scheme=SCHEME", color_schemes,
230
- "Use SCHEME as color scheme.",
231
- "(#{keyword_display(color_schemes)})") do |scheme|
232
- @color_scheme = scheme
233
- end
234
-
235
- o.on("--config=FILE",
236
- "Use YAML fomat FILE content as configuration file.") do |file|
237
- load_config(file)
238
- end
239
-
240
- o.on("--order=ORDER", TestCase::AVAILABLE_ORDERS,
241
- "Run tests in a test case in ORDER order.",
242
- "(#{keyword_display(TestCase::AVAILABLE_ORDERS)})") do |order|
243
- TestCase.test_order = order
244
- end
245
-
246
- ADDITIONAL_OPTIONS.each do |option_builder|
247
- option_builder.call(self, o)
248
- end
249
-
250
- o.on('--',
251
- "Stop processing options so that the",
252
- "remaining options will be passed to the",
253
- "test."){o.terminate}
254
-
255
- o.on('-h', '--help', 'Display this help.'){puts o; exit}
256
-
257
- o.on_tail
258
- o.on_tail('Deprecated options:')
259
-
260
- o.on_tail('--console', 'Console runner (use --runner).') do
261
- warn("Deprecated option (--console).")
262
- @runner = self.class.runner(:console)
263
- end
264
-
265
- if RUNNERS[:fox]
266
- o.on_tail('--fox', 'Fox runner (use --runner).') do
267
- warn("Deprecated option (--fox).")
268
- @runner = self.class.runner(:fox)
269
- end
270
- end
271
-
272
- o.on_tail
273
- end
274
- end
275
-
276
- def keyword_display(keywords)
277
- keywords = keywords.collect do |keyword, _|
278
- keyword.to_s
279
- end.uniq.sort
280
-
281
- i = 0
282
- keywords.collect do |keyword|
283
- if (i > 0 and keyword[0] == keywords[i - 1][0]) or
284
- ((i < keywords.size - 1) and (keyword[0] == keywords[i + 1][0]))
285
- n = 2
286
- else
287
- n = 1
288
- end
289
- i += 1
290
- keyword.sub(/^(.{#{n}})([A-Za-z]+)(?=\w*$)/, '\\1[\\2]')
291
- end.join(", ")
292
- end
293
-
294
- def run
295
- suite = @collector[self]
296
- return false if suite.nil?
297
- runner = @runner[self]
298
- return false if runner.nil?
299
- @runner_options[:color_scheme] ||= @color_scheme
300
- Dir.chdir(@workdir) if @workdir
301
- runner.run(suite, @runner_options).passed?
302
- end
303
-
304
- def load_config(file)
305
- require 'yaml'
306
- config = YAML.load(File.read(file))
307
- runner_name = config["runner"]
308
- @runner = self.class.runner(runner_name) || @runner
309
- @collector = self.class.collector(config["collector"]) || @collector
310
- (config["color_schemes"] || {}).each do |name, options|
311
- ColorScheme[name] = options
312
- end
313
- runner_options = {}
314
- (config["#{runner_name}_options"] || {}).each do |key, value|
315
- key = key.to_sym
316
- value = ColorScheme[value] if key == :color_scheme
317
- if key == :arguments
318
- @default_arguments.concat(value.split)
319
- else
320
- runner_options[key.to_sym] = value
321
- end
322
- end
323
- @runner_options = @runner_options.merge(runner_options)
324
- end
325
-
326
- private
327
- def default_runner
328
- if ENV["EMACS"] == "t"
329
- self.class.runner(:emacs)
330
- else
331
- self.class.runner(:console)
332
- end
333
- end
334
-
335
- def default_collector
336
- self.class.collector(@standalone ? :load : :descendant)
337
- end
338
- end
339
- end
340
- end
341
-
342
- require 'test/unit/runner/console'
343
- require 'test/unit/runner/emacs'
344
- require 'test/unit/runner/tap'