activesambaldap 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +21 -0
- data/NEWS.en +1 -1
- data/NEWS.ja +1 -1
- data/README.en +12 -8
- data/README.ja +6 -3
- data/Rakefile +27 -121
- data/lib/active_samba_ldap.rb +1 -1
- data/lib/active_samba_ldap/get_text_support.rb +1 -1
- data/lib/active_samba_ldap/version.rb +1 -1
- data/license/lgpl-2.1.txt +165 -0
- data/po/ja/active-samba-ldap.po +2 -2
- data/test/run-test.rb +3 -3
- metadata +145 -277
- data/bin/asl-groupadd.help +0 -16
- data/bin/asl-groupdel.help +0 -13
- data/bin/asl-groupmod.help +0 -19
- data/bin/asl-groupshow.help +0 -11
- data/bin/asl-passwd.help +0 -15
- data/bin/asl-populate.help +0 -28
- data/bin/asl-purge.help +0 -11
- data/bin/asl-samba-computeradd.help +0 -13
- data/bin/asl-samba-groupadd.help +0 -11
- data/bin/asl-samba-groupdel.help +0 -11
- data/bin/asl-samba-groupmod.help +0 -15
- data/bin/asl-samba-useradd.help +0 -13
- data/bin/asl-samba-userdel.help +0 -11
- data/bin/asl-samba-usermod.help +0 -15
- data/bin/asl-useradd.help +0 -49
- data/bin/asl-userdel.help +0 -18
- data/bin/asl-usermod.help +0 -47
- data/bin/asl-usershow.help +0 -11
- data/data/locale/ja/LC_MESSAGES/active-samba-ldap.mo +0 -0
- data/example/asl-admin/README +0 -243
- data/example/asl-admin/Rakefile +0 -10
- data/example/asl-admin/app/controllers/application_controller.rb +0 -10
- data/example/asl-admin/app/controllers/samba_controller.rb +0 -12
- data/example/asl-admin/app/helpers/application_helper.rb +0 -3
- data/example/asl-admin/app/helpers/samba_helper.rb +0 -2
- data/example/asl-admin/app/models/computer.rb +0 -3
- data/example/asl-admin/app/models/dc.rb +0 -3
- data/example/asl-admin/app/models/group.rb +0 -3
- data/example/asl-admin/app/models/idmap.rb +0 -3
- data/example/asl-admin/app/models/ou.rb +0 -3
- data/example/asl-admin/app/models/unix_id_pool.rb +0 -3
- data/example/asl-admin/app/models/user.rb +0 -3
- data/example/asl-admin/app/views/samba/index.html.erb +0 -17
- data/example/asl-admin/app/views/samba/populate.html.erb +0 -15
- data/example/asl-admin/app/views/samba/purge.html.erb +0 -10
- data/example/asl-admin/config/boot.rb +0 -110
- data/example/asl-admin/config/database.yml +0 -22
- data/example/asl-admin/config/environment.rb +0 -48
- data/example/asl-admin/config/environments/development.rb +0 -17
- data/example/asl-admin/config/environments/production.rb +0 -28
- data/example/asl-admin/config/environments/test.rb +0 -28
- data/example/asl-admin/config/initializers/backtrace_silencers.rb +0 -7
- data/example/asl-admin/config/initializers/inflections.rb +0 -10
- data/example/asl-admin/config/initializers/mime_types.rb +0 -5
- data/example/asl-admin/config/initializers/new_rails_defaults.rb +0 -19
- data/example/asl-admin/config/initializers/session_store.rb +0 -15
- data/example/asl-admin/config/ldap.yml.sample +0 -24
- data/example/asl-admin/config/locales/en.yml +0 -5
- data/example/asl-admin/config/routes.rb +0 -43
- data/example/asl-admin/log/test.log +0 -5
- data/example/asl-admin/public/404.html +0 -30
- data/example/asl-admin/public/422.html +0 -30
- data/example/asl-admin/public/500.html +0 -30
- data/example/asl-admin/public/favicon.ico +0 -0
- data/example/asl-admin/public/images/rails.png +0 -0
- data/example/asl-admin/public/index.html +0 -275
- data/example/asl-admin/public/javascripts/application.js +0 -2
- data/example/asl-admin/public/javascripts/controls.js +0 -963
- data/example/asl-admin/public/javascripts/dragdrop.js +0 -973
- data/example/asl-admin/public/javascripts/effects.js +0 -1128
- data/example/asl-admin/public/javascripts/prototype.js +0 -4320
- data/example/asl-admin/public/robots.txt +0 -5
- data/example/asl-admin/script/about +0 -4
- data/example/asl-admin/script/console +0 -3
- data/example/asl-admin/script/dbconsole +0 -3
- data/example/asl-admin/script/destroy +0 -3
- data/example/asl-admin/script/generate +0 -3
- data/example/asl-admin/script/performance/benchmarker +0 -3
- data/example/asl-admin/script/performance/profiler +0 -3
- data/example/asl-admin/script/plugin +0 -3
- data/example/asl-admin/script/runner +0 -3
- data/example/asl-admin/script/server +0 -3
- data/example/asl-admin/test/performance/browsing_test.rb +0 -9
- data/example/asl-admin/test/test_helper.rb +0 -38
- data/po/active-samba-ldap.pot +0 -463
- data/rails_generators/scaffold_active_samba_ldap/scaffold_active_samba_ldap_generator.rb +0 -28
- data/rails_generators/scaffold_active_samba_ldap/templates/computer.rb +0 -3
- data/rails_generators/scaffold_active_samba_ldap/templates/dc.rb +0 -3
- data/rails_generators/scaffold_active_samba_ldap/templates/group.rb +0 -3
- data/rails_generators/scaffold_active_samba_ldap/templates/idmap.rb +0 -3
- data/rails_generators/scaffold_active_samba_ldap/templates/ldap.yml +0 -24
- data/rails_generators/scaffold_active_samba_ldap/templates/ou.rb +0 -3
- data/rails_generators/scaffold_active_samba_ldap/templates/samba_controller.rb +0 -12
- data/rails_generators/scaffold_active_samba_ldap/templates/samba_helper.rb +0 -2
- data/rails_generators/scaffold_active_samba_ldap/templates/samba_index.html.erb +0 -17
- data/rails_generators/scaffold_active_samba_ldap/templates/samba_populate.html.erb +0 -15
- data/rails_generators/scaffold_active_samba_ldap/templates/samba_purge.html.erb +0 -10
- data/rails_generators/scaffold_active_samba_ldap/templates/unix_id_pool.rb +0 -3
- data/rails_generators/scaffold_active_samba_ldap/templates/user.rb +0 -3
- data/setup.rb +0 -1585
- data/test-unit/History.txt +0 -107
- data/test-unit/README.txt +0 -52
- data/test-unit/Rakefile +0 -40
- data/test-unit/TODO +0 -5
- data/test-unit/bin/testrb +0 -5
- data/test-unit/lib/test/unit.rb +0 -342
- data/test-unit/lib/test/unit/assertionfailederror.rb +0 -14
- data/test-unit/lib/test/unit/assertions.rb +0 -1149
- data/test-unit/lib/test/unit/attribute.rb +0 -125
- data/test-unit/lib/test/unit/autorunner.rb +0 -344
- data/test-unit/lib/test/unit/collector.rb +0 -43
- data/test-unit/lib/test/unit/collector/descendant.rb +0 -23
- data/test-unit/lib/test/unit/collector/dir.rb +0 -108
- data/test-unit/lib/test/unit/collector/load.rb +0 -137
- data/test-unit/lib/test/unit/collector/objectspace.rb +0 -34
- data/test-unit/lib/test/unit/color-scheme.rb +0 -90
- data/test-unit/lib/test/unit/color.rb +0 -96
- data/test-unit/lib/test/unit/diff.rb +0 -538
- data/test-unit/lib/test/unit/error.rb +0 -126
- data/test-unit/lib/test/unit/exceptionhandler.rb +0 -39
- data/test-unit/lib/test/unit/failure.rb +0 -110
- data/test-unit/lib/test/unit/fixture.rb +0 -176
- data/test-unit/lib/test/unit/notification.rb +0 -125
- data/test-unit/lib/test/unit/omission.rb +0 -143
- data/test-unit/lib/test/unit/pending.rb +0 -146
- data/test-unit/lib/test/unit/priority.rb +0 -181
- data/test-unit/lib/test/unit/runner/console.rb +0 -52
- data/test-unit/lib/test/unit/runner/emacs.rb +0 -8
- data/test-unit/lib/test/unit/runner/tap.rb +0 -8
- data/test-unit/lib/test/unit/testcase.rb +0 -425
- data/test-unit/lib/test/unit/testresult.rb +0 -89
- data/test-unit/lib/test/unit/testsuite.rb +0 -110
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +0 -14
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +0 -278
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +0 -49
- data/test-unit/lib/test/unit/ui/tap/testrunner.rb +0 -92
- data/test-unit/lib/test/unit/ui/testrunner.rb +0 -20
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +0 -77
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +0 -41
- data/test-unit/lib/test/unit/util/backtracefilter.rb +0 -41
- data/test-unit/lib/test/unit/util/method-owner-finder.rb +0 -28
- data/test-unit/lib/test/unit/util/observable.rb +0 -90
- data/test-unit/lib/test/unit/util/procwrapper.rb +0 -48
- data/test-unit/lib/test/unit/version.rb +0 -7
- data/test-unit/sample/adder.rb +0 -13
- data/test-unit/sample/subtracter.rb +0 -12
- data/test-unit/sample/tc_adder.rb +0 -18
- data/test-unit/sample/tc_subtracter.rb +0 -18
- data/test-unit/sample/test_user.rb +0 -22
- data/test-unit/sample/ts_examples.rb +0 -7
- data/test-unit/test/collector/test-descendant.rb +0 -135
- data/test-unit/test/collector/test-load.rb +0 -329
- data/test-unit/test/collector/test_dir.rb +0 -406
- data/test-unit/test/collector/test_objectspace.rb +0 -98
- data/test-unit/test/run-test.rb +0 -13
- data/test-unit/test/test-attribute.rb +0 -86
- data/test-unit/test/test-color-scheme.rb +0 -60
- data/test-unit/test/test-color.rb +0 -47
- data/test-unit/test/test-diff.rb +0 -477
- data/test-unit/test/test-emacs-runner.rb +0 -60
- data/test-unit/test/test-fixture.rb +0 -287
- data/test-unit/test/test-notification.rb +0 -33
- data/test-unit/test/test-omission.rb +0 -81
- data/test-unit/test/test-pending.rb +0 -70
- data/test-unit/test/test-priority.rb +0 -119
- data/test-unit/test/test-testcase.rb +0 -507
- data/test-unit/test/test_assertions.rb +0 -1082
- data/test-unit/test/test_error.rb +0 -26
- data/test-unit/test/test_failure.rb +0 -33
- data/test-unit/test/test_testresult.rb +0 -113
- data/test-unit/test/test_testsuite.rb +0 -129
- data/test-unit/test/testunit-test-util.rb +0 -14
- data/test-unit/test/ui/test_testrunmediator.rb +0 -20
- data/test-unit/test/util/test-method-owner-finder.rb +0 -38
- data/test-unit/test/util/test_backtracefilter.rb +0 -41
- data/test-unit/test/util/test_observable.rb +0 -102
- data/test-unit/test/util/test_procwrapper.rb +0 -36
@@ -1,43 +0,0 @@
|
|
1
|
-
module Test
|
2
|
-
module Unit
|
3
|
-
module Collector
|
4
|
-
def initialize
|
5
|
-
@filters = []
|
6
|
-
end
|
7
|
-
|
8
|
-
def filter=(filters)
|
9
|
-
@filters = case(filters)
|
10
|
-
when Proc
|
11
|
-
[filters]
|
12
|
-
when Array
|
13
|
-
filters
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def add_suite(destination, suite)
|
18
|
-
to_delete = suite.tests.find_all{|t| !include?(t)}
|
19
|
-
to_delete.each{|t| suite.delete(t)}
|
20
|
-
destination << suite unless(suite.size == 0)
|
21
|
-
end
|
22
|
-
|
23
|
-
def include?(test)
|
24
|
-
return true if(@filters.empty?)
|
25
|
-
@filters.each do |filter|
|
26
|
-
result = filter[test]
|
27
|
-
if(result.nil?)
|
28
|
-
next
|
29
|
-
elsif(!result)
|
30
|
-
return false
|
31
|
-
else
|
32
|
-
return true
|
33
|
-
end
|
34
|
-
end
|
35
|
-
true
|
36
|
-
end
|
37
|
-
|
38
|
-
def sort(suites)
|
39
|
-
suites.sort_by {|suite| suite.name || suite.to_s}
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'test/unit/collector'
|
2
|
-
|
3
|
-
module Test
|
4
|
-
module Unit
|
5
|
-
module Collector
|
6
|
-
class Descendant
|
7
|
-
include Collector
|
8
|
-
|
9
|
-
NAME = 'collected from the subclasses of TestCase'
|
10
|
-
|
11
|
-
def collect(name=NAME)
|
12
|
-
suite = TestSuite.new(name)
|
13
|
-
sub_suites = []
|
14
|
-
TestCase::DESCENDANTS.each do |descendant_test_case|
|
15
|
-
add_suite(sub_suites, descendant_test_case.suite)
|
16
|
-
end
|
17
|
-
sort(sub_suites).each {|s| suite << s}
|
18
|
-
suite
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,108 +0,0 @@
|
|
1
|
-
require 'test/unit/testsuite'
|
2
|
-
require 'test/unit/collector'
|
3
|
-
|
4
|
-
module Test
|
5
|
-
module Unit
|
6
|
-
module Collector
|
7
|
-
class Dir
|
8
|
-
include Collector
|
9
|
-
|
10
|
-
attr_reader :pattern, :exclude
|
11
|
-
attr_accessor :base
|
12
|
-
|
13
|
-
def initialize(dir=::Dir, file=::File, object_space=::ObjectSpace, req=nil)
|
14
|
-
super()
|
15
|
-
@dir = dir
|
16
|
-
@file = file
|
17
|
-
@object_space = object_space
|
18
|
-
@req = req
|
19
|
-
@pattern = [/\btest_.*\.rb\Z/m]
|
20
|
-
@exclude = []
|
21
|
-
@base = nil
|
22
|
-
end
|
23
|
-
|
24
|
-
def collect(*from)
|
25
|
-
basedir = @base
|
26
|
-
$:.push(basedir) if basedir
|
27
|
-
if(from.empty?)
|
28
|
-
recursive_collect('.', find_test_cases)
|
29
|
-
elsif(from.size == 1)
|
30
|
-
recursive_collect(from.first, find_test_cases)
|
31
|
-
else
|
32
|
-
suites = []
|
33
|
-
from.each do |f|
|
34
|
-
suite = recursive_collect(f, find_test_cases)
|
35
|
-
suites << suite unless(suite.tests.empty?)
|
36
|
-
end
|
37
|
-
suite = TestSuite.new("[#{from.join(', ')}]")
|
38
|
-
sort(suites).each{|s| suite << s}
|
39
|
-
suite
|
40
|
-
end
|
41
|
-
ensure
|
42
|
-
$:.delete_at($:.rindex(basedir)) if basedir
|
43
|
-
end
|
44
|
-
|
45
|
-
def find_test_cases(ignore=[])
|
46
|
-
cases = []
|
47
|
-
@object_space.each_object(Class) do |c|
|
48
|
-
cases << c if(c < TestCase && !ignore.include?(c))
|
49
|
-
end
|
50
|
-
ignore.concat(cases)
|
51
|
-
cases
|
52
|
-
end
|
53
|
-
|
54
|
-
def recursive_collect(name, already_gathered)
|
55
|
-
sub_suites = []
|
56
|
-
path = realdir(name)
|
57
|
-
if @file.directory?(path)
|
58
|
-
dir_name = name unless name == '.'
|
59
|
-
@dir.entries(path).each do |e|
|
60
|
-
next if(e == '.' || e == '..')
|
61
|
-
e_name = dir_name ? @file.join(dir_name, e) : e
|
62
|
-
if @file.directory?(realdir(e_name))
|
63
|
-
next if /\A(?:CVS|\.svn)\z/ =~ e
|
64
|
-
sub_suite = recursive_collect(e_name, already_gathered)
|
65
|
-
sub_suites << sub_suite unless(sub_suite.empty?)
|
66
|
-
else
|
67
|
-
next if /~\z/ =~ e_name or /\A\.\#/ =~ e
|
68
|
-
if @pattern and !@pattern.empty?
|
69
|
-
next unless @pattern.any? {|pat| pat =~ e_name}
|
70
|
-
end
|
71
|
-
if @exclude and !@exclude.empty?
|
72
|
-
next if @exclude.any? {|pat| pat =~ e_name}
|
73
|
-
end
|
74
|
-
collect_file(e_name, sub_suites, already_gathered)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
else
|
78
|
-
collect_file(name, sub_suites, already_gathered)
|
79
|
-
end
|
80
|
-
suite = TestSuite.new(@file.basename(name))
|
81
|
-
sort(sub_suites).each{|s| suite << s}
|
82
|
-
suite
|
83
|
-
end
|
84
|
-
|
85
|
-
def collect_file(name, suites, already_gathered)
|
86
|
-
dir = @file.dirname(@file.expand_path(name, @base))
|
87
|
-
$:.unshift(dir)
|
88
|
-
if(@req)
|
89
|
-
@req.require(name)
|
90
|
-
else
|
91
|
-
require(name)
|
92
|
-
end
|
93
|
-
find_test_cases(already_gathered).each{|t| add_suite(suites, t.suite)}
|
94
|
-
ensure
|
95
|
-
$:.delete_at($:.rindex(dir)) if(dir)
|
96
|
-
end
|
97
|
-
|
98
|
-
def realdir(path)
|
99
|
-
if @base
|
100
|
-
@file.join(@base, path)
|
101
|
-
else
|
102
|
-
path
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
@@ -1,137 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
|
3
|
-
require 'test/unit/testsuite'
|
4
|
-
require 'test/unit/collector'
|
5
|
-
|
6
|
-
module Test
|
7
|
-
module Unit
|
8
|
-
module Collector
|
9
|
-
class Load
|
10
|
-
include Collector
|
11
|
-
|
12
|
-
attr_reader :patterns, :excludes, :base
|
13
|
-
|
14
|
-
def initialize
|
15
|
-
super
|
16
|
-
@system_excludes = [/~\z/, /\A\.\#/]
|
17
|
-
@system_directory_excludes = [/\A(?:CVS|\.svn)\z/]
|
18
|
-
@patterns = [/\Atest[_\-].+\.rb\z/m]
|
19
|
-
@excludes = []
|
20
|
-
@base = nil
|
21
|
-
end
|
22
|
-
|
23
|
-
def base=(base)
|
24
|
-
base = Pathname(base) unless base.nil?
|
25
|
-
@base = base
|
26
|
-
end
|
27
|
-
|
28
|
-
def collect(*froms)
|
29
|
-
add_load_path(@base) do
|
30
|
-
froms = ["."] if froms.empty?
|
31
|
-
test_suites = froms.collect do |from|
|
32
|
-
test_suite = collect_recursive(from, find_test_cases)
|
33
|
-
test_suite = nil if test_suite.tests.empty?
|
34
|
-
test_suite
|
35
|
-
end.compact
|
36
|
-
|
37
|
-
if test_suites.size > 1
|
38
|
-
test_suite = TestSuite.new("[#{froms.join(', ')}]")
|
39
|
-
sort(test_suites).each do |sub_test_suite|
|
40
|
-
test_suite << sub_test_suite
|
41
|
-
end
|
42
|
-
test_suite
|
43
|
-
else
|
44
|
-
test_suites.first
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def find_test_cases(ignore=[])
|
50
|
-
test_cases = []
|
51
|
-
TestCase::DESCENDANTS.each do |test_case|
|
52
|
-
test_cases << test_case unless ignore.include?(test_case)
|
53
|
-
end
|
54
|
-
ignore.concat(test_cases)
|
55
|
-
test_cases
|
56
|
-
end
|
57
|
-
|
58
|
-
private
|
59
|
-
def collect_recursive(name, already_gathered)
|
60
|
-
sub_test_suites = []
|
61
|
-
|
62
|
-
path = resolve_path(name)
|
63
|
-
if path.directory?
|
64
|
-
directories, files = path.children.partition do |child|
|
65
|
-
child.directory?
|
66
|
-
end
|
67
|
-
|
68
|
-
files.each do |child|
|
69
|
-
next if excluded_file?(child.basename.to_s)
|
70
|
-
collect_file(child, sub_test_suites, already_gathered)
|
71
|
-
end
|
72
|
-
|
73
|
-
directories.each do |child|
|
74
|
-
next if excluded_directory?(child.basename.to_s)
|
75
|
-
sub_test_suite = collect_recursive(child, already_gathered)
|
76
|
-
sub_test_suites << sub_test_suite unless sub_test_suite.empty?
|
77
|
-
end
|
78
|
-
else
|
79
|
-
unless excluded_file?(path.basename.to_s)
|
80
|
-
collect_file(path, sub_test_suites, already_gathered)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
test_suite = TestSuite.new(path.basename.to_s)
|
85
|
-
sort(sub_test_suites).each do |sub_test_suite|
|
86
|
-
test_suite << sub_test_suite
|
87
|
-
end
|
88
|
-
test_suite
|
89
|
-
end
|
90
|
-
|
91
|
-
def collect_file(path, test_suites, already_gathered)
|
92
|
-
add_load_path(path.expand_path.dirname) do
|
93
|
-
require(path.to_s)
|
94
|
-
find_test_cases(already_gathered).each do |test_case|
|
95
|
-
add_suite(test_suites, test_case.suite)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def resolve_path(path)
|
101
|
-
if @base
|
102
|
-
@base + path
|
103
|
-
else
|
104
|
-
Pathname(path)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
def add_load_path(path)
|
109
|
-
$LOAD_PATH.push(path.to_s) if path
|
110
|
-
yield
|
111
|
-
ensure
|
112
|
-
$LOAD_PATH.delete_at($LOAD_PATH.rindex(path.to_s)) if path
|
113
|
-
end
|
114
|
-
|
115
|
-
def excluded_directory?(base)
|
116
|
-
@system_directory_excludes.any? {|pattern| pattern =~ base}
|
117
|
-
end
|
118
|
-
|
119
|
-
def excluded_file?(base)
|
120
|
-
return true if @system_excludes.any? {|pattern| pattern =~ base}
|
121
|
-
|
122
|
-
patterns = @patterns || []
|
123
|
-
unless patterns.empty?
|
124
|
-
return true unless patterns.any? {|pattern| pattern =~ base}
|
125
|
-
end
|
126
|
-
|
127
|
-
excludes = @excludes || []
|
128
|
-
unless excludes.empty?
|
129
|
-
return true if excludes.any? {|pattern| pattern =~ base}
|
130
|
-
end
|
131
|
-
|
132
|
-
false
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# Author:: Nathaniel Talbott.
|
2
|
-
# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
|
3
|
-
# License:: Ruby license.
|
4
|
-
|
5
|
-
require 'test/unit/collector'
|
6
|
-
|
7
|
-
module Test
|
8
|
-
module Unit
|
9
|
-
module Collector
|
10
|
-
class ObjectSpace
|
11
|
-
include Collector
|
12
|
-
|
13
|
-
NAME = 'collected from the ObjectSpace'
|
14
|
-
|
15
|
-
def initialize(source=::ObjectSpace)
|
16
|
-
super()
|
17
|
-
@source = source
|
18
|
-
end
|
19
|
-
|
20
|
-
def collect(name=NAME)
|
21
|
-
suite = TestSuite.new(name)
|
22
|
-
sub_suites = []
|
23
|
-
@source.each_object(Class) do |klass|
|
24
|
-
if(Test::Unit::TestCase > klass)
|
25
|
-
add_suite(sub_suites, klass.suite)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
sort(sub_suites).each{|s| suite << s}
|
29
|
-
suite
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,90 +0,0 @@
|
|
1
|
-
require 'test/unit/color'
|
2
|
-
|
3
|
-
module Test
|
4
|
-
module Unit
|
5
|
-
class ColorScheme
|
6
|
-
include Enumerable
|
7
|
-
|
8
|
-
class << self
|
9
|
-
@@default = nil
|
10
|
-
def default
|
11
|
-
@@default ||= new("success" => Color.new("green", :bold => true),
|
12
|
-
"failure" => Color.new("red", :bold => true),
|
13
|
-
"pending" => Color.new("magenta", :bold => true),
|
14
|
-
"omission" => Color.new("blue", :bold => true),
|
15
|
-
"notification" => Color.new("cyan", :bold => true),
|
16
|
-
"error" => Color.new("yellow", :bold => true) +
|
17
|
-
Color.new("black", :foreground => false),
|
18
|
-
"case" => Color.new("white", :bold => true) +
|
19
|
-
Color.new("blue", :foreground => false),
|
20
|
-
"suite" => Color.new("white", :bold => true) +
|
21
|
-
Color.new("green", :foreground => false))
|
22
|
-
end
|
23
|
-
|
24
|
-
@@schemes = {}
|
25
|
-
def all
|
26
|
-
@@schemes.merge("default" => default)
|
27
|
-
end
|
28
|
-
|
29
|
-
def [](id)
|
30
|
-
@@schemes[id.to_s]
|
31
|
-
end
|
32
|
-
|
33
|
-
def []=(id, scheme_or_spec)
|
34
|
-
if scheme_or_spec.is_a?(self)
|
35
|
-
scheme = scheme_or_spec
|
36
|
-
else
|
37
|
-
scheme = new(scheme_or_spec)
|
38
|
-
end
|
39
|
-
@@schemes[id.to_s] = scheme
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def initialize(scheme_spec)
|
44
|
-
@scheme = {}
|
45
|
-
scheme_spec.each do |key, color_spec|
|
46
|
-
self[key] = color_spec
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def [](name)
|
51
|
-
@scheme[name.to_s]
|
52
|
-
end
|
53
|
-
|
54
|
-
def []=(name, color_spec)
|
55
|
-
@scheme[name.to_s] = make_color(color_spec)
|
56
|
-
end
|
57
|
-
|
58
|
-
def each(&block)
|
59
|
-
@scheme.each(&block)
|
60
|
-
end
|
61
|
-
|
62
|
-
def to_hash
|
63
|
-
hash = {}
|
64
|
-
@scheme.each do |key, color|
|
65
|
-
hash[key] = color
|
66
|
-
end
|
67
|
-
hash
|
68
|
-
end
|
69
|
-
|
70
|
-
private
|
71
|
-
def make_color(color_spec)
|
72
|
-
if color_spec.is_a?(Color) or color_spec.is_a?(MixColor)
|
73
|
-
color_spec
|
74
|
-
else
|
75
|
-
color_name = nil
|
76
|
-
normalized_color_spec = {}
|
77
|
-
color_spec.each do |key, value|
|
78
|
-
key = key.to_sym
|
79
|
-
if key == :name
|
80
|
-
color_name = value
|
81
|
-
else
|
82
|
-
normalized_color_spec[key] = value
|
83
|
-
end
|
84
|
-
end
|
85
|
-
Color.new(color_name, normalized_color_spec)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
@@ -1,96 +0,0 @@
|
|
1
|
-
module Test
|
2
|
-
module Unit
|
3
|
-
class Color
|
4
|
-
NAMES = ["black", "red", "green", "yellow",
|
5
|
-
"blue", "magenta", "cyan", "white"]
|
6
|
-
|
7
|
-
attr_reader :name
|
8
|
-
def initialize(name, options={})
|
9
|
-
@name = name
|
10
|
-
@foreground = options[:foreground]
|
11
|
-
@foreground = true if @foreground.nil?
|
12
|
-
@intensity = options[:intensity]
|
13
|
-
@bold = options[:bold]
|
14
|
-
@italic = options[:italic]
|
15
|
-
@underline = options[:underline]
|
16
|
-
end
|
17
|
-
|
18
|
-
def foreground?
|
19
|
-
@foreground
|
20
|
-
end
|
21
|
-
|
22
|
-
def intensity?
|
23
|
-
@intensity
|
24
|
-
end
|
25
|
-
|
26
|
-
def bold?
|
27
|
-
@bold
|
28
|
-
end
|
29
|
-
|
30
|
-
def italic?
|
31
|
-
@italic
|
32
|
-
end
|
33
|
-
|
34
|
-
def underline?
|
35
|
-
@underline
|
36
|
-
end
|
37
|
-
|
38
|
-
def ==(other)
|
39
|
-
self.class === other and
|
40
|
-
[name, foreground?, intensity?,
|
41
|
-
bold?, italic?, underline?] ==
|
42
|
-
[other.name, other.foreground?, other.intensity?,
|
43
|
-
other.bold?, other.italic?, other.underline?]
|
44
|
-
end
|
45
|
-
|
46
|
-
def sequence
|
47
|
-
sequence = []
|
48
|
-
if @name == "none"
|
49
|
-
elsif @name == "reset"
|
50
|
-
sequence << "0"
|
51
|
-
else
|
52
|
-
foreground_parameter = foreground? ? 3 : 4
|
53
|
-
foreground_parameter += 6 if intensity?
|
54
|
-
sequence << "#{foreground_parameter}#{NAMES.index(@name)}"
|
55
|
-
end
|
56
|
-
sequence << "1" if bold?
|
57
|
-
sequence << "3" if italic?
|
58
|
-
sequence << "4" if underline?
|
59
|
-
sequence
|
60
|
-
end
|
61
|
-
|
62
|
-
def escape_sequence
|
63
|
-
"\e[#{sequence.join(';')}m"
|
64
|
-
end
|
65
|
-
|
66
|
-
def +(other)
|
67
|
-
MixColor.new([self, other])
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
class MixColor
|
72
|
-
attr_reader :colors
|
73
|
-
def initialize(colors)
|
74
|
-
@colors = colors
|
75
|
-
end
|
76
|
-
|
77
|
-
def sequence
|
78
|
-
@colors.inject([]) do |result, color|
|
79
|
-
result + color.sequence
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def escape_sequence
|
84
|
-
"\e[#{sequence.join(';')}m"
|
85
|
-
end
|
86
|
-
|
87
|
-
def +(other)
|
88
|
-
self.class.new([self, other])
|
89
|
-
end
|
90
|
-
|
91
|
-
def ==(other)
|
92
|
-
self.class === other and colors == other.colors
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|