rgen 0.5.4 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. data/CHANGELOG +28 -0
  2. data/Rakefile +3 -4
  3. data/lib/ea_support/uml13_ea_metamodel.rb +3 -3
  4. data/lib/ea_support/uml13_ea_to_uml13.rb +33 -2
  5. data/lib/ea_support/uml13_to_uml13_ea.rb +7 -0
  6. data/lib/mmgen/mm_ext/ecore_mmgen_ext.rb +4 -4
  7. data/lib/mmgen/templates/metamodel_generator.tpl +143 -143
  8. data/lib/rgen/ecore/ecore.rb +11 -1
  9. data/lib/rgen/ecore/ecore_interface.rb +47 -0
  10. data/lib/rgen/ecore/ecore_to_ruby.rb +166 -0
  11. data/lib/rgen/ecore/{ecore_transformer.rb → ruby_to_ecore.rb} +11 -11
  12. data/lib/rgen/environment.rb +15 -2
  13. data/lib/rgen/fragment/dump_file_cache.rb +63 -0
  14. data/lib/rgen/fragment/fragmented_model.rb +139 -0
  15. data/lib/rgen/fragment/model_fragment.rb +268 -0
  16. data/lib/rgen/instantiator/abstract_xml_instantiator.rb +44 -72
  17. data/lib/rgen/instantiator/default_xml_instantiator.rb +2 -2
  18. data/lib/rgen/instantiator/ecore_xml_instantiator.rb +16 -1
  19. data/lib/rgen/instantiator/json_instantiator.rb +16 -2
  20. data/lib/rgen/instantiator/nodebased_xml_instantiator.rb +118 -138
  21. data/lib/rgen/instantiator/qualified_name_resolver.rb +5 -1
  22. data/lib/rgen/instantiator/reference_resolver.rb +126 -24
  23. data/lib/rgen/instantiator/xmi11_instantiator.rb +6 -2
  24. data/lib/rgen/metamodel_builder.rb +18 -6
  25. data/lib/rgen/metamodel_builder/builder_extensions.rb +431 -407
  26. data/lib/rgen/metamodel_builder/builder_runtime.rb +8 -8
  27. data/lib/rgen/metamodel_builder/constant_order_helper.rb +4 -4
  28. data/lib/rgen/metamodel_builder/data_types.rb +5 -1
  29. data/lib/rgen/metamodel_builder/intermediate/feature.rb +167 -0
  30. data/lib/rgen/metamodel_builder/module_extension.rb +2 -2
  31. data/lib/rgen/model_builder.rb +10 -5
  32. data/lib/rgen/model_builder/builder_context.rb +17 -1
  33. data/lib/rgen/serializer/opposite_reference_filter.rb +18 -0
  34. data/lib/rgen/serializer/qualified_name_provider.rb +45 -0
  35. data/lib/rgen/template_language/template_container.rb +3 -1
  36. data/lib/rgen/{auto_class_creator.rb → util/auto_class_creator.rb} +6 -1
  37. data/lib/rgen/util/cached_glob.rb +67 -0
  38. data/lib/rgen/util/file_cache_map.rb +104 -0
  39. data/lib/rgen/util/file_change_detector.rb +78 -0
  40. data/lib/rgen/{method_delegation.rb → util/method_delegation.rb} +18 -3
  41. data/lib/rgen/{model_comparator.rb → util/model_comparator.rb} +17 -5
  42. data/lib/rgen/{model_comparator_base.rb → util/model_comparator_base.rb} +6 -1
  43. data/lib/rgen/{model_dumper.rb → util/model_dumper.rb} +6 -1
  44. data/lib/rgen/{name_helper.rb → util/name_helper.rb} +6 -1
  45. data/lib/rgen/util/pattern_matcher.rb +329 -0
  46. data/lib/transformers/uml13_to_ecore.rb +103 -60
  47. data/test/ecore_self_test.rb +43 -42
  48. data/test/json_test.rb +15 -0
  49. data/test/metamodel_builder_test.rb +361 -206
  50. data/test/metamodel_from_ecore_test.rb +45 -0
  51. data/test/metamodel_order_test.rb +10 -4
  52. data/test/metamodel_roundtrip_test.rb +2 -2
  53. data/test/metamodel_roundtrip_test/TestModel_Regenerated.rb +1 -1
  54. data/test/metamodel_roundtrip_test/houseMetamodel_Regenerated.ecore +50 -50
  55. data/test/method_delegation_test.rb +9 -9
  56. data/test/model_builder/ecore_internal.rb +19 -9
  57. data/test/model_builder/serializer_test.rb +1 -1
  58. data/test/reference_resolver_test.rb +79 -12
  59. data/test/rgen_test.rb +2 -0
  60. data/test/template_language_test.rb +7 -0
  61. data/test/template_language_test/templates/callback_indent_test/a.tpl +12 -0
  62. data/test/template_language_test/templates/callback_indent_test/b.tpl +5 -0
  63. data/test/testmodel/ea_testmodel_regenerated.xml +588 -583
  64. data/test/transformer_test.rb +3 -3
  65. data/test/util/file_cache_map_test.rb +91 -0
  66. data/test/util/file_cache_map_test/testdir/fileA +1 -0
  67. data/test/util_test.rb +4 -0
  68. data/test/xml_instantiator_test.rb +139 -135
  69. metadata +49 -104
  70. data/lib/rgen/ecore/ecore_instantiator.rb +0 -31
  71. data/lib/rgen/metamodel_builder/metamodel_description.rb +0 -232
  72. data/redist/xmlscan/ChangeLog +0 -1301
  73. data/redist/xmlscan/README +0 -34
  74. data/redist/xmlscan/THANKS +0 -11
  75. data/redist/xmlscan/doc/changes.html +0 -74
  76. data/redist/xmlscan/doc/changes.rd +0 -80
  77. data/redist/xmlscan/doc/en/conformance.html +0 -136
  78. data/redist/xmlscan/doc/en/conformance.rd +0 -152
  79. data/redist/xmlscan/doc/en/manual.html +0 -356
  80. data/redist/xmlscan/doc/en/manual.rd +0 -402
  81. data/redist/xmlscan/doc/ja/conformance.ja.html +0 -118
  82. data/redist/xmlscan/doc/ja/conformance.ja.rd +0 -134
  83. data/redist/xmlscan/doc/ja/manual.ja.html +0 -325
  84. data/redist/xmlscan/doc/ja/manual.ja.rd +0 -370
  85. data/redist/xmlscan/doc/src/Makefile +0 -41
  86. data/redist/xmlscan/doc/src/conformance.rd.src +0 -256
  87. data/redist/xmlscan/doc/src/langsplit.rb +0 -110
  88. data/redist/xmlscan/doc/src/manual.rd.src +0 -614
  89. data/redist/xmlscan/install.rb +0 -41
  90. data/redist/xmlscan/lib/xmlscan/encoding.rb +0 -311
  91. data/redist/xmlscan/lib/xmlscan/htmlscan.rb +0 -289
  92. data/redist/xmlscan/lib/xmlscan/namespace.rb +0 -352
  93. data/redist/xmlscan/lib/xmlscan/parser.rb +0 -299
  94. data/redist/xmlscan/lib/xmlscan/scanner.rb +0 -1109
  95. data/redist/xmlscan/lib/xmlscan/version.rb +0 -22
  96. data/redist/xmlscan/lib/xmlscan/visitor.rb +0 -158
  97. data/redist/xmlscan/lib/xmlscan/xmlchar.rb +0 -441
  98. data/redist/xmlscan/memo/CONFORMANCE +0 -1249
  99. data/redist/xmlscan/memo/PRODUCTIONS +0 -195
  100. data/redist/xmlscan/memo/contentspec.ry +0 -335
  101. data/redist/xmlscan/samples/chibixml.rb +0 -105
  102. data/redist/xmlscan/samples/getxmlchar.rb +0 -122
  103. data/redist/xmlscan/samples/rexml.rb +0 -159
  104. data/redist/xmlscan/samples/xmlbench.rb +0 -88
  105. data/redist/xmlscan/samples/xmlbench/parser/chibixml.rb +0 -22
  106. data/redist/xmlscan/samples/xmlbench/parser/nqxml.rb +0 -29
  107. data/redist/xmlscan/samples/xmlbench/parser/rexml.rb +0 -62
  108. data/redist/xmlscan/samples/xmlbench/parser/xmlparser.rb +0 -22
  109. data/redist/xmlscan/samples/xmlbench/parser/xmlscan-0.0.10.rb +0 -62
  110. data/redist/xmlscan/samples/xmlbench/parser/xmlscan-chibixml.rb +0 -22
  111. data/redist/xmlscan/samples/xmlbench/parser/xmlscan-rexml.rb +0 -22
  112. data/redist/xmlscan/samples/xmlbench/parser/xmlscan.rb +0 -99
  113. data/redist/xmlscan/samples/xmlbench/xmlbench-lib.rb +0 -116
  114. data/redist/xmlscan/samples/xmlconftest.rb +0 -200
  115. data/redist/xmlscan/test.rb +0 -7
  116. data/redist/xmlscan/tests/deftestcase.rb +0 -73
  117. data/redist/xmlscan/tests/runtest.rb +0 -47
  118. data/redist/xmlscan/tests/testall.rb +0 -14
  119. data/redist/xmlscan/tests/testencoding.rb +0 -438
  120. data/redist/xmlscan/tests/testhtmlscan.rb +0 -752
  121. data/redist/xmlscan/tests/testnamespace.rb +0 -457
  122. data/redist/xmlscan/tests/testparser.rb +0 -591
  123. data/redist/xmlscan/tests/testscanner.rb +0 -1749
  124. data/redist/xmlscan/tests/testxmlchar.rb +0 -143
  125. data/redist/xmlscan/tests/visitor.rb +0 -34
