crossplane 0.1.5 → 0.1.6
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/lib/crossplane/builder.rb +25 -26
- data/lib/crossplane/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5e3cfc8a0a240947d5fee9cf432b5aa59b30690
|
4
|
+
data.tar.gz: 72dc06ed300e36fcedd7b1262a658062e24ef066
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dde69e2919e9be55269d198e3135ac4cbaf071db7e7e1b225ff1976b03e9e6a64ff1210e7fd1b42efbf8d938d810f0076801bcd3fc925f544e9d9fd0c1e9e72
|
7
|
+
data.tar.gz: 85bc44fba437dd5aaafb7ed8619a32302c81bede34de85238d6f9b35baec1bc4b7e69fd748e40da15e44bd552c20f481be7d9275166482903e3f97793c388952
|
data/lib/crossplane/builder.rb
CHANGED
@@ -60,9 +60,7 @@ module CrossPlane
|
|
60
60
|
end
|
61
61
|
|
62
62
|
lines += _build_lines(payload)
|
63
|
-
|
64
|
-
exit
|
65
|
-
return lines.join('')
|
63
|
+
lines.join('')
|
66
64
|
end
|
67
65
|
|
68
66
|
private
|
@@ -106,7 +104,7 @@ module CrossPlane
|
|
106
104
|
|
107
105
|
if directive == 'if'
|
108
106
|
line = format('if (%s)', args.join(' '))
|
109
|
-
elsif args
|
107
|
+
elsif args and args.length > 0
|
110
108
|
line = format('%s %s', directive, args.join(' '))
|
111
109
|
else
|
112
110
|
line = directive
|
@@ -117,7 +115,7 @@ module CrossPlane
|
|
117
115
|
else
|
118
116
|
y.yield(_put_line(line + ' {', obj))
|
119
117
|
|
120
|
-
# set prev_obj to
|
118
|
+
# set prev_obj to proper indentation in block
|
121
119
|
self.state['prev_obj'] = obj
|
122
120
|
_build_lines(obj['block']).each do |line|
|
123
121
|
y.yield(line)
|
@@ -131,6 +129,14 @@ module CrossPlane
|
|
131
129
|
lines.to_a
|
132
130
|
end
|
133
131
|
|
132
|
+
def _enquote(arg)
|
133
|
+
if _needs_quotes(arg)
|
134
|
+
arg = arg.inspect
|
135
|
+
arg = arg.gsub('\\\\', '\\')
|
136
|
+
end
|
137
|
+
arg
|
138
|
+
end
|
139
|
+
|
134
140
|
def _escape(string)
|
135
141
|
chars = Enumerator.new do |y|
|
136
142
|
prev, char = '', ''
|
@@ -168,36 +174,29 @@ module CrossPlane
|
|
168
174
|
# lexer should throw an error when variable expansion syntax
|
169
175
|
# is messed up, but just wrap it in quotes for now I guess
|
170
176
|
chars = _escape(string)
|
177
|
+
char = chars.next
|
178
|
+
|
179
|
+
if CrossPlane.utils.isspace(char) or ['{', ';', '"', "'", '${'].include?(char)
|
180
|
+
return true
|
181
|
+
end
|
182
|
+
|
183
|
+
expanding = false
|
171
184
|
|
172
185
|
begin
|
173
186
|
while char = chars.next
|
187
|
+
if CrossPlane.utils.isspace(char) or ['{', ';', '"', "'"].include?(char)
|
188
|
+
return true
|
174
189
|
|
175
|
-
|
176
|
-
# arguments can't start with variable expansion syntax
|
177
|
-
if CrossPlane.utils.isspace(char) or ['{', ';', '"', "'", '${'].include?(char)
|
190
|
+
elsif char == (expanding ? '${' : '}')
|
178
191
|
return true
|
179
|
-
end
|
180
192
|
|
181
|
-
expanding
|
182
|
-
|
183
|
-
|
184
|
-
# return true
|
185
|
-
# elsif char ==
|
186
|
-
# char in ('\\', '$') or expanding
|
187
|
-
return expanding
|
193
|
+
elsif char == (expanding ? '}' : '${')
|
194
|
+
expanding = !expanding
|
195
|
+
end
|
188
196
|
end
|
197
|
+
return ['\\', '$'].include?(char) ? ['\\', '$'].include?(char) : expanding
|
189
198
|
rescue StopIteration
|
190
199
|
end
|
191
200
|
end
|
192
|
-
|
193
|
-
def _enquote(arg)
|
194
|
-
if _needs_quotes(arg)
|
195
|
-
#arg = repr(codecs.decode(arg, 'raw_unicode_escape'))
|
196
|
-
arg = arg.gsub('\\\\', '\\')
|
197
|
-
end
|
198
|
-
return arg
|
199
|
-
end
|
200
|
-
|
201
|
-
|
202
201
|
end
|
203
202
|
end
|
data/lib/crossplane/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crossplane
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gary Danko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|