expressir 1.2.1-arm64-darwin → 1.2.5-arm64-darwin
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.
- checksums.yaml +4 -4
- data/.cross_rubies +3 -6
- data/.github/workflows/rake.yml +223 -19
- data/.github/workflows/release.yml +1 -0
- data/.gitignore +7 -1
- data/.gitmodules +4 -1
- data/.rubocop.yml +13 -4
- data/Rakefile +4 -1
- data/bin/console +0 -1
- data/bin/rspec +3 -3
- data/exe/expressir +4 -2
- data/exe/format +1 -1
- data/exe/format-test +25 -25
- data/exe/generate-parser +16 -13
- data/expressir.gemspec +13 -11
- data/lib/expressir/config.rb +1 -1
- data/lib/expressir/express/2.7/express_parser.bundle +0 -0
- data/lib/expressir/express/3.0/express_parser.bundle +0 -0
- data/lib/expressir/express/3.1/express_parser.bundle +0 -0
- data/lib/expressir/express/parser.rb +18 -15
- data/lib/expressir/express/visitor.rb +7 -3
- data/lib/expressir/model.rb +78 -78
- data/lib/expressir/version.rb +1 -1
- data/rakelib/antlr4-native.rake +63 -0
- data/rakelib/cross-ruby.rake +216 -157
- data/spec/acceptance/version_spec.rb +7 -2
- data/spec/expressir/express/cache_spec.rb +8 -5
- data/spec/expressir/express/formatter_spec.rb +16 -8
- data/spec/expressir/express/parser_spec.rb +17 -11
- data/spec/expressir/model/model_element_spec.rb +154 -146
- metadata +55 -63
- data/demo.rb +0 -18
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.exp +0 -9589
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.owl +0 -36619
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.xml +0 -13294
- data/original/examples/employment/eclipse/.project +0 -17
- data/original/examples/employment/eclipse/Export/Employment.png +0 -0
- data/original/examples/employment/eclipse/Express/employment_schema.exp +0 -33
- data/original/examples/employment/eclipse/Express/employment_schema.xmi +0 -77
- data/original/examples/employment/eclipse/Express/employment_schema.xml +0 -93
- data/original/examples/employment/eclipse/Models/Employment.uml +0 -4
- data/original/examples/employment/eclipse/Models/Employment.umldi +0 -240
- data/original/examples/employment/eclipse/readme.txt +0 -7
- data/original/examples/employment/employment_schema.exp +0 -33
- data/original/examples/employment/employment_schema.rb +0 -232
- data/original/examples/employment/employment_schema.xml +0 -93
- data/original/examples/employment/employment_schema___module.rb +0 -46
- data/original/examples/employment/employment_schema___p28attr.rb +0 -126
- data/original/examples/employment/employment_schema___p28inst.rb +0 -26
- data/original/examples/employment/example_employment_data.xml +0 -1
- data/original/examples/employment/example_employment_data_copy.xml +0 -1
- data/original/examples/employment/example_employment_reader.rb +0 -30
- data/original/examples/employment/example_employment_writer.rb +0 -51
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.exp +0 -3710
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.owl +0 -35880
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xmi +0 -15357
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xml +0 -9468
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.exp +0 -8404
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.owl +0 -43147
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xmi +0 -18341
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xml +0 -11632
- data/original/exp2ruby.rb +0 -525
- data/original/expsm.rb +0 -34
- data/original/mapping_owl.rb +0 -1018
- data/original/mapping_sysml.rb +0 -2281
- data/original/mapping_uml2.rb +0 -599
- data/original/mapping_uml2_eclipse.rb +0 -433
- data/original/reeper.rb +0 -134
- data/spec/expressr_spec.rb +0 -5
data/rakelib/cross-ruby.rake
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
require "rbconfig"
|
2
2
|
require "shellwords"
|
3
3
|
|
4
|
+
WINDOWS_PLATFORM_REGEX = /mingw|mswin/.freeze
|
5
|
+
LINUX_PLATFORM_REGEX = /linux/.freeze
|
6
|
+
DARWIN_PLATFORM_REGEX = /darwin/.freeze
|
7
|
+
GLIBC_MIN_VERSION = "2.17".freeze
|
8
|
+
|
4
9
|
CrossRuby = Struct.new(:version, :host) do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
DARWIN_PLATFORM_REGEX = /darwin/
|
10
|
+
def dll_staging_path
|
11
|
+
"tmp/#{platform}/stage/lib/expressir/express/#{minor_ver}/express_parser.#{dll_ext}"
|
12
|
+
end
|
9
13
|
|
10
14
|
def windows?
|
11
15
|
!!(platform =~ WINDOWS_PLATFORM_REGEX)
|
@@ -27,6 +31,14 @@ CrossRuby = Struct.new(:version, :host) do
|
|
27
31
|
@minor_ver ||= ver[/\A\d\.\d(?=\.)/]
|
28
32
|
end
|
29
33
|
|
34
|
+
def minor_ver_digi
|
35
|
+
@minor_ver_digi = minor_ver.delete(".").to_i
|
36
|
+
end
|
37
|
+
|
38
|
+
def ucrt?
|
39
|
+
minor_ver_digi >= 31
|
40
|
+
end
|
41
|
+
|
30
42
|
def api_ver_suffix
|
31
43
|
case minor_ver
|
32
44
|
when nil
|
@@ -36,16 +48,21 @@ CrossRuby = Struct.new(:version, :host) do
|
|
36
48
|
end
|
37
49
|
end
|
38
50
|
|
51
|
+
# rubocop:disable Metrics/MethodLength
|
52
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
39
53
|
def platform
|
40
|
-
@platform ||=
|
54
|
+
@platform ||=
|
55
|
+
case host
|
41
56
|
when /\Ax86_64.*mingw32/
|
42
|
-
|
43
|
-
|
44
|
-
|
57
|
+
if ucrt?
|
58
|
+
"x64-mingw-ucrt"
|
59
|
+
else
|
60
|
+
"x64-mingw32"
|
61
|
+
end
|
45
62
|
when /\Ax86_64.*linux/
|
46
63
|
"x86_64-linux"
|
47
|
-
when /\
|
48
|
-
"
|
64
|
+
when /\A(arm64|aarch64).*linux/
|
65
|
+
"aarch64-linux"
|
49
66
|
when /\Ax86_64-darwin/
|
50
67
|
"x86_64-darwin"
|
51
68
|
when /\Aarm64-darwin/
|
@@ -56,210 +73,264 @@ CrossRuby = Struct.new(:version, :host) do
|
|
56
73
|
end
|
57
74
|
|
58
75
|
def tool(name)
|
59
|
-
(@binutils_prefix ||=
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
raise "CrossRuby.tool: unmatched platform: #{platform}"
|
74
|
-
end) + name
|
76
|
+
(@binutils_prefix ||=
|
77
|
+
case platform
|
78
|
+
when /x64-mingw(32|-ucrt)/
|
79
|
+
"x86_64-w64-mingw32-"
|
80
|
+
when /(x86_64|aarch64)-linux/
|
81
|
+
# We do believe that we are on Linux and can use native tools
|
82
|
+
""
|
83
|
+
when /x86_64.*darwin/
|
84
|
+
"x86_64-apple-darwin-"
|
85
|
+
when /a.*64.*darwin/
|
86
|
+
"aarch64-apple-darwin-"
|
87
|
+
else
|
88
|
+
raise "CrossRuby.tool: unmatched platform: #{platform}"
|
89
|
+
end) + name
|
75
90
|
end
|
76
91
|
|
77
92
|
def target_file_format
|
78
93
|
case platform
|
79
|
-
when
|
94
|
+
when /64-mingw(32|-ucrt)/
|
80
95
|
"pei-x86-64"
|
81
|
-
when "x86-mingw32"
|
82
|
-
"pei-i386"
|
83
96
|
when "x86_64-linux"
|
84
97
|
"elf64-x86-64"
|
85
|
-
when "
|
86
|
-
"
|
98
|
+
when "aarch64-linux"
|
99
|
+
"elf64-little"
|
87
100
|
when "x86_64-darwin"
|
88
|
-
"Mach-O 64-bit x86-64"
|
101
|
+
"Mach-O 64-bit x86-64"
|
89
102
|
when "arm64-darwin"
|
90
103
|
"Mach-O arm64"
|
91
104
|
else
|
92
105
|
raise "CrossRuby.target_file_format: unmatched platform: #{platform}"
|
93
106
|
end
|
94
107
|
end
|
108
|
+
# rubocop:enable Metrics/MethodLength
|
109
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
95
110
|
|
96
111
|
def dll_ext
|
97
112
|
darwin? ? "bundle" : "so"
|
98
113
|
end
|
99
114
|
|
100
|
-
def
|
101
|
-
|
115
|
+
def verify_format(dump, dll)
|
116
|
+
format_match = (/file format #{Regexp.quote(target_file_format)}\s/ === dump)
|
117
|
+
format_error = "Unexpected file format for '#{dll}', '#{target_file_format}' required"
|
118
|
+
raise format_error unless format_match
|
102
119
|
end
|
103
120
|
|
104
|
-
def
|
105
|
-
|
106
|
-
|
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}"
|
121
|
+
def verify_entry_windows(dump, dll)
|
122
|
+
unless /Table.*\sInit_express_parser\s/mi === dump
|
123
|
+
raise "Export function Init_express_parser not in dll #{dll}"
|
112
124
|
end
|
113
125
|
end
|
114
126
|
|
115
|
-
def
|
127
|
+
def verify_entry_linux(dll)
|
128
|
+
nm = `#{["env", "LANG=C", tool("nm"), "-D", dll].shelljoin}`
|
129
|
+
unless / T Init_express_parser/.match?(nm)
|
130
|
+
raise "Export function Init_express_parser not in dll #{dll}"
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def verify_entry_darwin(dll)
|
135
|
+
nm = `#{["env", "LANG=C", tool("nm"), "-g", dll].shelljoin}`
|
136
|
+
unless / T _?Init_express_parser/.match?(nm)
|
137
|
+
raise "Export function Init_express_parser not in dll #{dll}"
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def verify_entry(dump, dll)
|
116
142
|
case platform
|
117
|
-
when
|
118
|
-
|
119
|
-
"kernel32.dll",
|
120
|
-
"msvcrt.dll",
|
121
|
-
"ws2_32.dll",
|
122
|
-
"user32.dll",
|
123
|
-
"advapi32.dll",
|
124
|
-
libruby_dll,
|
125
|
-
]
|
143
|
+
when WINDOWS_PLATFORM_REGEX
|
144
|
+
verify_entry_windows(dump, dll)
|
126
145
|
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
|
-
]
|
146
|
+
verify_entry_linux(dll)
|
136
147
|
when DARWIN_PLATFORM_REGEX
|
137
|
-
|
138
|
-
"/usr/lib/libSystem.B.dylib",
|
139
|
-
"/usr/lib/liblzma.5.dylib",
|
140
|
-
"/usr/lib/libobjc.A.dylib",
|
141
|
-
]
|
148
|
+
verify_entry_darwin(dll)
|
142
149
|
else
|
143
|
-
raise "CrossRuby.
|
150
|
+
raise "CrossRuby.verify_entry: unmatched platform: #{platform}"
|
144
151
|
end
|
145
152
|
end
|
146
153
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
154
|
+
# rubocop:disable Metrics/MethodLength
|
155
|
+
def allowed_dlls_ucrt
|
156
|
+
["kernel32.dll",
|
157
|
+
"api-ms-win-crt-convert-l1-1-0.dll",
|
158
|
+
"api-ms-win-crt-environment-l1-1-0.dll",
|
159
|
+
"api-ms-win-crt-heap-l1-1-0.dll",
|
160
|
+
"api-ms-win-crt-locale-l1-1-0.dll",
|
161
|
+
"api-ms-win-crt-private-l1-1-0.dll",
|
162
|
+
"api-ms-win-crt-runtime-l1-1-0.dll",
|
163
|
+
"api-ms-win-crt-stdio-l1-1-0.dll",
|
164
|
+
"api-ms-win-crt-string-l1-1-0.dll",
|
165
|
+
"api-ms-win-crt-time-l1-1-0.dll",
|
166
|
+
"api-ms-win-crt-filesystem-l1-1-0.dll",
|
167
|
+
"api-ms-win-crt-math-l1-1-0.dll",
|
168
|
+
"libwinpthread-1.dll",
|
169
|
+
"x64-ucrt-ruby310.dll"]
|
170
|
+
end
|
171
|
+
# rubocop:enable Metrics/MethodLength
|
172
|
+
|
173
|
+
def allowed_dlls_mingw
|
174
|
+
[
|
175
|
+
"kernel32.dll",
|
176
|
+
"msvcrt.dll",
|
177
|
+
"libwinpthread-1.dll",
|
178
|
+
"x64-msvcrt-ruby#{api_ver_suffix}.dll",
|
179
|
+
]
|
180
|
+
end
|
181
|
+
|
182
|
+
def allowed_dlls_windows
|
183
|
+
if ucrt?
|
184
|
+
allowed_dlls_ucrt
|
151
185
|
else
|
152
|
-
|
186
|
+
allowed_dlls_mingw
|
153
187
|
end
|
154
188
|
end
|
155
|
-
end
|
156
189
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
190
|
+
def allowed_dlls_linux
|
191
|
+
suffix = (platform == "x86_64-linux" ? "x86-64" : "aarch64")
|
192
|
+
[
|
193
|
+
"ld-linux-#{suffix}.so",
|
194
|
+
"libc.so",
|
195
|
+
"libm.so",
|
196
|
+
"libstdc++.so",
|
197
|
+
"libgcc_s.so",
|
198
|
+
]
|
161
199
|
end
|
162
|
-
end.compact
|
163
|
-
|
164
|
-
ENV["RUBY_CC_VERSION"] = CROSS_RUBIES.map(&:ver).uniq.join(":")
|
165
200
|
|
166
|
-
|
201
|
+
def allowed_dlls_darwin
|
202
|
+
[
|
203
|
+
"/usr/lib/libSystem.B.dylib",
|
204
|
+
"/usr/lib/libc++.1.dylib",
|
205
|
+
]
|
206
|
+
end
|
167
207
|
|
168
|
-
def
|
169
|
-
|
170
|
-
|
208
|
+
def allowed_dlls
|
209
|
+
case platform
|
210
|
+
when WINDOWS_PLATFORM_REGEX
|
211
|
+
allowed_dlls_windows
|
212
|
+
when LINUX_PLATFORM_REGEX
|
213
|
+
allowed_dlls_linux
|
214
|
+
when DARWIN_PLATFORM_REGEX
|
215
|
+
allowed_dlls_darwin
|
216
|
+
else
|
217
|
+
raise "CrossRuby.allowed_dlls: unmatched platform: #{platform}"
|
218
|
+
end
|
219
|
+
end
|
171
220
|
|
172
|
-
|
173
|
-
|
174
|
-
|
221
|
+
def actual_dlls_linux(dump)
|
222
|
+
dump.scan(/NEEDED\s+(.*)/).map(&:first).uniq
|
223
|
+
end
|
175
224
|
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
raise "unallowed so imports #{actual_imports.inspect} in #{dll} (allowed #{allowed_imports.inspect})"
|
180
|
-
end
|
225
|
+
def actual_dlls_windows(dump)
|
226
|
+
dump.scan(/DLL Name: (.*)$/).map(&:first).map(&:downcase).uniq
|
227
|
+
end
|
181
228
|
|
182
|
-
|
183
|
-
|
229
|
+
def actual_dlls_darwin(dll)
|
230
|
+
ldd = `#{[tool("otool"), "-L", dll].shelljoin}`
|
231
|
+
ldd.scan(/^\t([^ ]+) /).map(&:first).uniq
|
232
|
+
end
|
184
233
|
|
185
|
-
|
186
|
-
|
234
|
+
def actual_dlls(dump, dll)
|
235
|
+
case platform
|
236
|
+
when DARWIN_PLATFORM_REGEX
|
237
|
+
actual_dlls_darwin(dll)
|
238
|
+
when LINUX_PLATFORM_REGEX
|
239
|
+
actual_dlls_linux(dump)
|
240
|
+
when WINDOWS_PLATFORM_REGEX
|
241
|
+
actual_dlls_windows(dump)
|
242
|
+
else
|
243
|
+
raise "CrossRuby.actual_dlls: unmatched platform: #{platform}"
|
244
|
+
end
|
245
|
+
end
|
187
246
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
247
|
+
def verify_imports(dump, dll)
|
248
|
+
l = actual_dlls(dump, dll)
|
249
|
+
libs = allowed_dlls
|
250
|
+
l.delete_if { |ln| libs.any? { |lib| ln.include?(lib) } }
|
251
|
+
unless l.empty?
|
252
|
+
raise "Unexpected references in '#{dll}' : #{l}"
|
192
253
|
end
|
254
|
+
end
|
193
255
|
|
194
|
-
|
195
|
-
ref_versions_data = dump.scan(/0x[\da-f]+ 0x[\da-f]+ \d+ (\w+)_([\d\.]+)$/i)
|
256
|
+
def lib_ref_versions(data)
|
196
257
|
# Build a hash of library versions like {"LIBUDEV"=>"183", "GLIBC"=>"2.17"}
|
197
|
-
|
258
|
+
data.each.with_object({}) do |(lib, ver), h|
|
198
259
|
if !h[lib] || ver.split(".").map(&:to_i).pack("C*") > h[lib].split(".").map(&:to_i).pack("C*")
|
199
260
|
h[lib] = ver
|
200
261
|
end
|
201
262
|
end
|
202
|
-
|
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
|
263
|
+
end
|
211
264
|
|
212
|
-
|
213
|
-
|
214
|
-
|
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
|
265
|
+
def verify_glibc_version(dump, dll)
|
266
|
+
ref_versions_data = dump.scan(/0x[\da-f]+ 0x[\da-f]+ \d+ (\w+)_([\d.]+)$/i)
|
267
|
+
ref_ver = lib_ref_versions(ref_versions_data)
|
220
268
|
|
221
|
-
|
222
|
-
|
269
|
+
unless ref_ver["GLIBC"].delete(".").to_i <= GLIBC_MIN_VERSION.delete(".").to_i
|
270
|
+
raise "Unexpected GLIBC version #{ref_ver['GLIBC']} for #{dll}, #{GLIBC_MIN_VERSION} or lower is expected"
|
223
271
|
end
|
272
|
+
end
|
273
|
+
end
|
224
274
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
raise "unallowed so imports #{actual_imports.inspect} in #{dll} (allowed #{allowed_imports.inspect})"
|
230
|
-
end
|
275
|
+
CROSS_RUBIES = File.read(".cross_rubies").split("\n").map do |line|
|
276
|
+
case line
|
277
|
+
when /\A([^#]+):([^#]+)/
|
278
|
+
CrossRuby.new($1, $2)
|
231
279
|
end
|
232
|
-
|
280
|
+
end.compact
|
281
|
+
|
282
|
+
ENV["RUBY_CC_VERSION"] = CROSS_RUBIES.map(&:ver).uniq.join(":")
|
283
|
+
|
284
|
+
require "rake_compiler_dock"
|
285
|
+
|
286
|
+
def verify_dll(dll, cross_ruby)
|
287
|
+
dump = `#{["env", "LANG=C", cross_ruby.tool("objdump"), "-p", dll].shelljoin}`
|
288
|
+
cross_ruby.verify_format(dump, dll)
|
289
|
+
cross_ruby.verify_entry(dump, dll)
|
290
|
+
cross_ruby.verify_imports(dump, dll)
|
291
|
+
# Not sure if it is required, probably not
|
292
|
+
# I am keeping related code as a reference for future advances
|
293
|
+
# cross_ruby.verify_glibc_version(dump, dll) if cross_ruby.linux?
|
294
|
+
|
295
|
+
puts "#{dll}: passed shared library sanity checks"
|
233
296
|
end
|
234
297
|
|
235
298
|
CROSS_RUBIES.each do |cross_ruby|
|
236
|
-
|
237
|
-
|
299
|
+
unless Rake::Task.task_defined?(cross_ruby.dll_staging_path)
|
300
|
+
task cross_ruby.dll_staging_path do |t|
|
301
|
+
verify_dll t.name, cross_ruby
|
302
|
+
end
|
238
303
|
end
|
239
304
|
end
|
240
305
|
|
241
306
|
def gem_builder(plat)
|
242
307
|
# use Task#invoke because the pkg/*gem task is defined at runtime
|
243
308
|
Rake::Task["native:#{plat}"].invoke
|
244
|
-
Rake::Task["pkg/#{GEMSPEC.full_name}-#{Gem::Platform.new(plat)
|
309
|
+
Rake::Task["pkg/#{GEMSPEC.full_name}-#{Gem::Platform.new(plat)}.gem"].invoke
|
310
|
+
end
|
311
|
+
|
312
|
+
REDHAT_PREREQ = "sudo yum install -y git".freeze
|
313
|
+
UBUNTU_PREREQ = "sudo apt-get update -y && sudo apt-get install -y automake autoconf libtool build-essential".freeze
|
314
|
+
|
315
|
+
def pre_req(plat)
|
316
|
+
case plat
|
317
|
+
when /\linux/
|
318
|
+
"if [[ $(awk -F= '/^NAME/{print $2}' /etc/os-release) == '\"Ubuntu\"' ]]; then #{UBUNTU_PREREQ}; else #{REDHAT_PREREQ}; fi"
|
319
|
+
else
|
320
|
+
UBUNTU_PREREQ.to_s
|
321
|
+
end
|
245
322
|
end
|
246
323
|
|
247
324
|
namespace "gem" do
|
248
325
|
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
326
|
desc "build native gem for #{plat} platform"
|
256
327
|
task plat do
|
257
|
-
RakeCompilerDock.sh <<~
|
258
|
-
#{pre_req} &&
|
328
|
+
RakeCompilerDock.sh <<~RCD, platform: plat
|
329
|
+
#{pre_req(plat)} &&
|
259
330
|
gem install bundler --no-document &&
|
260
331
|
bundle &&
|
261
332
|
bundle exec rake gem:#{plat}:builder MAKE='nice make -j`nproc`'
|
262
|
-
|
333
|
+
RCD
|
263
334
|
end
|
264
335
|
|
265
336
|
namespace plat do
|
@@ -267,7 +338,6 @@ namespace "gem" do
|
|
267
338
|
task "builder" do
|
268
339
|
gem_builder(plat)
|
269
340
|
end
|
270
|
-
task "guest" => "builder" # TODO: remove me after this code is on master, temporary backwards compat for CI
|
271
341
|
end
|
272
342
|
end
|
273
343
|
|
@@ -281,28 +351,17 @@ namespace "gem" do
|
|
281
351
|
multitask "darwin" => CROSS_RUBIES.find_all(&:darwin?).map(&:platform).uniq
|
282
352
|
end
|
283
353
|
|
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
354
|
require "rake/extensiontask"
|
296
355
|
|
297
356
|
Rake::ExtensionTask.new("express_parser", GEMSPEC) do |ext|
|
298
357
|
ext.ext_dir = "ext/express-parser"
|
299
|
-
ext.lib_dir = File.join(*[
|
300
|
-
ext.config_options << ENV
|
358
|
+
ext.lib_dir = File.join(*["lib", "expressir", "express", ENV.fetch("FAT_DIR", nil)].compact)
|
359
|
+
ext.config_options << ENV.fetch("EXTOPTS", nil)
|
301
360
|
ext.cross_compile = true
|
302
361
|
ext.cross_platform = CROSS_RUBIES.map(&:platform).uniq
|
303
362
|
ext.cross_config_options << "--enable-cross-build"
|
304
363
|
ext.cross_compiling do |spec|
|
305
|
-
spec.files.reject! { |path| File.fnmatch?(
|
306
|
-
spec.dependencies.reject! { |dep| dep.name ==
|
364
|
+
spec.files.reject! { |path| File.fnmatch?("ext/*", path) }
|
365
|
+
spec.dependencies.reject! { |dep| dep.name == "rice" }
|
307
366
|
end
|
308
367
|
end
|
@@ -2,10 +2,15 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe "Expressir" do
|
4
4
|
describe "version" do
|
5
|
-
it "
|
5
|
+
it "has a version number" do |example|
|
6
|
+
print "\n[#{example.description}] "
|
7
|
+
expect(Expressir::VERSION).not_to be nil
|
8
|
+
end
|
9
|
+
|
10
|
+
it "displays the current verison" do |example|
|
11
|
+
print "\n[#{example.description}] "
|
6
12
|
command = %w(version)
|
7
13
|
output = capture_stdout { Expressir::Cli.start(command) }
|
8
|
-
|
9
14
|
expect(output).to include("Version #{Expressir::VERSION}")
|
10
15
|
end
|
11
16
|
end
|
@@ -4,11 +4,12 @@ require "spec_helper"
|
|
4
4
|
require "expressir/express/parser"
|
5
5
|
require "expressir/express/cache"
|
6
6
|
|
7
|
-
|
8
|
-
TEST_VERSION = "0.0.0"
|
7
|
+
TEST_VERSION = "0.0.0".freeze
|
9
8
|
|
9
|
+
RSpec.describe Expressir::Express::Cache do
|
10
10
|
describe ".to_file" do
|
11
|
-
it "exports an object" do
|
11
|
+
it "exports an object" do |example|
|
12
|
+
print "\n[#{example.description}] "
|
12
13
|
temp_file = Tempfile.new
|
13
14
|
|
14
15
|
repository = Expressir::Model::Repository.new
|
@@ -27,7 +28,8 @@ RSpec.describe Expressir::Express::Cache do
|
|
27
28
|
end
|
28
29
|
|
29
30
|
describe ".from_file" do
|
30
|
-
it "parses a file" do
|
31
|
+
it "parses a file" do |example|
|
32
|
+
print "\n[#{example.description}] "
|
31
33
|
temp_file = Tempfile.new
|
32
34
|
|
33
35
|
repository = Expressir::Model::Repository.new
|
@@ -44,7 +46,8 @@ RSpec.describe Expressir::Express::Cache do
|
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
47
|
-
it "fails parsing a file from a different Expressir version" do
|
49
|
+
it "fails parsing a file from a different Expressir version" do |example|
|
50
|
+
print "\n[#{example.description}] "
|
48
51
|
temp_file = Tempfile.new
|
49
52
|
|
50
53
|
repository = Expressir::Model::Repository.new
|
@@ -7,7 +7,8 @@ require "expressir/express/hyperlink_formatter"
|
|
7
7
|
|
8
8
|
RSpec.describe Expressir::Express::Formatter do
|
9
9
|
describe ".format" do
|
10
|
-
it "exports an object (single.exp)" do
|
10
|
+
it "exports an object (single.exp)" do |example|
|
11
|
+
print "\n[#{example.description}] "
|
11
12
|
exp_file = Expressir.root_path.join("spec", "syntax", "single.exp")
|
12
13
|
formatted_exp_file = Expressir.root_path.join("spec", "syntax", "single_formatted.exp")
|
13
14
|
|
@@ -20,7 +21,8 @@ RSpec.describe Expressir::Express::Formatter do
|
|
20
21
|
expect(result).to eq(expected_result)
|
21
22
|
end
|
22
23
|
|
23
|
-
it "exports an object (multiple.exp)" do
|
24
|
+
it "exports an object (multiple.exp)" do |example|
|
25
|
+
print "\n[#{example.description}] "
|
24
26
|
exp_file = Expressir.root_path.join("spec", "syntax", "multiple.exp")
|
25
27
|
formatted_exp_file = Expressir.root_path.join("spec", "syntax", "multiple_formatted.exp")
|
26
28
|
|
@@ -33,7 +35,8 @@ RSpec.describe Expressir::Express::Formatter do
|
|
33
35
|
expect(result).to eq(expected_result)
|
34
36
|
end
|
35
37
|
|
36
|
-
it "exports an object (remark.exp)" do
|
38
|
+
it "exports an object (remark.exp)" do |example|
|
39
|
+
print "\n[#{example.description}] "
|
37
40
|
exp_file = Expressir.root_path.join("spec", "syntax", "remark.exp")
|
38
41
|
formatted_exp_file = Expressir.root_path.join("spec", "syntax", "remark_formatted.exp")
|
39
42
|
|
@@ -46,7 +49,8 @@ RSpec.describe Expressir::Express::Formatter do
|
|
46
49
|
expect(result).to eq(expected_result)
|
47
50
|
end
|
48
51
|
|
49
|
-
it "exports an object (syntax.exp)" do
|
52
|
+
it "exports an object (syntax.exp)" do |example|
|
53
|
+
print "\n[#{example.description}] "
|
50
54
|
exp_file = Expressir.root_path.join("spec", "syntax", "syntax.exp")
|
51
55
|
formatted_exp_file = Expressir.root_path.join("spec", "syntax", "syntax_formatted.exp")
|
52
56
|
|
@@ -59,7 +63,8 @@ RSpec.describe Expressir::Express::Formatter do
|
|
59
63
|
expect(result).to eq(expected_result)
|
60
64
|
end
|
61
65
|
|
62
|
-
it "exports an object with schema head formatter (syntax.exp)" do
|
66
|
+
it "exports an object with schema head formatter (syntax.exp)" do |example|
|
67
|
+
print "\n[#{example.description}] "
|
63
68
|
exp_file = Expressir.root_path.join("spec", "syntax", "syntax.exp")
|
64
69
|
formatted_exp_file = Expressir.root_path.join("spec", "syntax", "syntax_schema_head_formatted.exp")
|
65
70
|
|
@@ -75,7 +80,8 @@ RSpec.describe Expressir::Express::Formatter do
|
|
75
80
|
expect(result).to eq(expected_result)
|
76
81
|
end
|
77
82
|
|
78
|
-
it "exports an object with hyperlink formatter (syntax.exp)" do
|
83
|
+
it "exports an object with hyperlink formatter (syntax.exp)" do |example|
|
84
|
+
print "\n[#{example.description}] "
|
79
85
|
exp_file = Expressir.root_path.join("spec", "syntax", "syntax.exp")
|
80
86
|
formatted_exp_file = Expressir.root_path.join("spec", "syntax", "syntax_hyperlink_formatted.exp")
|
81
87
|
|
@@ -91,7 +97,8 @@ RSpec.describe Expressir::Express::Formatter do
|
|
91
97
|
expect(result).to eq(expected_result)
|
92
98
|
end
|
93
99
|
|
94
|
-
it "exports an object with hyperlink formatter (multiple.exp)" do
|
100
|
+
it "exports an object with hyperlink formatter (multiple.exp)" do |example|
|
101
|
+
print "\n[#{example.description}] "
|
95
102
|
exp_file = Expressir.root_path.join("spec", "syntax", "multiple.exp")
|
96
103
|
formatted_exp_file = Expressir.root_path.join("spec", "syntax", "multiple_hyperlink_formatted.exp")
|
97
104
|
|
@@ -107,7 +114,8 @@ RSpec.describe Expressir::Express::Formatter do
|
|
107
114
|
expect(result).to eq(expected_result)
|
108
115
|
end
|
109
116
|
|
110
|
-
it "exports an object with schema head and hyperlink formatter (multiple.exp)" do
|
117
|
+
it "exports an object with schema head and hyperlink formatter (multiple.exp)" do |example|
|
118
|
+
print "\n[#{example.description}] "
|
111
119
|
exp_file = Expressir.root_path.join("spec", "syntax", "multiple.exp")
|
112
120
|
formatted_exp_file = Expressir.root_path.join("spec", "syntax", "multiple_schema_head_hyperlink_formatted.exp")
|
113
121
|
|