@@ -4,7 +4,7 @@ $:.unshift File.join(File.dirname(__FILE__),"..","test")
4
4
  require 'test/unit'
5
5
  require 'rgen/transformer'
6
6
  require 'rgen/environment'
7
- require 'rgen/model_comparator'
7
+ require 'rgen/util/model_comparator'
8
8
  require 'metamodels/uml13_metamodel'
9
9
  require 'testmodel/class_model_checker'
10
10
 
@@ -236,7 +236,7 @@ class TransformerTest < Test::Unit::TestCase
236
236
  MODEL_DIR = File.join(File.dirname(__FILE__),"testmodel")
237
237
 
238
238
  include Testmodel::ClassModelChecker
239
- include RGen::ModelComparator
239
+ include RGen::Util::ModelComparator
240
240
 
241
241
  def test_copyTransformer
242
242
  envIn = RGen::Environment.new
@@ -251,4 +251,4 @@ class TransformerTest < Test::Unit::TestCase
251
251
  envOut.find(:class => UML13::Model).first)
252
252
  end
253
253
 
254
- end
254
+ end
@@ -0,0 +1,91 @@
1
+ $:.unshift(File.dirname(__FILE__)+"/../../lib")
2
+
3
+ require 'test/unit'
4
+ require 'fileutils'
5
+ require 'rgen/util/file_cache_map'
6
+
7
+ class FileCacheMapTest < Test::Unit::TestCase
8
+
9
+ TestDir = File.dirname(__FILE__)+"/file_cache_map_test/testdir"
10
+
11
+ def setup
12
+ FileUtils.rm_r(Dir[TestDir+"/*"])
13
+ # * doesn't include dot files
14
+ FileUtils.rm_r(Dir[TestDir+"/.cache"])
15
+ @cm = RGen::Util::FileCacheMap.new(".cache", ".test")
16
+ end
17
+
18
+ def test_nocache
19
+ assert_equal(:invalid, @cm.load_data(TestDir+"/fileA"))
20
+ end
21
+
22
+ def test_storeload
23
+ keyFile = TestDir+"/fileA"
24
+ File.open(keyFile, "w") {|f| f.write("somedata")}
25
+ @cm.store_data(keyFile, "valuedata")
26
+ assert(File.exist?(TestDir+"/.cache/fileA.test"))
27
+ assert_equal("valuedata", @cm.load_data(keyFile))
28
+ end
29
+
30
+ def test_storeload_subdir
31
+ keyFile = TestDir+"/subdir/fileA"
32
+ FileUtils.mkdir(TestDir+"/subdir")
33
+ File.open(keyFile, "w") {|f| f.write("somedata")}
34
+ @cm.store_data(keyFile, "valuedata")
35
+ assert(File.exist?(TestDir+"/subdir/.cache/fileA.test"))
36
+ assert_equal("valuedata", @cm.load_data(keyFile))
37
+ end
38
+
39
+ def test_storeload_postfix
40
+ keyFile = TestDir+"/fileB.txt"
41
+ File.open(keyFile, "w") {|f| f.write("somedata")}
42
+ @cm.store_data(keyFile, "valuedata")
43
+ assert(File.exist?(TestDir+"/.cache/fileB.txt.test"))
44
+ assert_equal("valuedata", @cm.load_data(keyFile))
45
+ end
46
+
47
+ def test_storeload_empty
48
+ keyFile = TestDir+"/fileA"
49
+ File.open(keyFile, "w") {|f| f.write("")}
50
+ @cm.store_data(keyFile, "valuedata")
51
+ assert(File.exist?(TestDir+"/.cache/fileA.test"))
52
+ assert_equal("valuedata", @cm.load_data(keyFile))
53
+ end
54
+
55
+ def test_corruptcache
56
+ keyFile = TestDir+"/fileA"
57
+ File.open(keyFile, "w") {|f| f.write("somedata")}
58
+ @cm.store_data(keyFile, "valuedata")
59
+ File.open(TestDir+"/.cache/fileA.test","a") {|f| f.write("more data")}
60
+ assert_equal(:invalid, @cm.load_data(keyFile))
61
+ end
62
+
63
+ def test_changedcontent
64
+ keyFile = TestDir+"/fileA"
65
+ File.open(keyFile, "w") {|f| f.write("somedata")}
66
+ @cm.store_data(keyFile, "valuedata")
67
+ File.open(keyFile, "a") {|f| f.write("more data")}
68
+ assert_equal(:invalid, @cm.load_data(keyFile))
69
+ end
70
+
71
+ def test_versioninfo
72
+ keyFile = TestDir+"/fileA"
73
+ File.open(keyFile, "w") {|f| f.write("somedata")}
74
+ @cm.version_info = "123"
75
+ @cm.store_data(keyFile, "valuedata")
76
+ assert(File.exist?(TestDir+"/.cache/fileA.test"))
77
+ assert_equal("valuedata", @cm.load_data(keyFile))
78
+ end
79
+
80
+ def test_changed_version
81
+ keyFile = TestDir+"/fileA"
82
+ File.open(keyFile, "w") {|f| f.write("somedata")}
83
+ @cm.version_info = "123"
84
+ @cm.store_data(keyFile, "valuedata")
85
+ @cm.version_info = "456"
86
+ assert_equal(:invalid, @cm.load_data(keyFile))
87
+ end
88
+
89
+ end
90
+
91
+
@@ -0,0 +1,4 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+
3
+ require 'util/file_cache_map_test'
4
+
@@ -3,7 +3,7 @@ $:.unshift File.join(File.dirname(__FILE__),"..","lib")
3
3
  require 'test/unit'
