expressir 0.2.7-x86-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.cross_rubies +30 -0
- data/.github/workflows/rake.yml +45 -0
- data/.github/workflows/release.yml +84 -0
- data/.gitignore +17 -0
- data/.gitmodules +3 -0
- data/.rspec +2 -0
- data/.rubocop.yml +508 -0
- data/Gemfile +4 -0
- data/README.adoc +147 -0
- data/Rakefile +11 -0
- data/bin/console +12 -0
- data/bin/rspec +29 -0
- data/bin/setup +8 -0
- data/demo.rb +18 -0
- data/docs/development.md +90 -0
- data/exe/expressir +20 -0
- data/exe/generate-parser +48 -0
- data/expressir.gemspec +43 -0
- data/lib/expressir/cli/ui.rb +36 -0
- data/lib/expressir/cli.rb +27 -0
- data/lib/expressir/config.rb +23 -0
- data/lib/expressir/express/aggregate_dimension.rb +38 -0
- data/lib/expressir/express/attribute.rb +15 -0
- data/lib/expressir/express/comment.rb +7 -0
- data/lib/expressir/express/defined_type.rb +36 -0
- data/lib/expressir/express/derived.rb +65 -0
- data/lib/expressir/express/derived_aggregate.rb +43 -0
- data/lib/expressir/express/entity.rb +137 -0
- data/lib/expressir/express/explicit.rb +70 -0
- data/lib/expressir/express/explicit_aggregate.rb +46 -0
- data/lib/expressir/express/explicit_or_derived.rb +16 -0
- data/lib/expressir/express/global_rule.rb +44 -0
- data/lib/expressir/express/interface_specification.rb +51 -0
- data/lib/expressir/express/interfaced_item.rb +38 -0
- data/lib/expressir/express/inverse.rb +46 -0
- data/lib/expressir/express/inverse_aggregate.rb +37 -0
- data/lib/expressir/express/model_element.rb +7 -0
- data/lib/expressir/express/named_type.rb +19 -0
- data/lib/expressir/express/remark.rb +8 -0
- data/lib/expressir/express/repository.rb +306 -0
- data/lib/expressir/express/schema_definition.rb +96 -0
- data/lib/expressir/express/subtype_constraint.rb +14 -0
- data/lib/expressir/express/type.rb +26 -0
- data/lib/expressir/express/type_aggregate.rb +42 -0
- data/lib/expressir/express/type_enum.rb +29 -0
- data/lib/expressir/express/type_parser.rb +45 -0
- data/lib/expressir/express/type_select.rb +82 -0
- data/lib/expressir/express/unique_rule.rb +35 -0
- data/lib/expressir/express/where_rule.rb +32 -0
- data/lib/expressir/express.rb +11 -0
- data/lib/expressir/express_exp/2.4/express_parser.so +0 -0
- data/lib/expressir/express_exp/2.5/express_parser.so +0 -0
- data/lib/expressir/express_exp/2.6/express_parser.so +0 -0
- data/lib/expressir/express_exp/2.7/express_parser.so +0 -0
- data/lib/expressir/express_exp/3.0/express_parser.so +0 -0
- data/lib/expressir/express_exp/formatter.rb +1450 -0
- data/lib/expressir/express_exp/parser.rb +41 -0
- data/lib/expressir/express_exp/visitor.rb +2464 -0
- data/lib/expressir/express_parser.rb +30 -0
- data/lib/expressir/model/attribute.rb +27 -0
- data/lib/expressir/model/constant.rb +17 -0
- data/lib/expressir/model/entity.rb +46 -0
- data/lib/expressir/model/enumeration_item.rb +11 -0
- data/lib/expressir/model/expressions/aggregate_initializer.rb +13 -0
- data/lib/expressir/model/expressions/aggregate_item.rb +15 -0
- data/lib/expressir/model/expressions/attribute_reference.rb +15 -0
- data/lib/expressir/model/expressions/binary_expression.rb +40 -0
- data/lib/expressir/model/expressions/call.rb +15 -0
- data/lib/expressir/model/expressions/entity_constructor.rb +15 -0
- data/lib/expressir/model/expressions/group_reference.rb +15 -0
- data/lib/expressir/model/expressions/index_reference.rb +17 -0
- data/lib/expressir/model/expressions/interval.rb +21 -0
- data/lib/expressir/model/expressions/query_expression.rb +26 -0
- data/lib/expressir/model/expressions/simple_reference.rb +13 -0
- data/lib/expressir/model/expressions/unary_expression.rb +19 -0
- data/lib/expressir/model/function.rb +62 -0
- data/lib/expressir/model/identifier.rb +10 -0
- data/lib/expressir/model/interface.rb +18 -0
- data/lib/expressir/model/literals/binary.rb +13 -0
- data/lib/expressir/model/literals/integer.rb +13 -0
- data/lib/expressir/model/literals/logical.rb +17 -0
- data/lib/expressir/model/literals/real.rb +13 -0
- data/lib/expressir/model/literals/string.rb +15 -0
- data/lib/expressir/model/parameter.rb +17 -0
- data/lib/expressir/model/procedure.rb +60 -0
- data/lib/expressir/model/renamed_ref.rb +13 -0
- data/lib/expressir/model/repository.rb +19 -0
- data/lib/expressir/model/rule.rb +62 -0
- data/lib/expressir/model/schema.rb +67 -0
- data/lib/expressir/model/scope.rb +17 -0
- data/lib/expressir/model/statements/alias.rb +26 -0
- data/lib/expressir/model/statements/assignment.rb +15 -0
- data/lib/expressir/model/statements/call.rb +15 -0
- data/lib/expressir/model/statements/case.rb +17 -0
- data/lib/expressir/model/statements/case_action.rb +15 -0
- data/lib/expressir/model/statements/compound.rb +13 -0
- data/lib/expressir/model/statements/escape.rb +8 -0
- data/lib/expressir/model/statements/if.rb +17 -0
- data/lib/expressir/model/statements/null.rb +8 -0
- data/lib/expressir/model/statements/repeat.rb +34 -0
- data/lib/expressir/model/statements/return.rb +13 -0
- data/lib/expressir/model/statements/skip.rb +8 -0
- data/lib/expressir/model/subtype_constraint.rb +27 -0
- data/lib/expressir/model/type.rb +24 -0
- data/lib/expressir/model/types/aggregate.rb +17 -0
- data/lib/expressir/model/types/array.rb +21 -0
- data/lib/expressir/model/types/bag.rb +17 -0
- data/lib/expressir/model/types/binary.rb +15 -0
- data/lib/expressir/model/types/boolean.rb +8 -0
- data/lib/expressir/model/types/enumeration.rb +19 -0
- data/lib/expressir/model/types/generic.rb +13 -0
- data/lib/expressir/model/types/generic_entity.rb +13 -0
- data/lib/expressir/model/types/integer.rb +8 -0
- data/lib/expressir/model/types/list.rb +19 -0
- data/lib/expressir/model/types/logical.rb +8 -0
- data/lib/expressir/model/types/number.rb +8 -0
- data/lib/expressir/model/types/real.rb +13 -0
- data/lib/expressir/model/types/select.rb +21 -0
- data/lib/expressir/model/types/set.rb +17 -0
- data/lib/expressir/model/types/string.rb +15 -0
- data/lib/expressir/model/unique.rb +15 -0
- data/lib/expressir/model/variable.rb +17 -0
- data/lib/expressir/model/where.rb +15 -0
- data/lib/expressir/model.rb +65 -0
- data/lib/expressir/parser/owl_parser.rb +8 -0
- data/lib/expressir/parser.rb +6 -0
- data/lib/expressir/version.rb +3 -0
- data/lib/expressir.rb +21 -0
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.exp +9589 -0
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.owl +36619 -0
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.xml +13294 -0
- data/original/examples/employment/eclipse/.project +17 -0
- data/original/examples/employment/eclipse/Export/Employment.png +0 -0
- data/original/examples/employment/eclipse/Express/employment_schema.exp +33 -0
- data/original/examples/employment/eclipse/Express/employment_schema.xmi +77 -0
- data/original/examples/employment/eclipse/Express/employment_schema.xml +93 -0
- data/original/examples/employment/eclipse/Models/Employment.uml +4 -0
- data/original/examples/employment/eclipse/Models/Employment.umldi +240 -0
- data/original/examples/employment/eclipse/readme.txt +7 -0
- data/original/examples/employment/employment_schema.exp +33 -0
- data/original/examples/employment/employment_schema.rb +232 -0
- data/original/examples/employment/employment_schema.xml +93 -0
- data/original/examples/employment/employment_schema___module.rb +46 -0
- data/original/examples/employment/employment_schema___p28attr.rb +126 -0
- data/original/examples/employment/employment_schema___p28inst.rb +26 -0
- data/original/examples/employment/example_employment_data.xml +1 -0
- data/original/examples/employment/example_employment_data_copy.xml +1 -0
- data/original/examples/employment/example_employment_reader.rb +30 -0
- data/original/examples/employment/example_employment_writer.rb +51 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.exp +3710 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.owl +35880 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xmi +15357 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xml +9468 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.exp +8404 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.owl +43147 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xmi +18341 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xml +11632 -0
- data/original/examples/syntax/remark.exp +146 -0
- data/original/examples/syntax/remark_formatted.exp +175 -0
- data/original/examples/syntax/syntax.exp +311 -0
- data/original/examples/syntax/syntax_formatted.exp +1191 -0
- data/original/exp2ruby.rb +525 -0
- data/original/expsm.rb +34 -0
- data/original/mapping_owl.rb +1018 -0
- data/original/mapping_sysml.rb +2281 -0
- data/original/mapping_uml2.rb +599 -0
- data/original/mapping_uml2_eclipse.rb +433 -0
- data/original/reeper.rb +134 -0
- data/rakelib/cross-ruby.rake +308 -0
- data/spec/acceptance/express_to_owl_spec.rb +18 -0
- data/spec/acceptance/version_spec.rb +12 -0
- data/spec/expressir/express/repository_spec.rb +25 -0
- data/spec/expressir/express_exp/ap233_spec.rb +22 -0
- data/spec/expressir/express_exp/format_remark_spec.rb +28 -0
- data/spec/expressir/express_exp/format_syntax_spec.rb +28 -0
- data/spec/expressir/express_exp/parse_remark_spec.rb +346 -0
- data/spec/expressir/express_exp/parse_syntax_spec.rb +3003 -0
- data/spec/expressir/model/find_spec.rb +110 -0
- data/spec/expressr_spec.rb +5 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/support/console_helper.rb +29 -0
- metadata +357 -0
@@ -0,0 +1,308 @@
|
|
1
|
+
require "rbconfig"
|
2
|
+
require "shellwords"
|
3
|
+
|
4
|
+
CrossRuby = Struct.new(:version, :host) do
|
5
|
+
WINDOWS_PLATFORM_REGEX = /mingw|mswin/
|
6
|
+
MINGW32_PLATFORM_REGEX = /mingw32/
|
7
|
+
LINUX_PLATFORM_REGEX = /linux/
|
8
|
+
DARWIN_PLATFORM_REGEX = /darwin/
|
9
|
+
|
10
|
+
def windows?
|
11
|
+
!!(platform =~ WINDOWS_PLATFORM_REGEX)
|
12
|
+
end
|
13
|
+
|
14
|
+
def linux?
|
15
|
+
!!(platform =~ LINUX_PLATFORM_REGEX)
|
16
|
+
end
|
17
|
+
|
18
|
+
def darwin?
|
19
|
+
!!(platform =~ DARWIN_PLATFORM_REGEX)
|
20
|
+
end
|
21
|
+
|
22
|
+
def ver
|
23
|
+
@ver ||= version[/\A[^-]+/]
|
24
|
+
end
|
25
|
+
|
26
|
+
def minor_ver
|
27
|
+
@minor_ver ||= ver[/\A\d\.\d(?=\.)/]
|
28
|
+
end
|
29
|
+
|
30
|
+
def api_ver_suffix
|
31
|
+
case minor_ver
|
32
|
+
when nil
|
33
|
+
raise "CrossRuby.api_ver_suffix: unsupported version: #{ver}"
|
34
|
+
else
|
35
|
+
minor_ver.delete(".") << "0"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def platform
|
40
|
+
@platform ||= case host
|
41
|
+
when /\Ax86_64.*mingw32/
|
42
|
+
"x64-mingw32"
|
43
|
+
when /\Ai[3-6]86.*mingw32/
|
44
|
+
"x86-mingw32"
|
45
|
+
when /\Ax86_64.*linux/
|
46
|
+
"x86_64-linux"
|
47
|
+
when /\Ai[3-6]86.*linux/
|
48
|
+
"x86-linux"
|
49
|
+
when /\Ax86_64-darwin/
|
50
|
+
"x86_64-darwin"
|
51
|
+
when /\Aarm64-darwin/
|
52
|
+
"arm64-darwin"
|
53
|
+
else
|
54
|
+
raise "CrossRuby.platform: unsupported host: #{host}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def tool(name)
|
59
|
+
(@binutils_prefix ||= case platform
|
60
|
+
when "x64-mingw32"
|
61
|
+
"x86_64-w64-mingw32-"
|
62
|
+
when "x86-mingw32"
|
63
|
+
"i686-w64-mingw32-"
|
64
|
+
when "x86_64-linux"
|
65
|
+
"x86_64-redhat-linux-"
|
66
|
+
when "x86-linux"
|
67
|
+
"i686-redhat-linux-"
|
68
|
+
when /x86_64.*darwin/
|
69
|
+
"x86_64-apple-darwin-"
|
70
|
+
when /a.*64.*darwin/
|
71
|
+
"aarch64-apple-darwin-"
|
72
|
+
else
|
73
|
+
raise "CrossRuby.tool: unmatched platform: #{platform}"
|
74
|
+
end) + name
|
75
|
+
end
|
76
|
+
|
77
|
+
def target_file_format
|
78
|
+
case platform
|
79
|
+
when "x64-mingw32"
|
80
|
+
"pei-x86-64"
|
81
|
+
when "x86-mingw32"
|
82
|
+
"pei-i386"
|
83
|
+
when "x86_64-linux"
|
84
|
+
"elf64-x86-64"
|
85
|
+
when "x86-linux"
|
86
|
+
"elf32-i386"
|
87
|
+
when "x86_64-darwin"
|
88
|
+
"Mach-O 64-bit x86-64" # hmm
|
89
|
+
when "arm64-darwin"
|
90
|
+
"Mach-O arm64"
|
91
|
+
else
|
92
|
+
raise "CrossRuby.target_file_format: unmatched platform: #{platform}"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def dll_ext
|
97
|
+
darwin? ? "bundle" : "so"
|
98
|
+
end
|
99
|
+
|
100
|
+
def dll_staging_path
|
101
|
+
"tmp/#{platform}/stage/lib/#{GEMSPEC.name}/#{minor_ver}/#{GEMSPEC.name}.#{dll_ext}"
|
102
|
+
end
|
103
|
+
|
104
|
+
def libruby_dll
|
105
|
+
case platform
|
106
|
+
when "x64-mingw32"
|
107
|
+
"x64-msvcrt-ruby#{api_ver_suffix}.dll"
|
108
|
+
when "x86-mingw32"
|
109
|
+
"msvcrt-ruby#{api_ver_suffix}.dll"
|
110
|
+
else
|
111
|
+
raise "CrossRuby.libruby_dll: unmatched platform: #{platform}"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def allowed_dlls
|
116
|
+
case platform
|
117
|
+
when MINGW32_PLATFORM_REGEX
|
118
|
+
[
|
119
|
+
"kernel32.dll",
|
120
|
+
"msvcrt.dll",
|
121
|
+
"ws2_32.dll",
|
122
|
+
"user32.dll",
|
123
|
+
"advapi32.dll",
|
124
|
+
libruby_dll,
|
125
|
+
]
|
126
|
+
when LINUX_PLATFORM_REGEX
|
127
|
+
[
|
128
|
+
"libm.so.6",
|
129
|
+
*(case
|
130
|
+
when ver < "2.6.0"
|
131
|
+
"libpthread.so.0"
|
132
|
+
end),
|
133
|
+
"libc.so.6",
|
134
|
+
"libdl.so.2", # on old dists only - now in libc
|
135
|
+
]
|
136
|
+
when DARWIN_PLATFORM_REGEX
|
137
|
+
[
|
138
|
+
"/usr/lib/libSystem.B.dylib",
|
139
|
+
"/usr/lib/liblzma.5.dylib",
|
140
|
+
"/usr/lib/libobjc.A.dylib",
|
141
|
+
]
|
142
|
+
else
|
143
|
+
raise "CrossRuby.allowed_dlls: unmatched platform: #{platform}"
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
def dll_ref_versions
|
148
|
+
case platform
|
149
|
+
when LINUX_PLATFORM_REGEX
|
150
|
+
{ "GLIBC" => "2.17" }
|
151
|
+
else
|
152
|
+
raise "CrossRuby.dll_ref_versions: unmatched platform: #{platform}"
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
CROSS_RUBIES = File.read(".cross_rubies").split("\n").map do |line|
|
158
|
+
case line
|
159
|
+
when /\A([^#]+):([^#]+)/
|
160
|
+
CrossRuby.new($1, $2)
|
161
|
+
end
|
162
|
+
end.compact
|
163
|
+
|
164
|
+
ENV["RUBY_CC_VERSION"] = CROSS_RUBIES.map(&:ver).uniq.join(":")
|
165
|
+
|
166
|
+
require "rake_compiler_dock"
|
167
|
+
|
168
|
+
def verify_dll(dll, cross_ruby)
|
169
|
+
allowed_imports = cross_ruby.allowed_dlls
|
170
|
+
dump = `#{["env", "LANG=C", cross_ruby.tool("objdump"), "-p", dll].shelljoin}`
|
171
|
+
|
172
|
+
if cross_ruby.windows?
|
173
|
+
raise "unexpected file format for generated dll #{dll}" unless /file format #{Regexp.quote(cross_ruby.target_file_format)}\s/ === dump
|
174
|
+
raise "export function Init_nokogiri not in dll #{dll}" unless /Table.*\sInit_nokogiri\s/mi === dump
|
175
|
+
|
176
|
+
# Verify that the DLL dependencies are all allowed.
|
177
|
+
actual_imports = dump.scan(/DLL Name: (.*)$/).map(&:first).map(&:downcase).uniq
|
178
|
+
if !(actual_imports - allowed_imports).empty?
|
179
|
+
raise "unallowed so imports #{actual_imports.inspect} in #{dll} (allowed #{allowed_imports.inspect})"
|
180
|
+
end
|
181
|
+
|
182
|
+
elsif cross_ruby.linux?
|
183
|
+
nm = `#{["env", "LANG=C", cross_ruby.tool("nm"), "-D", dll].shelljoin}`
|
184
|
+
|
185
|
+
raise "unexpected file format for generated dll #{dll}" unless /file format #{Regexp.quote(cross_ruby.target_file_format)}\s/ === dump
|
186
|
+
raise "export function Init_nokogiri not in dll #{dll}" unless / T Init_nokogiri/ === nm
|
187
|
+
|
188
|
+
# Verify that the DLL dependencies are all allowed.
|
189
|
+
actual_imports = dump.scan(/NEEDED\s+(.*)/).map(&:first).uniq
|
190
|
+
if !(actual_imports - allowed_imports).empty?
|
191
|
+
raise "unallowed so imports #{actual_imports.inspect} in #{dll} (allowed #{allowed_imports.inspect})"
|
192
|
+
end
|
193
|
+
|
194
|
+
# Verify that the expected so version requirements match the actual dependencies.
|
195
|
+
ref_versions_data = dump.scan(/0x[\da-f]+ 0x[\da-f]+ \d+ (\w+)_([\d\.]+)$/i)
|
196
|
+
# Build a hash of library versions like {"LIBUDEV"=>"183", "GLIBC"=>"2.17"}
|
197
|
+
actual_ref_versions = ref_versions_data.each.with_object({}) do |(lib, ver), h|
|
198
|
+
if !h[lib] || ver.split(".").map(&:to_i).pack("C*") > h[lib].split(".").map(&:to_i).pack("C*")
|
199
|
+
h[lib] = ver
|
200
|
+
end
|
201
|
+
end
|
202
|
+
if actual_ref_versions != cross_ruby.dll_ref_versions
|
203
|
+
raise "unexpected so version requirements #{actual_ref_versions.inspect} in #{dll}"
|
204
|
+
end
|
205
|
+
|
206
|
+
elsif cross_ruby.darwin?
|
207
|
+
nm = `#{["env", "LANG=C", cross_ruby.tool("nm"), "-g", dll].shelljoin}`
|
208
|
+
|
209
|
+
raise "unexpected file format for generated dll #{dll}" unless /file format #{Regexp.quote(cross_ruby.target_file_format)}\s/ === dump
|
210
|
+
raise "export function Init_nokogiri not in dll #{dll}" unless / T _?Init_nokogiri/ === nm
|
211
|
+
|
212
|
+
# if liblzma is being referenced, let's make sure it's referring
|
213
|
+
# to the system-installed file and not the homebrew-installed file.
|
214
|
+
ldd = `#{["env", "LANG=C", cross_ruby.tool("otool"), "-L", dll].shelljoin}`
|
215
|
+
if liblzma_refs = ldd.scan(/^\t([^ ]+) /).map(&:first).uniq.grep(/liblzma/)
|
216
|
+
liblzma_refs.each do |ref|
|
217
|
+
new_ref = File.join("/usr/lib", File.basename(ref))
|
218
|
+
sh ["env", "LANG=C", cross_ruby.tool("install_name_tool"), "-change", ref, new_ref, dll].shelljoin
|
219
|
+
end
|
220
|
+
|
221
|
+
# reload!
|
222
|
+
ldd = `#{["env", "LANG=C", cross_ruby.tool("otool"), "-L", dll].shelljoin}`
|
223
|
+
end
|
224
|
+
|
225
|
+
# Verify that the DLL dependencies are all allowed.
|
226
|
+
ldd = `#{["env", "LANG=C", cross_ruby.tool("otool"), "-L", dll].shelljoin}`
|
227
|
+
actual_imports = ldd.scan(/^\t([^ ]+) /).map(&:first).uniq
|
228
|
+
if !(actual_imports - allowed_imports).empty?
|
229
|
+
raise "unallowed so imports #{actual_imports.inspect} in #{dll} (allowed #{allowed_imports.inspect})"
|
230
|
+
end
|
231
|
+
end
|
232
|
+
puts "verify_dll: #{dll}: passed shared library sanity checks"
|
233
|
+
end
|
234
|
+
|
235
|
+
CROSS_RUBIES.each do |cross_ruby|
|
236
|
+
task cross_ruby.dll_staging_path do |t|
|
237
|
+
verify_dll t.name, cross_ruby
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
def gem_builder(plat)
|
242
|
+
# use Task#invoke because the pkg/*gem task is defined at runtime
|
243
|
+
Rake::Task["native:#{plat}"].invoke
|
244
|
+
Rake::Task["pkg/#{GEMSPEC.full_name}-#{Gem::Platform.new(plat).to_s}.gem"].invoke
|
245
|
+
end
|
246
|
+
|
247
|
+
namespace "gem" do
|
248
|
+
CROSS_RUBIES.find_all { |cr| cr.windows? || cr.linux? || cr.darwin? }.map(&:platform).uniq.each do |plat|
|
249
|
+
pre_req = case plat
|
250
|
+
when /\linux/
|
251
|
+
"sudo yum install -y git"
|
252
|
+
else
|
253
|
+
"sudo apt-get update -y && sudo apt-get install -y automake autoconf libtool build-essential"
|
254
|
+
end
|
255
|
+
desc "build native gem for #{plat} platform"
|
256
|
+
task plat do
|
257
|
+
RakeCompilerDock.sh <<~EOT, platform: plat
|
258
|
+
#{pre_req} &&
|
259
|
+
gem install bundler --no-document &&
|
260
|
+
bundle &&
|
261
|
+
bundle exec rake gem:#{plat}:builder MAKE='nice make -j`nproc`'
|
262
|
+
EOT
|
263
|
+
end
|
264
|
+
|
265
|
+
namespace plat do
|
266
|
+
desc "build native gem for #{plat} platform (guest container)"
|
267
|
+
task "builder" do
|
268
|
+
gem_builder(plat)
|
269
|
+
end
|
270
|
+
task "guest" => "builder" # TODO: remove me after this code is on master, temporary backwards compat for CI
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
desc "build native gems for windows"
|
275
|
+
multitask "windows" => CROSS_RUBIES.find_all(&:windows?).map(&:platform).uniq
|
276
|
+
|
277
|
+
desc "build native gems for linux"
|
278
|
+
multitask "linux" => CROSS_RUBIES.find_all(&:linux?).map(&:platform).uniq
|
279
|
+
|
280
|
+
desc "build native gems for darwin"
|
281
|
+
multitask "darwin" => CROSS_RUBIES.find_all(&:darwin?).map(&:platform).uniq
|
282
|
+
end
|
283
|
+
|
284
|
+
namespace "native" do
|
285
|
+
plat = "x86_64-darwin"
|
286
|
+
namespace plat do
|
287
|
+
desc "build native gem for #{plat} platform on host OS"
|
288
|
+
task "builder" do
|
289
|
+
gem_builder(plat)
|
290
|
+
end
|
291
|
+
task "guest" => "builder" # TODO: remove me after this code is on master, temporary backwards compat for CI
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
require "rake/extensiontask"
|
296
|
+
|
297
|
+
Rake::ExtensionTask.new("express_parser", GEMSPEC) do |ext|
|
298
|
+
ext.ext_dir = "ext/express-parser"
|
299
|
+
ext.lib_dir = File.join(*['lib', 'expressir', 'express_exp', ENV['FAT_DIR']].compact)
|
300
|
+
ext.config_options << ENV['EXTOPTS']
|
301
|
+
ext.cross_compile = true
|
302
|
+
ext.cross_platform = CROSS_RUBIES.map(&:platform).uniq
|
303
|
+
ext.cross_config_options << "--enable-cross-build"
|
304
|
+
ext.cross_compiling do |spec|
|
305
|
+
spec.files.reject! { |path| File.fnmatch?('ext/*', path) }
|
306
|
+
spec.dependencies.reject! { |dep| dep.name == 'rice' }
|
307
|
+
end
|
308
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe "Expressir" do
|
4
|
+
describe "express-to-owl" do
|
5
|
+
pending "Still needs implementation"
|
6
|
+
|
7
|
+
it "convert express to owl system" do
|
8
|
+
command = %W(express-to-owl #{sample_file})
|
9
|
+
capture_stdout { Expressir::Cli.start(command) }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def sample_file
|
14
|
+
@sample_file ||= Expressir.root_path.join(
|
15
|
+
"original", "examples", "ap233", "ap233e1_arm_lf_stepmod-2010-11-12.xml"
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe "Expressir" do
|
4
|
+
describe "version" do
|
5
|
+
it "displays the current verison" do
|
6
|
+
command = %w(version)
|
7
|
+
output = capture_stdout { Expressir::Cli.start(command) }
|
8
|
+
|
9
|
+
expect(output).to include("Version #{Expressir::VERSION}")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Expressir::Express::Repository do
|
4
|
+
describe ".from_file" do
|
5
|
+
it "build an instance from a file" do
|
6
|
+
name = "Ap233_systems_engineering_arm_LF"
|
7
|
+
|
8
|
+
repo = Expressir::Express::Repository.from_xml(sample_file)
|
9
|
+
schema = repo.schemas.first
|
10
|
+
|
11
|
+
expect(repo.name).to eq(name)
|
12
|
+
expect(repo.schemas.count).to eq(1)
|
13
|
+
expect(schema.name).to eq(name)
|
14
|
+
expect(schema.contents.count).to eq(795)
|
15
|
+
expect(schema.contents.first.schema).to eq(name)
|
16
|
+
expect(schema.contents.first.name).to eq("Abs_function")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def sample_file
|
21
|
+
@sample_file ||= Expressir.root_path.join(
|
22
|
+
"original", "examples", "ap233", "ap233e1_arm_lf_stepmod-2010-11-12.xml"
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "expressir/express_exp/parser"
|
3
|
+
|
4
|
+
RSpec.describe Expressir::ExpressExp::Parser do
|
5
|
+
describe ".from_file" do
|
6
|
+
it "build an instance from a file" do
|
7
|
+
repo = Expressir::ExpressExp::Parser.from_exp(sample_file)
|
8
|
+
|
9
|
+
schemas = repo.schemas
|
10
|
+
expect(schemas.count).to eq(1)
|
11
|
+
|
12
|
+
schema = schemas.first
|
13
|
+
expect(schema.id).to eq("Ap233_systems_engineering_arm_LF")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def sample_file
|
18
|
+
@sample_file ||= Expressir.root_path.join(
|
19
|
+
"original", "examples", "ap233", "ap233e1_arm_lf_stepmod-2010-11-12.exp"
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "expressir/express_exp/parser"
|
3
|
+
require "expressir/express_exp/formatter"
|
4
|
+
|
5
|
+
RSpec.describe Expressir::ExpressExp::Formatter do
|
6
|
+
describe ".format" do
|
7
|
+
it "formats a file" do
|
8
|
+
repo = Expressir::ExpressExp::Parser.from_exp(input_file)
|
9
|
+
|
10
|
+
result = Expressir::ExpressExp::Formatter.format(repo)
|
11
|
+
expected_result = File.read(output_file)
|
12
|
+
|
13
|
+
expect(result).to eq(expected_result)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def input_file
|
18
|
+
@input_file ||= Expressir.root_path.join(
|
19
|
+
"original", "examples", "syntax", "remark.exp"
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
def output_file
|
24
|
+
@output_file ||= Expressir.root_path.join(
|
25
|
+
"original", "examples", "syntax", "remark_formatted.exp"
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "expressir/express_exp/parser"
|
3
|
+
require "expressir/express_exp/formatter"
|
4
|
+
|
5
|
+
RSpec.describe Expressir::ExpressExp::Formatter do
|
6
|
+
describe ".format" do
|
7
|
+
it "formats a file" do
|
8
|
+
repo = Expressir::ExpressExp::Parser.from_exp(input_file)
|
9
|
+
|
10
|
+
result = Expressir::ExpressExp::Formatter.format(repo)
|
11
|
+
expected_result = File.read(output_file)
|
12
|
+
|
13
|
+
expect(result).to eq(expected_result)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def input_file
|
18
|
+
@input_file ||= Expressir.root_path.join(
|
19
|
+
"original", "examples", "syntax", "syntax.exp"
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
def output_file
|
24
|
+
@output_file ||= Expressir.root_path.join(
|
25
|
+
"original", "examples", "syntax", "syntax_formatted.exp"
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|