rgen 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 5
8
+ - 1
9
+ version: 0.5.1
5
10
  platform: ruby
6
11
  authors:
7
12
  - Martin Thiede
@@ -9,7 +14,7 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-06-08 00:00:00 +02:00
17
+ date: 2009-11-10 00:00:00 +01:00
13
18
  default_executable:
14
19
  dependencies: []
15
20
 
@@ -24,7 +29,6 @@ extra_rdoc_files:
24
29
  - CHANGELOG
25
30
  - MIT-LICENSE
26
31
  files:
27
- - lib/ea_support
28
32
  - lib/ea_support/ea_support.rb
29
33
  - lib/ea_support/id_store.rb
30
34
  - lib/ea_support/uml13_ea_metamodel.rb
@@ -32,80 +36,61 @@ files:
32
36
  - lib/ea_support/uml13_ea_metamodel_generator.rb
33
37
  - lib/ea_support/uml13_ea_to_uml13.rb
34
38
  - lib/ea_support/uml13_to_uml13_ea.rb
35
- - lib/instantiators
36
- - lib/metamodels
37
39
  - lib/metamodels/uml13_metamodel.rb
38
40
  - lib/metamodels/uml13_metamodel_ext.rb
39
- - lib/mmgen
40
41
  - lib/mmgen/metamodel_generator.rb
41
42
  - lib/mmgen/mmgen.rb
42
- - lib/mmgen/mm_ext
43
43
  - lib/mmgen/mm_ext/ecore_mmgen_ext.rb
44
- - lib/mmgen/templates
45
44
  - lib/mmgen/templates/annotations.tpl
46
45
  - lib/mmgen/templates/metamodel_generator.tpl
47
- - lib/rgen
48
46
  - lib/rgen/array_extensions.rb
49
47
  - lib/rgen/auto_class_creator.rb
50
- - lib/rgen/ecore
51
48
  - lib/rgen/ecore/ecore.rb
52
49
  - lib/rgen/ecore/ecore_builder_methods.rb
53
50
  - lib/rgen/ecore/ecore_ext.rb
54
51
  - lib/rgen/ecore/ecore_instantiator.rb
55
52
  - lib/rgen/ecore/ecore_transformer.rb
56
53
  - lib/rgen/environment.rb
57
- - lib/rgen/instantiator
58
54
  - lib/rgen/instantiator/abstract_instantiator.rb
59
55
  - lib/rgen/instantiator/abstract_xml_instantiator.rb
60
56
  - lib/rgen/instantiator/default_xml_instantiator.rb
61
57
  - lib/rgen/instantiator/ecore_xml_instantiator.rb
62
58
  - lib/rgen/instantiator/nodebased_xml_instantiator.rb
63
59
  - lib/rgen/instantiator/xmi11_instantiator.rb
64
- - lib/rgen/metamodel_builder
65
60
  - lib/rgen/metamodel_builder/builder_extensions.rb
66
61
  - lib/rgen/metamodel_builder/builder_runtime.rb
67
62
  - lib/rgen/metamodel_builder/data_types.rb
68
- - lib/rgen/metamodel_builder/intermediate
69
63
  - lib/rgen/metamodel_builder/intermediate/annotation.rb
70
64
  - lib/rgen/metamodel_builder/metamodel_description.rb
71
65
  - lib/rgen/metamodel_builder/mm_multiple.rb
72
66
  - lib/rgen/metamodel_builder/module_extension.rb
73
- - lib/rgen/metamodel_builder/module_extension2.rb
74
67
  - lib/rgen/metamodel_builder.rb
75
68
  - lib/rgen/method_delegation.rb
76
- - lib/rgen/model_builder
77
69
  - lib/rgen/model_builder/builder_context.rb
78
70
  - lib/rgen/model_builder/model_serializer.rb
79
71
  - lib/rgen/model_builder/reference_resolver.rb
80
72
  - lib/rgen/model_builder.rb
81
73
  - lib/rgen/model_comparator.rb
74
+ - lib/rgen/model_comparator_base.rb
82
75
  - lib/rgen/model_dumper.rb
83
76
  - lib/rgen/name_helper.rb
84
- - lib/rgen/serializer
85
77
  - lib/rgen/serializer/xmi11_serializer.rb
86
78
  - lib/rgen/serializer/xmi20_serializer.rb
87
79
  - lib/rgen/serializer/xml_serializer.rb
88
- - lib/rgen/template_language
89
80
  - lib/rgen/template_language/directory_template_container.rb
90
81
  - lib/rgen/template_language/output_handler.rb
