etna 0.1.27 → 0.1.28
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/etna.completion +137 -55
- data/lib/etna.rb +1 -0
- data/lib/etna/clients/magma/formatting.rb +2 -1
- data/lib/etna/clients/magma/formatting/models_odm_xml.rb +293 -0
- data/lib/etna/clients/magma/workflows/materialize_magma_record_files_workflow.rb +3 -2
- data/lib/etna/command.rb +10 -0
- data/lib/etna/cwl.rb +697 -0
- data/lib/etna/directed_graph.rb +21 -0
- data/lib/etna/filesystem.rb +2 -0
- data/lib/etna/generate_autocompletion_script.rb +11 -6
- data/lib/etna/route.rb +44 -4
- metadata +5 -3
data/lib/etna/directed_graph.rb
CHANGED
@@ -18,6 +18,27 @@ class DirectedGraph
|
|
18
18
|
parents[parent] = parent_parents
|
19
19
|
end
|
20
20
|
|
21
|
+
def paths_from(root)
|
22
|
+
[].tap do |result|
|
23
|
+
parents_of_map = descendants(root)
|
24
|
+
seen = Set.new
|
25
|
+
|
26
|
+
parents_of_map.to_a.sort_by { |k, parents| [-parents.length, k] }.each do |k, parents|
|
27
|
+
unless seen.include?(k)
|
28
|
+
if @children[k].keys.empty?
|
29
|
+
result << parents + [k]
|
30
|
+
else
|
31
|
+
@children[k].keys.dup.sort.each do |c|
|
32
|
+
result << parents + [k, c]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
parents.each { |p| seen.add(p) }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
21
42
|
def descendants(parent)
|
22
43
|
seen = Set.new
|
23
44
|
|
data/lib/etna/filesystem.rb
CHANGED
@@ -230,6 +230,8 @@ module Etna
|
|
230
230
|
end
|
231
231
|
|
232
232
|
def with_writeable(dest, opts = 'w', size_hint: nil, &block)
|
233
|
+
raise "#{self.class.name} requires size_hint in with_writeable" if size_hint.nil?
|
234
|
+
|
233
235
|
super do |io|
|
234
236
|
io.write("File: #{::File.basename(dest)}\n")
|
235
237
|
io.write("Size: #{size_hint}\n")
|
@@ -29,10 +29,12 @@ module Etna
|
|
29
29
|
write %Q(elif [[ -z "$(echo $all_flag_completion_names | xargs)" ]]; then)
|
30
30
|
write "return"
|
31
31
|
write %Q(elif [[ "$all_flag_completion_names" =~ $1\\ ]]; then)
|
32
|
+
write %Q(if ! [[ "$multi_flags" =~ $1\\ ]]; then)
|
32
33
|
write %Q(all_flag_completion_names="${all_flag_completion_names//$1\\ /}")
|
34
|
+
write 'fi'
|
33
35
|
write 'a=$1'
|
34
36
|
write 'shift'
|
35
|
-
write %Q(if [[ "$
|
37
|
+
write %Q(if [[ "$arg_flag_completion_names" =~ $a\\ ]]; then)
|
36
38
|
write 'if [[ "$#" == "1" ]]; then'
|
37
39
|
write %Q(a="${a//--/}")
|
38
40
|
write %Q(a="${a//-/_}")
|
@@ -58,12 +60,14 @@ module Etna
|
|
58
60
|
|
59
61
|
def enable_flags(flags_container)
|
60
62
|
boolean_flags = flags_container.boolean_flags
|
61
|
-
|
62
|
-
|
63
|
+
multi_flags = flags_container.multi_flags
|
64
|
+
arg_flags = flags_container.string_flags + multi_flags
|
65
|
+
flags = boolean_flags + arg_flags
|
63
66
|
write %Q(all_flag_completion_names="$all_flag_completion_names #{flags.join(' ')} ")
|
64
|
-
write %Q(
|
67
|
+
write %Q(arg_flag_completion_names="$arg_flag_completion_names #{arg_flags.join(' ')} ")
|
68
|
+
write %Q(multi_flags="$multi_flags #{multi_flags.join(' ')} ")
|
65
69
|
|
66
|
-
|
70
|
+
arg_flags.each do |flag|
|
67
71
|
write %Q(declare _completions_for_#{flag_as_parameter(flag)}="#{completions_for(flag_as_parameter(flag)).join(' ')}")
|
68
72
|
end
|
69
73
|
end
|
@@ -107,7 +111,8 @@ function _#{name}_completions() {
|
|
107
111
|
|
108
112
|
function _#{name}_inner_completions() {
|
109
113
|
local all_flag_completion_names=''
|
110
|
-
local
|
114
|
+
local arg_flag_completion_names=''
|
115
|
+
local multi_flags=''
|
111
116
|
local all_completion_names=''
|
112
117
|
local i=''
|
113
118
|
local a=''
|
data/lib/etna/route.rb
CHANGED
@@ -9,6 +9,7 @@ module Etna
|
|
9
9
|
@name = route_name(options)
|
10
10
|
@route = route.gsub(/\A(?=[^\/])/, '/')
|
11
11
|
@block = block
|
12
|
+
@match_ext = options[:match_ext]
|
12
13
|
end
|
13
14
|
|
14
15
|
def to_hash
|
@@ -72,9 +73,7 @@ module Etna
|
|
72
73
|
user = request.env['etna.user']
|
73
74
|
|
74
75
|
params = request.env['rack.request.params'].map do |key,value|
|
75
|
-
|
76
|
-
value = value[0..500] + "..." + value[-100..-1] if value.length > 600
|
77
|
-
[ key, value ]
|
76
|
+
[ key, redact(key, value) ]
|
78
77
|
end.to_h
|
79
78
|
|
80
79
|
logger.warn("User #{user ? user.email : :unknown} calling #{controller}##{action} with params #{params}")
|
@@ -94,6 +93,39 @@ module Etna
|
|
94
93
|
|
95
94
|
private
|
96
95
|
|
96
|
+
def application
|
97
|
+
@application ||= Etna::Application.instance
|
98
|
+
end
|
99
|
+
|
100
|
+
def compact(value)
|
101
|
+
value = value.to_s
|
102
|
+
value = value[0..500] + "..." + value[-100..-1] if value.length > 600
|
103
|
+
value
|
104
|
+
end
|
105
|
+
|
106
|
+
def redact_keys
|
107
|
+
@redact_keys ||= application.config(:log_redact_keys).split(",").map do |key|
|
108
|
+
key.to_sym
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def redact(key, value)
|
113
|
+
# From configuration, redact any values for the supplied key values, so they
|
114
|
+
# don't appear in the logs.
|
115
|
+
return compact(value) unless application.config(:log_redact_keys)
|
116
|
+
|
117
|
+
if value.is_a?(Hash)
|
118
|
+
redacted_value = value.map do |value_key, value_value|
|
119
|
+
[ value_key, redact(value_key, value_value) ]
|
120
|
+
end.to_h
|
121
|
+
return redacted_value
|
122
|
+
elsif redact_keys.include?(key)
|
123
|
+
return "*"
|
124
|
+
end
|
125
|
+
|
126
|
+
return compact(value)
|
127
|
+
end
|
128
|
+
|
97
129
|
def authorized?(request)
|
98
130
|
# If there is no @auth requirement, they are ok - this doesn't preclude
|
99
131
|
# them being rejected in the controller response
|
@@ -145,13 +177,21 @@ module Etna
|
|
145
177
|
)
|
146
178
|
end
|
147
179
|
|
180
|
+
def separator_free_match
|
181
|
+
if @match_ext
|
182
|
+
'(?<\1>[^\/\?]+)'
|
183
|
+
else
|
184
|
+
'(?<\1>[^\.\/\?]+)'
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
148
188
|
def route_regexp
|
149
189
|
@route_regexp ||=
|
150
190
|
Regexp.new(
|
151
191
|
'\A' +
|
152
192
|
@route.
|
153
193
|
# any :params match separator-free strings
|
154
|
-
gsub(NAMED_PARAM,
|
194
|
+
gsub(NAMED_PARAM, separator_free_match).
|
155
195
|
# any *params match arbitrary strings
|
156
196
|
gsub(GLOB_PARAM, '(?<\1>.+)').
|
157
197
|
# ignore any trailing slashes in the route
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: etna
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saurabh Asthana
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: nokogiri
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- lib/etna/clients/magma/client.rb
|
108
108
|
- lib/etna/clients/magma/formatting.rb
|
109
109
|
- lib/etna/clients/magma/formatting/models_csv.rb
|
110
|
+
- lib/etna/clients/magma/formatting/models_odm_xml.rb
|
110
111
|
- lib/etna/clients/magma/models.rb
|
111
112
|
- lib/etna/clients/magma/workflows.rb
|
112
113
|
- lib/etna/clients/magma/workflows/add_project_models_workflow.rb
|
@@ -139,6 +140,7 @@ files:
|
|
139
140
|
- lib/etna/controller.rb
|
140
141
|
- lib/etna/cross_origin.rb
|
141
142
|
- lib/etna/csvs.rb
|
143
|
+
- lib/etna/cwl.rb
|
142
144
|
- lib/etna/describe_routes.rb
|
143
145
|
- lib/etna/directed_graph.rb
|
144
146
|
- lib/etna/environment_scoped.rb
|