expressir 1.3.2-aarch64-linux-gnu → 1.4.0-aarch64-linux-gnu
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +6 -1
- data/README.adoc +25 -7
- data/exe/format +3 -7
- data/exe/format-test +1 -1
- data/lib/expressir/cli.rb +11 -13
- data/lib/expressir/model/model_element.rb +32 -16
- data/lib/expressir/model/repository.rb +1 -0
- data/lib/expressir/version.rb +1 -1
- data/lib/expressir.rb +4 -8
- data/spec/acceptance/version_spec.rb +1 -1
- metadata +2 -3
- data/lib/expressir/cli/ui.rb +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e21aeb764e6203eef25203f4bc5be4b460b7d561906f91fcaa665a5802486f20
|
4
|
+
data.tar.gz: 173194066a984c893ebbc0150657e38b6bb08cbac3de10f832f86fc89958f3a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63004f5c60abcd07af686fa8437a851c9a490b8777f947bee48c2fd51d027193b3eeaa70e9d2d1c8ea6c3e0d9deb7c6c1945564f5d27b063c0e49e62a4c36532
|
7
|
+
data.tar.gz: 2e931c1f987a2102e7fcba183b282d228560733f75ea10a8910c7143d1d1fc13c745eaa3e5ccd02f8fcfaaf2add858f4ffa16f74dba3d55084c3d5f6c8ae8642
|
@@ -44,7 +44,7 @@ jobs:
|
|
44
44
|
strategy:
|
45
45
|
fail-fast: false
|
46
46
|
matrix:
|
47
|
-
platform: [ linux-gnu, windows, darwin ]
|
47
|
+
platform: [ linux-gnu, linux-musl, windows, darwin ]
|
48
48
|
steps:
|
49
49
|
- uses: actions/checkout@v4
|
50
50
|
with:
|
@@ -106,6 +106,11 @@ jobs:
|
|
106
106
|
name: pkg-linux-gnu
|
107
107
|
path: pkg
|
108
108
|
|
109
|
+
- uses: actions/download-artifact@v4
|
110
|
+
with:
|
111
|
+
name: pkg-linux-musl
|
112
|
+
path: pkg
|
113
|
+
|
109
114
|
- uses: actions/download-artifact@v4
|
110
115
|
with:
|
111
116
|
name: pkg-windows
|
data/README.adoc
CHANGED
@@ -38,13 +38,22 @@ instructions.
|
|
38
38
|
|
39
39
|
[source, sh]
|
40
40
|
----
|
41
|
-
|
41
|
+
$ expressir
|
42
42
|
|
43
43
|
Commands:
|
44
|
+
expressir format PATH # pretty print EXPRESS schema located at PATH
|
44
45
|
expressir help [COMMAND] # Describe available commands or one specific command
|
45
46
|
expressir version # The Expressir Version
|
46
47
|
----
|
47
48
|
|
49
|
+
=== Pretty print
|
50
|
+
|
51
|
+
[source, sh]
|
52
|
+
----
|
53
|
+
expressir format schemas/resources/action_schema/action_schema.exp
|
54
|
+
----
|
55
|
+
|
56
|
+
|
48
57
|
== Development
|
49
58
|
|
50
59
|
We are following Sandi Metz's Rules for this gem, you can read
|
@@ -66,22 +75,31 @@ Setup your environment.
|
|
66
75
|
[source, sh]
|
67
76
|
----
|
68
77
|
bin/setup
|
78
|
+
git submodule update --init
|
79
|
+
bundle exec rake generate
|
80
|
+
bundle exec rake compile
|
69
81
|
----
|
70
82
|
|
71
83
|
Run the test suite
|
72
84
|
|
73
85
|
[source, sh]
|
74
86
|
----
|
75
|
-
|
87
|
+
bundle exec rake
|
76
88
|
----
|
77
89
|
|
78
90
|
=== Grammar updates
|
79
|
-
EXPRESS grammar is lined as git submodule to ext/express-grammar
|
80
|
-
Shoudl you update it, run ```rake generate```. This command will generate source code for updated native extension using antlr4-native gem.
|
81
|
-
Please note that we create several classes on top of antlr4-native output so using embedded rake task is a real requirement.
|
82
91
|
|
83
|
-
|
84
|
-
|
92
|
+
THe EXPRESS grammar is lined as Git submodule at `ext/express-grammar`.
|
93
|
+
|
94
|
+
Should you update it, please run `rake generate`. This command will generate
|
95
|
+
source code for updated native extension using the `antlr4-native` gem. Please
|
96
|
+
note that we create several classes on top of `antlr4-native` output so using
|
97
|
+
embedded rake task is a real requirement.
|
98
|
+
|
99
|
+
When a new extension is generated and tested, please check in updated C++ files
|
100
|
+
to git (`rake generate` is NOT a CI step, extension source files are pulled from
|
101
|
+
the repo).
|
102
|
+
|
85
103
|
|
86
104
|
== Installation
|
87
105
|
|
data/exe/format
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require "yaml"
|
4
|
-
require "expressir
|
4
|
+
require "expressir"
|
5
5
|
require "expressir/express/formatter"
|
6
6
|
require "expressir/express/schema_head_formatter"
|
7
7
|
require "expressir/express/hyperlink_formatter"
|
@@ -9,10 +9,6 @@ require "expressir/express/hyperlink_formatter"
|
|
9
9
|
exp_files = ARGV
|
10
10
|
|
11
11
|
repository = Expressir::Express::Parser.from_files(exp_files)
|
12
|
-
|
13
|
-
|
14
|
-
include Expressir::Express::HyperlinkFormatter
|
12
|
+
repository.schemas.each do |schema|
|
13
|
+
puts schema.to_s(no_remarks: true)
|
15
14
|
end
|
16
|
-
result = repository.to_hash(formatter: formatter, skip_empty: true)
|
17
|
-
|
18
|
-
puts YAML.dump(result)
|
data/exe/format-test
CHANGED
@@ -75,7 +75,7 @@ formatter = Class.new(Expressir::Express::Formatter) do
|
|
75
75
|
include Expressir::Express::SchemaHeadFormatter
|
76
76
|
include Expressir::Express::HyperlinkFormatter
|
77
77
|
end
|
78
|
-
result = repository.to_hash(formatter: formatter
|
78
|
+
result = repository.to_hash(formatter: formatter)
|
79
79
|
puts "Repository.to_hash time: #{(Time.now - start).round(2)}s"
|
80
80
|
|
81
81
|
# puts YAML.dump(result)
|
data/lib/expressir/cli.rb
CHANGED
@@ -1,21 +1,19 @@
|
|
1
1
|
require "thor"
|
2
|
-
require "expressir/cli/ui"
|
3
2
|
|
4
3
|
module Expressir
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
4
|
+
class Cli < Thor
|
5
|
+
desc "format PATH", "pretty print EXPRESS schema located at PATH"
|
6
|
+
def format(path)
|
7
|
+
repository = Expressir::Express::Parser.from_file(path)
|
8
|
+
repository.schemas.each do |schema|
|
9
|
+
puts "\n(* Expressir formatted schema: #{schema.id} *)\n"
|
10
|
+
puts schema.to_s(no_remarks: true)
|
11
|
+
end
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
Cli.ui.say("Version #{Expressir::VERSION}")
|
18
|
-
end
|
14
|
+
desc "version", "Expressir Version"
|
15
|
+
def version
|
16
|
+
say(Expressir::VERSION)
|
19
17
|
end
|
20
18
|
end
|
21
19
|
end
|
@@ -104,20 +104,21 @@ module Expressir
|
|
104
104
|
empty = value.nil? || (value.is_a?(Array) && value.count == 0)
|
105
105
|
|
106
106
|
# skip empty values
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
107
|
+
next unless !empty or include_empty
|
108
|
+
|
109
|
+
hash[variable.to_s] = case value
|
110
|
+
when Array
|
111
|
+
value.map do |value|
|
112
|
+
if value.is_a? ModelElement
|
113
|
+
value.to_hash(root_path: root_path, formatter: formatter, include_empty: include_empty)
|
114
|
+
else
|
115
|
+
value
|
115
116
|
end
|
116
|
-
elsif value.is_a? ModelElement
|
117
|
-
value.to_hash(root_path: root_path, formatter: formatter, include_empty: include_empty)
|
118
|
-
else
|
119
|
-
value
|
120
117
|
end
|
118
|
+
when ModelElement
|
119
|
+
value.to_hash(root_path: root_path, formatter: formatter, include_empty: include_empty)
|
120
|
+
else
|
121
|
+
value
|
121
122
|
end
|
122
123
|
end
|
123
124
|
|
@@ -132,6 +133,19 @@ module Expressir
|
|
132
133
|
hash
|
133
134
|
end
|
134
135
|
|
136
|
+
def to_s
|
137
|
+
to_s(no_remarks: false, formatter: nil)
|
138
|
+
end
|
139
|
+
|
140
|
+
def to_s(no_remarks: false, formatter: nil)
|
141
|
+
formatter ||= Class.new(Expressir::Express::Formatter) do
|
142
|
+
if no_remarks
|
143
|
+
def format_remarks(node); []; end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
formatter.format(self)
|
147
|
+
end
|
148
|
+
|
135
149
|
# @param [Hash] hash
|
136
150
|
# @param [String] root_path
|
137
151
|
# @return [ModelElement]
|
@@ -142,7 +156,8 @@ module Expressir
|
|
142
156
|
node_class.model_attrs.each do |variable|
|
143
157
|
value = hash[variable.to_s]
|
144
158
|
|
145
|
-
node_options[variable] =
|
159
|
+
node_options[variable] = case value
|
160
|
+
when Array
|
146
161
|
value.map do |value|
|
147
162
|
if value.is_a? Hash
|
148
163
|
self.from_hash(value, root_path: root_path)
|
@@ -150,7 +165,7 @@ module Expressir
|
|
150
165
|
value
|
151
166
|
end
|
152
167
|
end
|
153
|
-
|
168
|
+
when Hash
|
154
169
|
self.from_hash(value, root_path: root_path)
|
155
170
|
else
|
156
171
|
value
|
@@ -191,13 +206,14 @@ module Expressir
|
|
191
206
|
self.class.model_attrs.each do |variable|
|
192
207
|
value = self.send(variable)
|
193
208
|
|
194
|
-
|
209
|
+
case value
|
210
|
+
when Array
|
195
211
|
value.each do |value|
|
196
212
|
if value.is_a? ModelElement
|
197
213
|
value.parent = self
|
198
214
|
end
|
199
215
|
end
|
200
|
-
|
216
|
+
when ModelElement
|
201
217
|
value.parent = self
|
202
218
|
end
|
203
219
|
end
|
data/lib/expressir/version.rb
CHANGED
data/lib/expressir.rb
CHANGED
@@ -3,10 +3,6 @@ require "expressir/version"
|
|
3
3
|
require "expressir/cli"
|
4
4
|
require "expressir/config"
|
5
5
|
|
6
|
-
Dir[File.join(__dir__, "expressir", "express", "*.rb")].sort.each do |fea|
|
7
|
-
require fea
|
8
|
-
end
|
9
|
-
|
10
6
|
# ..........................................................
|
11
7
|
# https://bugs.ruby-lang.org/issues/19319
|
12
8
|
# The issue is that this bug is fixed for 3.1 and above,
|
@@ -30,10 +26,6 @@ end
|
|
30
26
|
module Expressir
|
31
27
|
class Error < StandardError; end
|
32
28
|
|
33
|
-
def self.ui
|
34
|
-
Expressir::Cli::UI
|
35
|
-
end
|
36
|
-
|
37
29
|
def self.root
|
38
30
|
File.dirname(__dir__)
|
39
31
|
end
|
@@ -42,3 +34,7 @@ module Expressir
|
|
42
34
|
@root_path ||= Pathname.new(Expressir.root)
|
43
35
|
end
|
44
36
|
end
|
37
|
+
|
38
|
+
Dir[File.join(__dir__, "expressir", "express", "*.rb")].sort.each do |fea|
|
39
|
+
require fea
|
40
|
+
end
|
@@ -19,7 +19,7 @@ RSpec.describe "Expressir" do
|
|
19
19
|
print "\n[#{example.description}] "
|
20
20
|
command = %w(version)
|
21
21
|
output = capture_stdout { Expressir::Cli.start(command) }
|
22
|
-
expect(output).to include(
|
22
|
+
expect(output).to include(Expressir::VERSION)
|
23
23
|
|
24
24
|
# Validate Object Space
|
25
25
|
GC.start
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expressir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: aarch64-linux-gnu
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -240,7 +240,6 @@ files:
|
|
240
240
|
- expressir.gemspec
|
241
241
|
- lib/expressir.rb
|
242
242
|
- lib/expressir/cli.rb
|
243
|
-
- lib/expressir/cli/ui.rb
|
244
243
|
- lib/expressir/config.rb
|
245
244
|
- lib/expressir/express/2.7/express_parser.so
|
246
245
|
- lib/expressir/express/3.0/express_parser.so
|
data/lib/expressir/cli/ui.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require "thor"
|
2
|
-
|
3
|
-
module Expressir
|
4
|
-
module Cli
|
5
|
-
class UI < Thor
|
6
|
-
def self.ask(message)
|
7
|
-
new.ask(message)
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.say(message)
|
11
|
-
new.say(message)
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.error(message)
|
15
|
-
if log_types.include?("error")
|
16
|
-
new.error(message)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.info(message)
|
21
|
-
if log_types.include?("info")
|
22
|
-
new.say(message)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.run(command)
|
27
|
-
require "open3"
|
28
|
-
Open3.capture3(command)
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.log_types
|
32
|
-
Expressir.configuration.logs.map(&:to_s) || []
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|