4
4
  require 'rgen/instantiator/default_xml_instantiator'
5
5
  require 'rgen/environment'
6
- require 'rgen/model_dumper'
6
+ require 'rgen/util/model_dumper'
7
7
  require 'xml_instantiator_test/simple_xmi_ecore_instantiator'
8
8
  require 'xml_instantiator_test/simple_ecore_model_checker'
9
9
 
@@ -11,146 +11,150 @@ module EmptyMM
11
11
  end
12
12
 
13
13
  module DefaultMM
14
- module MNS
15
- class Room < RGen::MetamodelBuilder::MMBase; end
16
- end
17
- class Person < RGen::MetamodelBuilder::MMBase; end
18
- Person.one_to_one 'personalRoom', MNS::Room, 'inhabitant'
14
+ module MNS
15
+ class Room < RGen::MetamodelBuilder::MMBase; end
16
+ end
17
+ class Person < RGen::MetamodelBuilder::MMBase; end
18
+ Person.one_to_one 'personalRoom', MNS::Room, 'inhabitant'
19
19
  end
20
20
 
21
21
  class XMLInstantiatorTest < Test::Unit::TestCase
22
22
 
23
- XML_DIR = File.join(File.dirname(__FILE__),"testmodel")
24
-
25
- include RGen::ModelDumper
26
-
27
- class MyInstantiator < RGen::Instantiator::DefaultXMLInstantiator
28
-
29
- map_tag_ns "testmodel.org/myNamespace", DefaultMM::MNS
30
-
23
+ XML_DIR = File.join(File.dirname(__FILE__),"testmodel")
24
+
25
+ include RGen::Util::ModelDumper
26
+
27
+ class MyInstantiator < RGen::Instantiator::DefaultXMLInstantiator
28
+
29
+ map_tag_ns "testmodel.org/myNamespace", DefaultMM::MNS
30
+
31
31
  def class_name(str)