91
82
  - lib/rgen/template_language/template_container.rb
92
83
  - lib/rgen/template_language/template_helper.rb
93
84
  - lib/rgen/template_language.rb
94
85
  - lib/rgen/transformer.rb
95
- - lib/serializers
96
- - lib/transformers
97
86
  - lib/transformers/ecore_to_uml13.rb
98
87
  - lib/transformers/uml13_to_ecore.rb
99
88
  - test/array_extensions_test.rb
100
89
  - test/ea_instantiator_test.rb
101
- - test/ea_serializer_test
102
- - test/ea_serializer_test/ea_testmodel_regenerated.xml
103
- - test/ea_serializer_test/ea_testmodel_regenerated_import.log
104
90
  - test/ea_serializer_test.rb
105
91
  - test/ecore_self_test.rb
106
92
  - test/environment_test.rb
107
93
  - test/metamodel_builder_test.rb
108
- - test/metamodel_roundtrip_test
109
94
  - test/metamodel_roundtrip_test/houseMetamodel.ecore
110
95
  - test/metamodel_roundtrip_test/houseMetamodel_from_ecore.rb
111
96
  - test/metamodel_roundtrip_test/houseMetamodel_Regenerated.ecore
@@ -113,7 +98,6 @@ files:
113
98
  - test/metamodel_roundtrip_test/TestModel_Regenerated.rb
114
99
  - test/metamodel_roundtrip_test.rb
115
100
  - test/method_delegation_test.rb
116
- - test/model_builder
117
101
  - test/model_builder/builder_context_test.rb
118
102
  - test/model_builder/builder_test.rb
119
103
  - test/model_builder/ecore_internal.rb
@@ -121,88 +105,68 @@ files:
121
105
  - test/model_builder/ecore_original_regenerated.rb
122
106
  - test/model_builder/reference_resolver_test.rb
123
107
  - test/model_builder/serializer_test.rb
108
+ - test/model_builder/statemachine_metamodel.rb
109
+ - test/model_builder/test_model/statemachine1.rb
124
110
  - test/model_builder_test.rb
125
111
  - test/output_handler_test.rb
126
112
  - test/rgen_test.rb
127
- - test/template_language_test
128
113
  - test/template_language_test/expected_result1.txt
129
114
  - test/template_language_test/expected_result2.txt
130
115
  - test/template_language_test/expected_result3.txt
131
116
  - test/template_language_test/indentStringTestDefaultIndent.out
132
117
  - test/template_language_test/indentStringTestTabIndent.out
133
- - test/template_language_test/templates
134
- - test/template_language_test/templates/code
135
118
  - test/template_language_test/templates/code/array.tpl
136
- - test/template_language_test/templates/content
137
119
  - test/template_language_test/templates/content/author.tpl
138
120
  - test/template_language_test/templates/content/chapter.tpl
139
- - test/template_language_test/templates/define_local_test
140
121
  - test/template_language_test/templates/define_local_test/local.tpl
141
122
  - test/template_language_test/templates/define_local_test/test.tpl
142
- - test/template_language_test/templates/evaluate_test
143
123
  - test/template_language_test/templates/evaluate_test/test.tpl
144
124
  - test/template_language_test/templates/indent_string_test.tpl
145
- - test/template_language_test/templates/index
146
- - test/template_language_test/templates/index/c
147
125
  - test/template_language_test/templates/index/c/cmod.tpl
148
126
  - test/template_language_test/templates/index/chapter.tpl
149
127
  - test/template_language_test/templates/no_backslash_r_test.tpl
150
- - test/template_language_test/templates/no_indent_test
151
128
  - test/template_language_test/templates/no_indent_test/no_indent.tpl
152
- - test/template_language_test/templates/no_indent_test/sub1
153
129
  - test/template_language_test/templates/no_indent_test/sub1/no_indent.tpl
154
130
  - test/template_language_test/templates/no_indent_test/test.tpl
155
131
  - test/template_language_test/templates/no_indent_test/test2.tpl
156
132
  - test/template_language_test/templates/no_indent_test/test3.tpl
157
133
  - test/template_language_test/templates/null_context_test.tpl
158
134
  - test/template_language_test/templates/root.tpl
159
- - test/template_language_test/templates/template_resolution_test
160
- - test/template_language_test/templates/template_resolution_test/sub1
161
135
  - test/template_language_test/templates/template_resolution_test/sub1/sub1.tpl
162
136
  - test/template_language_test/templates/template_resolution_test/sub1.tpl
163
137
  - test/template_language_test/templates/template_resolution_test/test.tpl
