glue 0.31.0 → 0.40.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/doc/AUTHORS +1 -1
  2. data/doc/LICENSE +2 -3
  3. data/doc/RELEASES +0 -4
  4. data/lib/glue.rb +3 -3
  5. data/lib/glue/attribute.rb +114 -0
  6. data/lib/glue/attributeutils.rb +117 -0
  7. data/lib/glue/autoreload.rb +0 -4
  8. data/lib/glue/builder.rb +0 -2
  9. data/lib/glue/builder/xml.rb +0 -2
  10. data/lib/glue/cache.rb +3 -5
  11. data/lib/glue/cache/drb.rb +0 -2
  12. data/lib/glue/cache/memory.rb +0 -2
  13. data/lib/glue/cache/og.rb +11 -6
  14. data/lib/glue/configuration.rb +60 -15
  15. data/lib/glue/fixture.rb +3 -5
  16. data/lib/glue/localization.rb +0 -2
  17. data/lib/glue/logger.rb +1 -2
  18. data/lib/glue/mail.rb +0 -2
  19. data/lib/glue/mailer.rb +4 -2
  20. data/lib/glue/mailer/incoming.rb +0 -2
  21. data/lib/glue/mailer/outgoing.rb +3 -5
  22. data/lib/glue/settings.rb +0 -2
  23. data/lib/glue/uri.rb +0 -2
  24. data/lib/glue/validation.rb +6 -8
  25. data/test/glue/builder/tc_xml.rb +3 -2
  26. data/test/glue/tc_attribute.rb +112 -0
  27. data/test/glue/{tc_property_mixins.rb → tc_attribute_mixins.rb} +9 -11
  28. data/test/glue/tc_configuration.rb +1 -1
  29. data/test/glue/tc_fixture.rb +4 -3
  30. data/test/glue/tc_logger.rb +2 -2
  31. data/test/glue/tc_mail.rb +22 -21
  32. data/test/glue/tc_stores.rb +0 -2
  33. data/test/glue/tc_uri.rb +12 -12
  34. data/test/glue/tc_validation.rb +13 -13
  35. metadata +52 -64
  36. data/INSTALL +0 -56
  37. data/ProjectInfo +0 -49
  38. data/README +0 -21
  39. data/lib/glue/markup.rb +0 -123
  40. data/lib/glue/property.rb +0 -290
  41. data/lib/glue/sanitize.rb +0 -48
  42. data/lib/glue/template.rb +0 -219
  43. data/setup.rb +0 -1585
  44. data/test/glue/tc_property.rb +0 -112
  45. data/test/glue/tc_property_type_checking.rb +0 -41
  46. data/test/glue/tc_template.rb +0 -35
@@ -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
-
@@ -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