32
32
  camelize(str)
33
33
  end
34
34
 
35
- # resolve :type do
36
- # @env.find(:xmi_id => getType).first
37
- # end
38
-
39
- resolve_by_id :personalRoom, :id => :getId, :src => :room
40
-
41
- end
42
-
43
- class PruneTestInstantiator < RGen::Instantiator::NodebasedXMLInstantiator
44
- attr_reader :max_depth
45
-
46
- set_prune_level 2
47
-
48
- def initialize(env)
49
- super(env)
50
- @max_depth = 0
51
- end
52
-
53
- def on_descent(node)
54
- end
55
-
56
- def on_ascent(node)
57
- calc_max_depth(node, 0)
58
- end
59
-
60
- def calc_max_depth(node, offset)
61
- if node.children.nil? || node.children.size == 0
62
- @max_depth = offset if offset > @max_depth
63
- else
64
- node.children.each do |c|
65
- calc_max_depth(c, offset+1)
66
- end
67
- end
68
- end
69
- end
70
-
71
- module PruneTestMM
72
- end
73
-
74
- def test_pruning
75
- env = RGen::Environment.new
76
-
77
- # prune level 2 is set in the class body
78
- inst = PruneTestInstantiator.new(env)
79
- inst.instantiate_file(File.join(XML_DIR,"manual_testmodel.xml"))
80
- assert_equal 2, inst.max_depth
81
-
82
- PruneTestInstantiator.set_prune_level(0)
83
- inst = PruneTestInstantiator.new(env)
84
- inst.instantiate_file(File.join(XML_DIR,"manual_testmodel.xml"))
85
- assert_equal 5, inst.max_depth
86
-
87
- PruneTestInstantiator.set_prune_level(1)
88
- inst = PruneTestInstantiator.new(env)
89
- inst.instantiate_file(File.join(XML_DIR,"manual_testmodel.xml"))
90
- assert_equal 1, inst.max_depth
91
- end
92
-
93
- def test_custom
94
- env = RGen::Environment.new
95
- inst = MyInstantiator.new(env, DefaultMM, true)
96
- inst.instantiate_file(File.join(XML_DIR,"manual_testmodel.xml"))
97
-
98
- house = env.find(:class => DefaultMM::MNS::House).first
99
- assert_not_nil house
100
- assert_equal 2, house.room.size
101
-
102
- rooms = env.find(:class => DefaultMM::MNS::Room)
103
- assert_equal 2, rooms.size
104
- assert_equal 0, (house.room - rooms).size
105
- rooms.each {|r| assert r.parent == house}
106
- tomsRoom = rooms.select{|r| r.name == "TomsRoom"}.first
107
- assert_not_nil tomsRoom
108
-
109
- persons = env.find(:class => DefaultMM::Person)
110
- assert_equal 4, persons.size
111
- tom = persons.select{|p| p.name == "Tom"}.first
112
- assert_not_nil tom
113
-
114
- assert tom.personalRoom == tomsRoom
115
-
116
- mpns = env.find(:class => DefaultMM::MultiPartName)
117
- assert mpns.first.respond_to?("insideMultiPart")
118
- end
119
-
120
- def test_default
121
- env = RGen::Environment.new
122
- inst = RGen::Instantiator::DefaultXMLInstantiator.new(env, EmptyMM, true)
123
- inst.instantiate_file(File.join(XML_DIR,"manual_testmodel.xml"))
124
-
125
- house = env.find(:class => EmptyMM::MNS_House).first
126
- assert_not_nil house
127
- assert_equal 2, house.mNS_Room.size
128
- assert_equal "before kitchen", house.chardata[0].strip
129
- assert_equal "after kitchen", house.chardata[1].strip
130
- assert_equal "after toms room", house.chardata[2].strip
131
-
132
- rooms = env.find(:class => EmptyMM::MNS_Room)
133
- assert_equal 2, rooms.size
134
- assert_equal 0, (house.mNS_Room - rooms).size
135
- rooms.each {|r| assert r.parent == house}
136
- tomsRoom = rooms.select{|r| r.name == "TomsRoom"}.first
137
- assert_not_nil tomsRoom
138
- assert_equal "within toms room", tomsRoom.chardata[0]
139
-
140
- persons = env.find(:class => EmptyMM::Person)
141
- assert_equal 4, persons.size
142
- tom = persons.select{|p| p.name == "Tom"}.first
143
- assert_not_nil tom
144
- end
35
+ # resolve :type do
36
+ # @env.find(:xmi_id => getType).first
37
+ # end
38
+
39
+ resolve_by_id :personalRoom, :id => :getId, :src => :room
40
+
41
+ end
42
+
43
+ class PruneTestInstantiator < RGen::Instantiator::NodebasedXMLInstantiator
44
+ attr_reader :max_depth
45
+
46
+ set_prune_level 2
47
+
48
+ def initialize(env)
49
+ super(env)
50
+ @max_depth = 0
51
+ end
52
+
53
+ def on_descent(node)
54
+ end
55
+
56
+ def on_ascent(node)
57
+ calc_max_depth(node, 0)
58
+ end
59
+
60
+ def calc_max_depth(node, offset)
61
+ if node.children.nil? || node.children.size == 0
62
+ @max_depth = offset if offset > @max_depth
63
+ else
64
+ node.children.each do |c|
65
+ calc_max_depth(c, offset+1)
66
+ end
67
+ end
68
+ end
69
+ end
70
+
71
+ module PruneTestMM
72
+ end
73
+
74
+ def test_pruning
75
+ env = RGen::Environment.new
76
+
77
+ # prune level 2 is set in the class body
78
+ inst = PruneTestInstantiator.new(env)
79
+ inst.instantiate_file(File.join(XML_DIR,"manual_testmodel.xml"))
80
+ assert_equal 2, inst.max_depth
81
+
82
+ PruneTestInstantiator.set_prune_level(0)
83
+ inst = PruneTestInstantiator.new(env)
84
+ inst.instantiate_file(File.join(XML_DIR,"manual_testmodel.xml"))
85
+ assert_equal 5, inst.max_depth
86
+
87
+ PruneTestInstantiator.set_prune_level(1)
88
+ inst = PruneTestInstantiator.new(env)
89
+ inst.instantiate_file(File.join(XML_DIR,"manual_testmodel.xml"))
90
+ assert_equal 1, inst.max_depth
91
+ end
92
+
93
+ def test_custom
94
+ env = RGen::Environment.new
95
+ inst = MyInstantiator.new(env, DefaultMM, true)
96
+ inst.instantiate_file(File.join(XML_DIR,"manual_testmodel.xml"))
97
+
98
+ house = env.find(:class => DefaultMM::MNS::House).first
99
+ assert_not_nil house
100
+ assert_equal 2, house.room.size
101
+
102
+ rooms = env.find(:class => DefaultMM::MNS::Room)
103
+ assert_equal 2, rooms.size
104
+ assert_equal 0, (house.room - rooms).size
105
+ rooms.each {|r| assert r.parent == house}
106
+ tomsRoom = rooms.select{|r| r.name == "TomsRoom"}.first
107
+ assert_not_nil tomsRoom
108
+
109
+ persons = env.find(:class => DefaultMM::Person)
110
+ assert_equal 4, persons.size
111
+ tom = persons.select{|p| p.name == "Tom"}.first
112
+ assert_not_nil tom
113
+
114
+ assert tom.personalRoom == tomsRoom
115
+
116
+ mpns = env.find(:class => DefaultMM::MultiPartName)
117
+ assert mpns.first.respond_to?("insideMultiPart")
118
+ end
119
+
120
+ def test_default
121
+ env = RGen::Environment.new
122
+ inst = RGen::Instantiator::DefaultXMLInstantiator.new(env, EmptyMM, true)
123
+ inst.instantiate_file(File.join(XML_DIR,"manual_testmodel.xml"))
124
+
125
+ house = env.find(:class => EmptyMM::MNS_House).first
126
+ assert_not_nil house
127
+ assert_equal 2, house.mNS_Room.size
128
+ assert_equal "before kitchen", remove_whitespace_elements(house.chardata)[0].strip
129
+ assert_equal "after kitchen", remove_whitespace_elements(house.chardata)[1].strip
130
+ assert_equal "after toms room", remove_whitespace_elements(house.chardata)[2].strip
131
+
132
+ rooms = env.find(:class => EmptyMM::MNS_Room)
133
+ assert_equal 2, rooms.size
134
+ assert_equal 0, (house.mNS_Room - rooms).size
135
+ rooms.each {|r| assert r.parent == house}
136
+ tomsRoom = rooms.select{|r| r.name == "TomsRoom"}.first
137
+ assert_not_nil tomsRoom
138
+ assert_equal "within toms room", remove_whitespace_elements(tomsRoom.chardata)[0]
139
+
140
+ persons = env.find(:class => EmptyMM::Person)
141
+ assert_equal 4, persons.size
142
+ tom = persons.select{|p| p.name == "Tom"}.first
143
+ assert_not_nil tom
144
+ end
145
145
 