164
138
  - test/template_language_test/testout.txt
165
139
  - test/template_language_test.rb
166
- - test/testmodel
167
140
  - test/testmodel/class_model_checker.rb
168
141
  - test/testmodel/ea_testmodel.eap
169
142
  - test/testmodel/ea_testmodel.xml
170
- - test/testmodel/ea_testmodel_import.log
171
143
  - test/testmodel/ea_testmodel_partial.xml
172
144
  - test/testmodel/ea_testmodel_regenerated.xml
173
145
  - test/testmodel/ecore_model_checker.rb
174
146
  - test/testmodel/manual_testmodel.xml
175
147
  - test/testmodel/object_model_checker.rb
176
148
  - test/transformer_test.rb
177
- - test/xml_instantiator_test
178
149
  - test/xml_instantiator_test/simple_ecore_model_checker.rb
179
150
  - test/xml_instantiator_test/simple_xmi_ecore_instantiator.rb
180
151
  - test/xml_instantiator_test/simple_xmi_metamodel.rb
181
152
  - test/xml_instantiator_test/simple_xmi_to_ecore.rb
182
153
  - test/xml_instantiator_test.rb
183
- - redist/xmlscan
184
154
  - redist/xmlscan/ChangeLog
185
- - redist/xmlscan/doc
186
155
  - redist/xmlscan/doc/changes.html
187
156
  - redist/xmlscan/doc/changes.rd
188
- - redist/xmlscan/doc/en
189
157
  - redist/xmlscan/doc/en/conformance.html
190
158
  - redist/xmlscan/doc/en/conformance.rd
191
159
  - redist/xmlscan/doc/en/manual.html
192
160
  - redist/xmlscan/doc/en/manual.rd
193
- - redist/xmlscan/doc/ja
194
161
  - redist/xmlscan/doc/ja/conformance.ja.html
195
162
  - redist/xmlscan/doc/ja/conformance.ja.rd
196
163
  - redist/xmlscan/doc/ja/manual.ja.html
197
164
  - redist/xmlscan/doc/ja/manual.ja.rd
198
- - redist/xmlscan/doc/src
199
165
  - redist/xmlscan/doc/src/conformance.rd.src
200
166
  - redist/xmlscan/doc/src/langsplit.rb
201
167
  - redist/xmlscan/doc/src/Makefile
202
168
  - redist/xmlscan/doc/src/manual.rd.src
203
169
  - redist/xmlscan/install.rb
204
- - redist/xmlscan/lib
205
- - redist/xmlscan/lib/xmlscan
206
170
  - redist/xmlscan/lib/xmlscan/encoding.rb
207
171
  - redist/xmlscan/lib/xmlscan/htmlscan.rb
208
172
  - redist/xmlscan/lib/xmlscan/namespace.rb
@@ -211,17 +175,13 @@ files:
211
175
  - redist/xmlscan/lib/xmlscan/version.rb
212
176
  - redist/xmlscan/lib/xmlscan/visitor.rb
213
177
  - redist/xmlscan/lib/xmlscan/xmlchar.rb
214
- - redist/xmlscan/memo
215
178
  - redist/xmlscan/memo/CONFORMANCE
216
179
  - redist/xmlscan/memo/contentspec.ry
217
180
  - redist/xmlscan/memo/PRODUCTIONS
218
181
  - redist/xmlscan/README
219
- - redist/xmlscan/samples
220
182
  - redist/xmlscan/samples/chibixml.rb
221
183
  - redist/xmlscan/samples/getxmlchar.rb
222
184
  - redist/xmlscan/samples/rexml.rb
223
- - redist/xmlscan/samples/xmlbench
224
- - redist/xmlscan/samples/xmlbench/parser
225
185
  - redist/xmlscan/samples/xmlbench/parser/chibixml.rb
226
186
  - redist/xmlscan/samples/xmlbench/parser/nqxml.rb
227
187
  - redist/xmlscan/samples/xmlbench/parser/rexml.rb
@@ -234,7 +194,6 @@ files:
234
194
  - redist/xmlscan/samples/xmlbench.rb
235
195
  - redist/xmlscan/samples/xmlconftest.rb
236
196
  - redist/xmlscan/test.rb
237
- - redist/xmlscan/tests
238
197
  - redist/xmlscan/tests/deftestcase.rb
239
198
  - redist/xmlscan/tests/runtest.rb
240
199
  - redist/xmlscan/tests/testall.rb
@@ -251,7 +210,9 @@ files:
251
210
  - MIT-LICENSE
