scout-essentials 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.vimproject +33 -1
- data/VERSION +1 -1
- data/lib/scout/annotation/annotated_object.rb +69 -0
- data/lib/scout/annotation/annotation_module.rb +59 -0
- data/lib/scout/annotation/array.rb +74 -0
- data/lib/scout/annotation.rb +45 -0
- data/lib/scout/concurrent_stream.rb +4 -1
- data/lib/scout/config.rb +3 -3
- data/lib/scout/exceptions.rb +2 -1
- data/lib/scout/indiferent_hash/options.rb +2 -1
- data/lib/scout/log/color.rb +1 -1
- data/lib/scout/log.rb +11 -11
- data/lib/scout/misc/digest.rb +39 -8
- data/lib/scout/misc/filesystem.rb +23 -0
- data/lib/scout/misc/format.rb +32 -0
- data/lib/scout/misc/helper.rb +37 -0
- data/lib/scout/misc/math.rb +109 -0
- data/lib/scout/misc/system.rb +2 -2
- data/lib/scout/misc.rb +1 -0
- data/lib/scout/named_array.rb +8 -6
- data/lib/scout/open/remote.rb +8 -3
- data/lib/scout/open/stream.rb +5 -1
- data/lib/scout/open/util.rb +1 -1
- data/lib/scout/path/find.rb +18 -6
- data/lib/scout/path/util.rb +1 -1
- data/lib/scout/path.rb +10 -4
- data/lib/scout/persist/open.rb +1 -1
- data/lib/scout/persist/serialize.rb +6 -2
- data/lib/scout/persist.rb +49 -20
- data/lib/scout/resource/path.rb +1 -1
- data/lib/scout/resource/scout.rb +2 -0
- data/lib/scout/resource/util.rb +8 -3
- data/lib/scout/resource.rb +15 -3
- data/scout-essentials.gemspec +21 -13
- data/test/scout/annotation/test_annotated_object.rb +0 -0
- data/test/scout/annotation/test_array.rb +119 -0
- data/test/scout/misc/test_digest.rb +54 -0
- data/test/scout/misc/test_filesystem.rb +28 -0
- data/test/scout/misc/test_helper.rb +14 -0
- data/test/scout/misc/test_math.rb +9 -0
- data/test/scout/path/test_find.rb +32 -0
- data/test/scout/test_annotation.rb +169 -0
- data/test/scout/test_persist.rb +17 -1
- data/test/scout/test_resource.rb +8 -8
- metadata +13 -5
- data/lib/scout/meta_extension.rb +0 -101
- data/test/scout/test_meta_extension.rb +0 -80
@@ -1,80 +0,0 @@
|
|
1
|
-
require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
|
2
|
-
require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')
|
3
|
-
|
4
|
-
class TestMetaExtension < Test::Unit::TestCase
|
5
|
-
module ExtensionClass
|
6
|
-
extend MetaExtension
|
7
|
-
|
8
|
-
extension_attr :code, :code2
|
9
|
-
end
|
10
|
-
|
11
|
-
module ExtensionClass2
|
12
|
-
extend MetaExtension
|
13
|
-
|
14
|
-
extension_attr :code3, :code4
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
def test_setup_annotate
|
19
|
-
str = "String"
|
20
|
-
ExtensionClass.setup(str, :code)
|
21
|
-
assert ExtensionClass === str
|
22
|
-
assert_equal :code, str.code
|
23
|
-
|
24
|
-
str2 = "String2"
|
25
|
-
str.annotate(str2)
|
26
|
-
assert_equal :code, str2.code
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_marshal
|
30
|
-
str = "String"
|
31
|
-
ExtensionClass.setup(str, :code)
|
32
|
-
assert ExtensionClass === str
|
33
|
-
assert_equal :code, str.code
|
34
|
-
|
35
|
-
str2 = Marshal.load(Marshal.dump(str))
|
36
|
-
assert_equal :code, str2.code
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_setup_alternatives
|
40
|
-
str = "String"
|
41
|
-
|
42
|
-
ExtensionClass.setup(str, :code2 => :code)
|
43
|
-
assert_equal :code, str.code2
|
44
|
-
|
45
|
-
ExtensionClass.setup(str, code2: :code)
|
46
|
-
assert_equal :code, str.code2
|
47
|
-
|
48
|
-
ExtensionClass.setup(str, "code2" => :code)
|
49
|
-
assert_equal :code, str.code2
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_setup_block
|
54
|
-
o = ExtensionClass.setup nil, :code => :c, :code2 => :c2 do
|
55
|
-
puts 1
|
56
|
-
end
|
57
|
-
|
58
|
-
assert o.extension_attr_hash.include?(:code)
|
59
|
-
assert o.extension_attr_hash.include?(:code2)
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_twice
|
63
|
-
str = "String"
|
64
|
-
|
65
|
-
ExtensionClass.setup(str, :code2 => :code)
|
66
|
-
assert_equal :code, str.code2
|
67
|
-
assert_include str.instance_variable_get(:@extension_attrs), :code
|
68
|
-
|
69
|
-
str.extend ExtensionClass2
|
70
|
-
str.code3 = :code_alt
|
71
|
-
assert_equal :code, str.code2
|
72
|
-
assert_equal :code_alt, str.code3
|
73
|
-
assert_include str.instance_variable_get(:@extension_attrs), :code
|
74
|
-
assert_include str.instance_variable_get(:@extension_attrs), :code3
|
75
|
-
|
76
|
-
assert_include str.extension_attr_hash, :code
|
77
|
-
assert_include str.extension_attr_hash, :code3
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|