146
- include SimpleECoreModelChecker
147
-
148
- def test_simle_xmi_ecore_instantiator
149
- envECore = RGen::Environment.new
150
- File.open(XML_DIR+"/ea_testmodel.xml") { |f|
151
- SimpleXMIECoreInstantiator.new.instantiateECoreModel(envECore, f.read)
152
- }
153
- checkECoreModel(envECore)
154
- end
155
-
156
- end
146
+ def remove_whitespace_elements(elements)
147
+ elements.reject{|e| e.strip == ""}
148
+ end
149
+
150
+ include SimpleECoreModelChecker
151
+
152
+ def test_simle_xmi_ecore_instantiator
153
+ envECore = RGen::Environment.new
154
+ File.open(XML_DIR+"/ea_testmodel.xml") { |f|
155
+ SimpleXMIECoreInstantiator.new.instantiateECoreModel(envECore, f.read)
156
+ }
157
+ checkECoreModel(envECore)
158
+ end
159
+
160
+ end
metadata CHANGED
@@ -1,34 +1,27 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rgen
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 5
8
- - 4
9
- version: 0.5.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.0
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Martin Thiede
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2010-11-07 00:00:00 +01:00
18
- default_executable:
12
+ date: 2012-07-30 00:00:00.000000000Z
19
13
  dependencies: []