252
211
  - Rakefile
253
212
  has_rdoc: true
254
- homepage: ruby-gen.org
213
+ homepage: http://ruby-gen.org
214
+ licenses: []
215
+
255
216
  post_install_message:
256
217
  rdoc_options:
257
218
  - --main
@@ -267,23 +228,27 @@ rdoc_options:
267
228
  require_paths:
268
229
  - lib
269
230
  required_ruby_version: !ruby/object:Gem::Requirement
231
+ none: false
270
232
  requirements:
271
233
  - - ">="
272
234
  - !ruby/object:Gem::Version
235
+ segments:
236
+ - 0
273
237
  version: "0"
274
- version:
275
238
  required_rubygems_version: !ruby/object:Gem::Requirement
239
+ none: false
276
240
  requirements:
277
241
  - - ">="
278
242
  - !ruby/object:Gem::Version
243
+ segments:
244
+ - 0
279
245
  version: "0"
280
- version:
281
246
  requirements: []
282
247
 
283
248
  rubyforge_project: rgen
284
- rubygems_version: 1.1.1
249
+ rubygems_version: 1.3.7
285
250
  signing_key:
286
- specification_version: 2
251
+ specification_version: 3
287
252
  summary: Ruby Modelling and Generator Framework
288
253
  test_files: []
289
254
 
