glue 0.31.0 → 0.40.0
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/doc/AUTHORS +1 -1
- data/doc/LICENSE +2 -3
- data/doc/RELEASES +0 -4
- data/lib/glue.rb +3 -3
- data/lib/glue/attribute.rb +114 -0
- data/lib/glue/attributeutils.rb +117 -0
- data/lib/glue/autoreload.rb +0 -4
- data/lib/glue/builder.rb +0 -2
- data/lib/glue/builder/xml.rb +0 -2
- data/lib/glue/cache.rb +3 -5
- data/lib/glue/cache/drb.rb +0 -2
- data/lib/glue/cache/memory.rb +0 -2
- data/lib/glue/cache/og.rb +11 -6
- data/lib/glue/configuration.rb +60 -15
- data/lib/glue/fixture.rb +3 -5
- data/lib/glue/localization.rb +0 -2
- data/lib/glue/logger.rb +1 -2
- data/lib/glue/mail.rb +0 -2
- data/lib/glue/mailer.rb +4 -2
- data/lib/glue/mailer/incoming.rb +0 -2
- data/lib/glue/mailer/outgoing.rb +3 -5
- data/lib/glue/settings.rb +0 -2
- data/lib/glue/uri.rb +0 -2
- data/lib/glue/validation.rb +6 -8
- data/test/glue/builder/tc_xml.rb +3 -2
- data/test/glue/tc_attribute.rb +112 -0
- data/test/glue/{tc_property_mixins.rb → tc_attribute_mixins.rb} +9 -11
- data/test/glue/tc_configuration.rb +1 -1
- data/test/glue/tc_fixture.rb +4 -3
- data/test/glue/tc_logger.rb +2 -2
- data/test/glue/tc_mail.rb +22 -21
- data/test/glue/tc_stores.rb +0 -2
- data/test/glue/tc_uri.rb +12 -12
- data/test/glue/tc_validation.rb +13 -13
- metadata +52 -64
- data/INSTALL +0 -56
- data/ProjectInfo +0 -49
- data/README +0 -21
- data/lib/glue/markup.rb +0 -123
- data/lib/glue/property.rb +0 -290
- data/lib/glue/sanitize.rb +0 -48
- data/lib/glue/template.rb +0 -219
- data/setup.rb +0 -1585
- data/test/glue/tc_property.rb +0 -112
- data/test/glue/tc_property_type_checking.rb +0 -41
- data/test/glue/tc_template.rb +0 -35
data/test/glue/tc_property.rb
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
|
2
|
-
|
3
|
-
require 'test/unit'
|
4
|
-
|
5
|
-
require 'og'
|
6
|
-
require 'glue/logger'
|
7
|
-
require 'glue/property'
|
8
|
-
|
9
|
-
def VarChar(size)
|
10
|
-
return String, :sql => "VARCHAR(#{ size })"
|
11
|
-
end
|
12
|
-
NotNull = {:sql => "NOT NULL"}.freeze
|
13
|
-
Null = {:sql => "NULL"}.freeze
|
14
|
-
|
15
|
-
# Property.type_checking = false
|
16
|
-
|
17
|
-
module Test # :nodoc: all
|
18
|
-
|
19
|
-
class Msg
|
20
|
-
include Og::Unmanageable
|
21
|
-
|
22
|
-
prop :owner_oid, Fixnum
|
23
|
-
prop_accessor :val1, :val2, :val3, Fixnum, :sql => "smallint"
|
24
|
-
prop_accessor :title, :body, String
|
25
|
-
prop_accessor :test, String, :sql => "char(10) NOT NULL"
|
26
|
-
prop_accessor :count, Fixnum
|
27
|
-
prop_accessor :create_time, Time
|
28
|
-
|
29
|
-
# a marshaled property
|
30
|
-
prop_accessor :options, Array
|
31
|
-
|
32
|
-
# property with macro arguments!
|
33
|
-
prop_accessor :address, VarChar(30), NotNull
|
34
|
-
|
35
|
-
def initialize
|
36
|
-
@create_time = Time.now
|
37
|
-
@options = []
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
class SubMsg < Msg
|
43
|
-
# to avoid conflicts with tc_og.rb
|
44
|
-
include Og::Unmanageable
|
45
|
-
|
46
|
-
# duplicate definition with different type!
|
47
|
-
prop_accessor :count, Float
|
48
|
-
|
49
|
-
# another property
|
50
|
-
prop_accessor :another, Fixnum
|
51
|
-
end
|
52
|
-
|
53
|
-
class C
|
54
|
-
attr_accessor :name
|
55
|
-
attr_accessor :description
|
56
|
-
end
|
57
|
-
|
58
|
-
class C
|
59
|
-
property :name, String
|
60
|
-
property :description, String
|
61
|
-
end
|
62
|
-
|
63
|
-
class TC_N_Properties < Test::Unit::TestCase
|
64
|
-
|
65
|
-
def setup
|
66
|
-
@msg1 = Msg.new
|
67
|
-
end
|
68
|
-
|
69
|
-
def teardown
|
70
|
-
@msg1 = nil
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_props
|
74
|
-
|
75
|
-
# bug: props for subclasses.
|
76
|
-
# bug: props propagated to base classes.
|
77
|
-
|
78
|
-
assert(SubMsg.properties)
|
79
|
-
assert_equal(Msg.properties.size(), SubMsg.properties.size() - 1)
|
80
|
-
|
81
|
-
assert_equal(11, Msg.properties.size)
|
82
|
-
assert_equal(12, SubMsg.properties.size)
|
83
|
-
|
84
|
-
# bug: duplicate definition
|
85
|
-
|
86
|
-
assert_equal(Float, SubMsg.properties.values.find { |p| :count == p.symbol }.klass)
|
87
|
-
|
88
|
-
# dont force conversion
|
89
|
-
|
90
|
-
@msg1.count = 2.4
|
91
|
-
assert_equal(Float, @msg1.count.class)
|
92
|
-
|
93
|
-
# force conversion
|
94
|
-
|
95
|
-
@msg1.__force_count(2.4)
|
96
|
-
assert_equal(Fixnum, @msg1.count.class)
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_macro_params
|
100
|
-
sql = Msg.properties.values.find { |p| :address == p.symbol}.sql
|
101
|
-
# FIXME: Temporarily dissabled.
|
102
|
-
# assert_equal 'VARCHAR(30) NOT NULL', sql
|
103
|
-
end
|
104
|
-
|
105
|
-
|
106
|
-
def test_soc
|
107
|
-
assert_equal String, C.ann.name.klass
|
108
|
-
end
|
109
|
-
|
110
|
-
end
|
111
|
-
|
112
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
|
2
|
-
|
3
|
-
require 'test/unit'
|
4
|
-
|
5
|
-
require 'glue/logger'
|
6
|
-
require 'glue/property'
|
7
|
-
|
8
|
-
=begin
|
9
|
-
|
10
|
-
FIXME: temporarily dissabled.
|
11
|
-
|
12
|
-
Glue::Property.type_checking = true
|
13
|
-
|
14
|
-
module Test # :nodoc: all
|
15
|
-
|
16
|
-
class Person
|
17
|
-
prop_accessor :age, Fixnum
|
18
|
-
|
19
|
-
def initialize(age = nil)
|
20
|
-
@age = age
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
class TC_PropertiesTypeChecking < Test::Unit::TestCase
|
26
|
-
|
27
|
-
def test_all
|
28
|
-
per = Person.new
|
29
|
-
|
30
|
-
FIXME: does not work when run in the full test suite.
|
31
|
-
# assert_raises(RuntimeError) {
|
32
|
-
# per.age = 'Hello'
|
33
|
-
# }
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
=end
|
41
|
-
|
data/test/glue/tc_template.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
|
2
|
-
|
3
|
-
require 'test/unit'
|
4
|
-
require 'ostruct'
|
5
|
-
|
6
|
-
require 'glue/template'
|
7
|
-
|
8
|
-
class TestTemplate < Test::Unit::TestCase # :nodoc: all
|
9
|
-
include Glue
|
10
|
-
|
11
|
-
def test_all
|
12
|
-
template = %q{
|
13
|
-
Hello #{user}
|
14
|
-
|
15
|
-
dont forget the following todo items:
|
16
|
-
|
17
|
-
<?r for item in items ?>
|
18
|
-
<li>#{item}</li>
|
19
|
-
<?r end ?>
|
20
|
-
}
|
21
|
-
|
22
|
-
user = 'gmosx'
|
23
|
-
items = %w{ nitro is really great }
|
24
|
-
out = ''
|
25
|
-
|
26
|
-
Glue::Template.process(template, :out, binding)
|
27
|
-
|
28
|
-
assert_match %r{\<li\>nitro\</li\>}, out
|
29
|
-
assert_match %r{\<li\>really\</li\>}, out
|
30
|
-
assert_match %r{Hello gmosx}, out
|
31
|
-
|
32
|
-
# TODO: add test for static inclusion.
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|