20
-
21
- description: RGen is a framework supporting Model Driven Software Development (MDSD). This means that it helps you build Metamodels, instantiate Models, modify and transform Models and finally generate arbitrary textual content from it.
14
+ description: RGen is a framework supporting Model Driven Software Development (MDSD).
15
+ This means that it helps you build Metamodels, instantiate Models, modify and transform
16
+ Models and finally generate arbitrary textual content from it.
22
17
  email: martin dot thiede at gmx de
23
18
  executables: []
24
-
25
19
  extensions: []
26
-
27
- extra_rdoc_files:
20
+ extra_rdoc_files:
28
21
  - README
29
22
  - CHANGELOG
30
23
  - MIT-LICENSE
31
- files:
24
+ files:
32
25
  - lib/ea_support/ea_support.rb
33
26
  - lib/ea_support/id_store.rb
34
27
  - lib/ea_support/uml13_ea_metamodel.rb
@@ -44,13 +37,16 @@ files:
44
37
  - lib/mmgen/templates/annotations.tpl
45
38
  - lib/mmgen/templates/metamodel_generator.tpl
46
39
  - lib/rgen/array_extensions.rb
47
- - lib/rgen/auto_class_creator.rb
48
40
  - lib/rgen/ecore/ecore.rb
49
41
  - lib/rgen/ecore/ecore_builder_methods.rb
50
42
  - lib/rgen/ecore/ecore_ext.rb
51
- - lib/rgen/ecore/ecore_instantiator.rb
52
- - lib/rgen/ecore/ecore_transformer.rb
43
+ - lib/rgen/ecore/ecore_interface.rb
44
+ - lib/rgen/ecore/ecore_to_ruby.rb
45
+ - lib/rgen/ecore/ruby_to_ecore.rb
53
46
  - lib/rgen/environment.rb
47
+ - lib/rgen/fragment/dump_file_cache.rb
48
+ - lib/rgen/fragment/fragmented_model.rb
49
+ - lib/rgen/fragment/model_fragment.rb
54
50
  - lib/rgen/instantiator/abstract_instantiator.rb