@@ -1,205 +0,0 @@
1
- require 'rgen/ecore/ecore_ext'
2
-
3
- module RGen
4
-
5
- module ModelBuilder
6
-
7
- class BuilderContext
8
- attr_accessor :contextElement, :resolver
9
- end
10
-
11
- class ReferenceResolver
12
- ResolverJob = Struct.new(:receiver, :reference, :namespace, :string)
13
-
14
- class ResolverException < Exception
15
- end
16
-
17
- def addJob(job)
18
- @jobs ||= []
19
- @jobs << job
20
- end
21
-
22
- def resolve(env=nil)
23
- (@jobs || []).each do |job|
24
- begin
25
- target = resolveReference(env, job.namespace, job.string.split("."), job.reference.eType.instanceClass, true)
26
- rescue ResolverException => e
27
- raise ResolverException.new("Can not resolve reference #{job.string}: #{e.message}")
28
- end
29
- if job.reference.many
30
- job.receiver.addGeneric(job.reference.name, target)
31
- else
32
- job.receiver.setGeneric(job.reference.name, target)
33
- end
34
- end
35
- end
36
-
37
- private
38
-
39
- def resolveReference(env, namespace, nameParts, targetClass, toplevel=false)
40
- #puts "resolveReferences nameParts " + nameParts.inspect + " namespace #{namespace}"
41
- firstPart, *restParts = nameParts
42
- if namespace
43
- children = elementChildren(namespace)
44
- #puts children.inspect
45
- #puts "looking for a element named #{firstPart}"
46
- elements = children.select{|e| e.respond_to?(:name) && e.name == firstPart}
47
- #puts elements.inspect
48
- #puts elementParents(namespace).inspect
49
- if elements.empty? && elementParents(namespace).size > 0 && toplevel
50
- #puts "Trying parent"
51
- raise ResolverException.new("Element #{namespace} has multiple parents") if elementParents(namespace).size > 1
52
- elements << resolveReference(env, elementParents(namespace).first, nameParts, targetClass, true)
53
- else
54
- where = "within children of #{namespace}"
55
- where += " named #{namespace.name}" if namespace.respond_to?(:name)
56
- end
57
- elsif env
58
- elements = env.find(:class => targetClass, :name => firstPart)
59
- where = "in environment"
60
- else
61
- raise ResolverException.new("Neither namespace nor environment specified")
62
- end
63
- raise ResolverException.new("Can not find element named #{firstPart} #{where}") if elements.size == 0
64
- raise ResolverException.new("Multiple elements named #{firstPart} found #{where}") if elements.size > 1
65
- if restParts.size > 0
66
- resolveReference(env, elements.first, restParts, targetClass)
67
- else
68
- elements.first
69
- end
70
- end
71
-
72
- def elementChildren(element)
73
- @elementChildren ||= {}
74
- return @elementChildren[element] if @elementChildren[element]
75
- children = element.class.ecore.eAllReferences.select{|r| r.containment}.collect do |r|
76
- element.getGeneric(r.name)
77
- end.flatten.compact
78
- @elementChildren[element] = children
79
- end
80
-
81
- def elementParents(element)
82
- @elementParents ||= {}
83
- return @elementParents[element] if @elementParents[element]
84
- parents = element.class.ecore.eAllReferences.select{|r| r.eOpposite && r.eOpposite.containment}.collect do |r|
85
- element.getGeneric(r.name)
86
- end.flatten.compact
87
- @elementParents[element] = parents
88
- end
89
- end
90
-
91
- # this module takes up helper methods to avoid littering the package modules
92
- module Helper
93
- class << self
94
- def processArguments(args)
95
- unless (args.size == 2 && args.first.is_a?(String) && args.last.is_a?(Hash)) ||
96
- (args.size == 1 && (args.first.is_a?(String) || args.first.is_a?(Hash)))
97
- raise "Provide a Hash to set feature values, " +
98
- "optionally the first argument may be a String specifying " +
99
- "the value of the \"name\" attribute."
100
- end
101
- if args.last.is_a?(Hash)
102
- argHash = args.last
103
- else
104
- argHash = {}
105
- end
106
- argHash[:name] ||= args.first if args.first.is_a?(String)
107
- argHash
108
- end
109
-
110
- def processArgHash(argHash, eClass)
111
- resolverJobs = []
112
- asRole = nil
113
- argHash.each_pair do |k,v|
114
- if k == :as
115
- asRole = v
116
- argHash.delete(k)
117
- elsif v.is_a?(String)
118
- ref = eClass.eAllReferences.find{|r| r.name == k.to_s}
119
- if ref
120
- argHash.delete(k)
121
- resolverJobs << ReferenceResolver::ResolverJob.new(nil, ref, nil, v)
122
- end
123
- end
124
- end
125
- [ resolverJobs, asRole ]
126
- end
127
-
128
- def associateWithContextElement(element, contextElement, asRole)
129
- return unless contextElement
130
- contextClass = contextElement.class.ecore
131
- if asRole
132
- asRoleRef = contextClass.eAllReferences.find{|r| r.name == asRole.to_s}
133
- raise "Context class #{contextClass.name} has no reference named #{asRole}" unless asRoleRef
134
- ref = asRoleRef
135
- else
136
- possibleContainmentRefs = contextClass.eAllReferences.select { |r| r.containment &&
137
- (element.class.ecore.eAllSuperTypes << element.class.ecore).include?(r.eType) }
138
- if possibleContainmentRefs.size == 1
139
- ref = possibleContainmentRefs.first
140
- elsif possibleContainmentRefs.size == 0
141
- raise "Context class #{contextClass.name} can not contain a #{element.class.ecore.name}"
142
- else
143
- raise "Context class #{contextClass.name} has several containment references to a #{element.class.ecore.name}." +
144
- " Clearify using \":as => <role>\""
145
- end
146
- end
147
- if ref.many
148
- contextElement.addGeneric(ref.name, element)
149
- else
150
- contextElement.setGeneric(ref.name, element)
151
- end
152
- end
153
- end
154
- end
155
-
156
- end
157
-
158
- module MetamodelBuilder
159
-
160
- module ModuleExtension
161
-
162
- def method_missing(m, *args, &block)
163
- return super unless self.ecore.is_a?(RGen::ECore::EPackage)
164
- className = m.to_s[0..0].upcase + m.to_s[1..-1]
165
- eClass = self.ecore.eClasses.find{|c| c.name == className}
166
- return super unless eClass
167
- argHash = ModelBuilder::Helper.processArguments(args)
168
- resolverJobs, asRole = ModelBuilder::Helper.processArgHash(argHash, eClass)
169
- element = eClass.instanceClass.new(argHash)
170
- if @builderContext
171
- ModelBuilder::Helper.associateWithContextElement(element, @builderContext.contextElement, asRole)
172
- resolver = @builderContext.resolver
173
- else
174
- resolver = ModelBuilder::ReferenceResolver.new
175
- end
176
- resolverJobs.each do |job|
177
- job.receiver = element
178
- job.namespace = @builderContext && @builderContext.contextElement
179
- resolver.addJob(job)
180
- end
181
- # process block
182
- if block
183
- if @builderContext
184
- @builderContext, oldContext = @builderContext.dup, @builderContext
185
- else
186
- @builderContext = ModelBuilder::BuilderContext.new
187
- @builderContext.resolver = resolver
188
- oldContext = nil
189
- end
190
- @builderContext.contextElement = element
191
- instance_eval(&block)
192
- @builderContext = oldContext
193
- if oldContext.nil?
194
- # we are back on toplevel
195
- resolver.resolve
196
- end
197
- end
198
- element
199
- end
200
-
201
- end
202
-
203
- end
204
-
205
- end