55
51
  - lib/rgen/instantiator/abstract_xml_instantiator.rb
56
52
  - lib/rgen/instantiator/default_xml_instantiator.rb
@@ -67,20 +63,17 @@ files:
67
63
  - lib/rgen/metamodel_builder/constant_order_helper.rb
68
64
  - lib/rgen/metamodel_builder/data_types.rb
69
65
  - lib/rgen/metamodel_builder/intermediate/annotation.rb
70
- - lib/rgen/metamodel_builder/metamodel_description.rb
66
+ - lib/rgen/metamodel_builder/intermediate/feature.rb
71
67
  - lib/rgen/metamodel_builder/mm_multiple.rb
72
68
  - lib/rgen/metamodel_builder/module_extension.rb
73
69
  - lib/rgen/metamodel_builder.rb
74
- - lib/rgen/method_delegation.rb
75
70
  - lib/rgen/model_builder/builder_context.rb
76
71
  - lib/rgen/model_builder/model_serializer.rb
77
72
  - lib/rgen/model_builder/reference_resolver.rb
78
73
  - lib/rgen/model_builder.rb
79
- - lib/rgen/model_comparator.rb
80
- - lib/rgen/model_comparator_base.rb
81
- - lib/rgen/model_dumper.rb
82
- - lib/rgen/name_helper.rb
83
74
  - lib/rgen/serializer/json_serializer.rb
75
+ - lib/rgen/serializer/opposite_reference_filter.rb
76
+ - lib/rgen/serializer/qualified_name_provider.rb
84
77
  - lib/rgen/serializer/xmi11_serializer.rb
85
78
  - lib/rgen/serializer/xmi20_serializer.rb
86
79
  - lib/rgen/serializer/xml_serializer.rb
@@ -90,6 +83,16 @@ files:
90
83
  - lib/rgen/template_language/template_helper.rb
91
84
  - lib/rgen/template_language.rb
92
85
  - lib/rgen/transformer.rb
86
+ - lib/rgen/util/auto_class_creator.rb
87
+ - lib/rgen/util/cached_glob.rb
88
+ - lib/rgen/util/file_cache_map.rb
89
+ - lib/rgen/util/file_change_detector.rb
90
+ - lib/rgen/util/method_delegation.rb
91
+ - lib/rgen/util/model_comparator.rb
92
+ - lib/rgen/util/model_comparator_base.rb
93
+ - lib/rgen/util/model_dumper.rb
94
+ - lib/rgen/util/name_helper.rb
95
+ - lib/rgen/util/pattern_matcher.rb
93
96
  - lib/transformers/ecore_to_uml13.rb
94
97
  - lib/transformers/uml13_to_ecore.rb
95
98
  - test/array_extensions_test.rb
@@ -99,6 +102,7 @@ files:
99
102
  - test/environment_test.rb
100
103
  - test/json_test.rb
101
104
  - test/metamodel_builder_test.rb
105
+ - test/metamodel_from_ecore_test.rb
102
106
  - test/metamodel_order_test.rb
103
107
  - test/metamodel_roundtrip_test/houseMetamodel.ecore
104
108
  - test/metamodel_roundtrip_test/houseMetamodel_from_ecore.rb
@@ -128,6 +132,8 @@ files:
128
132
  - test/template_language_test/expected_result3.txt
129
133
  - test/template_language_test/indentStringTestDefaultIndent.out
130
134
  - test/template_language_test/indentStringTestTabIndent.out
135
+ - test/template_language_test/templates/callback_indent_test/a.tpl
136
+ - test/template_language_test/templates/callback_indent_test/b.tpl
131
137
  - test/template_language_test/templates/code/array.tpl
132
138
  - test/template_language_test/templates/content/author.tpl
133
139
  - test/template_language_test/templates/content/chapter.tpl
@@ -159,109 +165,48 @@ files:
159
165
  - test/testmodel/manual_testmodel.xml
160
166
  - test/testmodel/object_model_checker.rb
161
167
  - test/transformer_test.rb
168
+ - test/util/file_cache_map_test/testdir/fileA
169
+ - test/util/file_cache_map_test.rb
170
+ - test/util_test.rb
162
171
  - test/xml_instantiator_test/simple_ecore_model_checker.rb
163
172
  - test/xml_instantiator_test/simple_xmi_ecore_instantiator.rb
164
173
  - test/xml_instantiator_test/simple_xmi_metamodel.rb
165
174
  - test/xml_instantiator_test/simple_xmi_to_ecore.rb
166
175
  - test/xml_instantiator_test.rb
167
- - redist/xmlscan/ChangeLog
168
- - redist/xmlscan/doc/changes.html
169
- - redist/xmlscan/doc/changes.rd
170
- - redist/xmlscan/doc/en/conformance.html
171
- - redist/xmlscan/doc/en/conformance.rd
172
- - redist/xmlscan/doc/en/manual.html
173
- - redist/xmlscan/doc/en/manual.rd
174
- - redist/xmlscan/doc/ja/conformance.ja.html
175
- - redist/xmlscan/doc/ja/conformance.ja.rd
176
- - redist/xmlscan/doc/ja/manual.ja.html
177
- - redist/xmlscan/doc/ja/manual.ja.rd
178
- - redist/xmlscan/doc/src/conformance.rd.src
179
- - redist/xmlscan/doc/src/langsplit.rb
180
- - redist/xmlscan/doc/src/Makefile
181
- - redist/xmlscan/doc/src/manual.rd.src
182
- - redist/xmlscan/install.rb
183
- - redist/xmlscan/lib/xmlscan/encoding.rb
184
- - redist/xmlscan/lib/xmlscan/htmlscan.rb
185
- - redist/xmlscan/lib/xmlscan/namespace.rb
186
- - redist/xmlscan/lib/xmlscan/parser.rb
187
- - redist/xmlscan/lib/xmlscan/scanner.rb
188
- - redist/xmlscan/lib/xmlscan/version.rb
189
- - redist/xmlscan/lib/xmlscan/visitor.rb
190
- - redist/xmlscan/lib/xmlscan/xmlchar.rb
191
- - redist/xmlscan/memo/CONFORMANCE
192
- - redist/xmlscan/memo/contentspec.ry
193
- - redist/xmlscan/memo/PRODUCTIONS
194
- - redist/xmlscan/README
195
- - redist/xmlscan/samples/chibixml.rb
196
- - redist/xmlscan/samples/getxmlchar.rb
197
- - redist/xmlscan/samples/rexml.rb
198
- - redist/xmlscan/samples/xmlbench/parser/chibixml.rb
199
- - redist/xmlscan/samples/xmlbench/parser/nqxml.rb
200
- - redist/xmlscan/samples/xmlbench/parser/rexml.rb
201
- - redist/xmlscan/samples/xmlbench/parser/xmlparser.rb
202
- - redist/xmlscan/samples/xmlbench/parser/xmlscan-0.0.10.rb
203
- - redist/xmlscan/samples/xmlbench/parser/xmlscan-chibixml.rb
204
- - redist/xmlscan/samples/xmlbench/parser/xmlscan-rexml.rb
205
- - redist/xmlscan/samples/xmlbench/parser/xmlscan.rb
206
- - redist/xmlscan/samples/xmlbench/xmlbench-lib.rb
207
- - redist/xmlscan/samples/xmlbench.rb
208
- - redist/xmlscan/samples/xmlconftest.rb
209
- - redist/xmlscan/test.rb
210
- - redist/xmlscan/tests/deftestcase.rb
211
- - redist/xmlscan/tests/runtest.rb
212
- - redist/xmlscan/tests/testall.rb
213
- - redist/xmlscan/tests/testencoding.rb
214
- - redist/xmlscan/tests/testhtmlscan.rb
215
- - redist/xmlscan/tests/testnamespace.rb
216
- - redist/xmlscan/tests/testparser.rb
217
- - redist/xmlscan/tests/testscanner.rb
218
- - redist/xmlscan/tests/testxmlchar.rb
219
- - redist/xmlscan/tests/visitor.rb
220
- - redist/xmlscan/THANKS
221
176
  - README
222
177
  - CHANGELOG
223
178
  - MIT-LICENSE
224
179
  - Rakefile
225
- has_rdoc: true
226
180
  homepage: http://ruby-gen.org
227
181
  licenses: []
228
-
229
182
  post_install_message:
230
- rdoc_options:
183
+ rdoc_options:
231
184
  - --main
232
185
  - README
233
186
  - -x
234
- - redist
235
- - -x
236
187
  - test
237
188
  - -x
238
189
  - metamodels
239
190
  - -x
240
191
  - ea_support/uml13*
241
- require_paths:
192
+ require_paths:
242
193
  - lib
243
- required_ruby_version: !ruby/object:Gem::Requirement
194
+ required_ruby_version: !ruby/object:Gem::Requirement
244
195
  none: false
245
- requirements:
246
- - - ">="
247
- - !ruby/object:Gem::Version
248
- segments:
249
- - 0
250
- version: "0"
251
- required_rubygems_version: !ruby/object:Gem::Requirement
196
+ requirements:
197
+ - - ! '>='
198
+ - !ruby/object:Gem::Version
199
+ version: '0'
200
+ required_rubygems_version: !ruby/object:Gem::Requirement
252
201
  none: false
253
- requirements:
254
- - - ">="
255
- - !ruby/object:Gem::Version
256
- segments:
257
- - 0
258
- version: "0"
202
+ requirements:
203
+ - - ! '>='
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
259
206
  requirements: []
260
-
261
207
  rubyforge_project: rgen
262
- rubygems_version: 1.3.7
208
+ rubygems_version: 1.7.2
263
209
  signing_key:
264
210
  specification_version: 3
265
211
  summary: Ruby Modelling and Generator Framework
266
212
  test_files: []
267
-