fig 1.22.0 → 1.22.1.beta.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -56,7 +56,7 @@ module Fig
56
56
  if node_cache[:package].has_key?(index)
57
57
  cached = node_cache[:package][index]
58
58
  if cached
59
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
59
+ node_cache[:package][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
60
60
  @index = cached.interval.end
61
61
  end
62
62
  return cached
@@ -110,7 +110,7 @@ module Fig
110
110
  if node_cache[:config_statement].has_key?(index)
111
111
  cached = node_cache[:config_statement][index]
112
112
  if cached
113
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
113
+ node_cache[:config_statement][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
114
114
  @index = cached.interval.end
115
115
  end
116
116
  return cached
@@ -119,26 +119,32 @@ module Fig
119
119
  i0 = index
120
120
  r1 = _nt_override
121
121
  if r1
122
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
122
123
  r0 = r1
123
124
  else
124
125
  r2 = _nt_include
125
126
  if r2
127
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
126
128
  r0 = r2
127
129
  else
128
130
  r3 = _nt_include_file
129
131
  if r3
132
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
130
133
  r0 = r3
131
134
  else
132
135
  r4 = _nt_command
133
136
  if r4
137
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
134
138
  r0 = r4
135
139
  else
136
140
  r5 = _nt_path
137
141
  if r5
142
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
138
143
  r0 = r5
139
144
  else
140
145
  r6 = _nt_set
141
146
  if r6
147
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
142
148
  r0 = r6
143
149
  else
144
150
  @index = i0
@@ -193,16 +199,16 @@ module Fig
193
199
  if node_cache[:include_file].has_key?(index)
194
200
  cached = node_cache[:include_file][index]
195
201
  if cached
196
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
202
+ node_cache[:include_file][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
197
203
  @index = cached.interval.end
198
204
  end
199
205
  return cached
200
206
  end
201
207
 
202
208
  i0, s0 = index, []
203
- if has_terminal?('include-file', false, index)
204
- r1 = instantiate_node(SyntaxNode,input, index...(index + 12))
205
- @index += 12
209
+ if (match_len = has_terminal?('include-file', false, index))
210
+ r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
211
+ @index += match_len
206
212
  else
207
213
  terminal_parse_failure('include-file')
208
214
  r1 = nil
@@ -230,9 +236,9 @@ module Fig
230
236
  s0 << r4
231
237
  if r4
232
238
  i6, s6 = index, []
233
- if has_terminal?(':', false, index)
234
- r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
235
- @index += 1
239
+ if (match_len = has_terminal?(':', false, index))
240
+ r7 = true
241
+ @index += match_len
236
242
  else
237
243
  terminal_parse_failure(':')
238
244
  r7 = nil
@@ -289,7 +295,7 @@ module Fig
289
295
  if node_cache[:file_path].has_key?(index)
290
296
  cached = node_cache[:file_path][index]
291
297
  if cached
292
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
298
+ node_cache[:file_path][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
293
299
  @index = cached.interval.end
294
300
  end
295
301
  return cached
@@ -297,9 +303,9 @@ module Fig
297
303
 
298
304
  i0 = index
299
305
  i1, s1 = index, []
300
- if has_terminal?('"', false, index)
301
- r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
302
- @index += 1
306
+ if (match_len = has_terminal?('"', false, index))
307
+ r2 = true
308
+ @index += match_len
303
309
  else
304
310
  terminal_parse_failure('"')
305
311
  r2 = nil
@@ -309,19 +315,21 @@ module Fig
309
315
  s3, i3 = [], index
310
316
  loop do
311
317
  i4 = index
312
- if has_terminal?('\G[^"\\\\]', true, index)
318
+ if has_terminal?(@regexps[gr = '\A[^"\\\\]'] ||= Regexp.new(gr), :regexp, index)
313
319
  r5 = true
314
320
  @index += 1
315
321
  else
322
+ terminal_parse_failure('[^"\\\\]')
316
323
  r5 = nil
317
324
  end
318
325
  if r5
326
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
319
327
  r4 = r5
320
328
  else
321
329
  i6, s6 = index, []
322
- if has_terminal?('\\', false, index)
323
- r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
324
- @index += 1
330
+ if (match_len = has_terminal?('\\', false, index))
331
+ r7 = true
332
+ @index += match_len
325
333
  else
326
334
  terminal_parse_failure('\\')
327
335
  r7 = nil
@@ -329,7 +337,7 @@ module Fig
329
337
  s6 << r7
330
338
  if r7
331
339
  if index < input_length
332
- r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
340
+ r8 = true
333
341
  @index += 1
334
342
  else
335
343
  terminal_parse_failure("any character")
@@ -345,6 +353,7 @@ module Fig
345
353
  r6 = nil
346
354
  end
347
355
  if r6
356
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
348
357
  r4 = r6
349
358
  else
350
359
  @index = i4
@@ -360,9 +369,9 @@ module Fig
360
369
  r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
361
370
  s1 << r3
362
371
  if r3
363
- if has_terminal?('"', false, index)
364
- r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
365
- @index += 1
372
+ if (match_len = has_terminal?('"', false, index))
373
+ r9 = true
374
+ @index += match_len
366
375
  else
367
376
  terminal_parse_failure('"')
368
377
  r9 = nil
@@ -378,12 +387,13 @@ module Fig
378
387
  r1 = nil
379
388
  end
380
389
  if r1
390
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
381
391
  r0 = r1
382
392
  else
383
393
  i10, s10 = index, []
384
- if has_terminal?("'", false, index)
385
- r11 = instantiate_node(SyntaxNode,input, index...(index + 1))
386
- @index += 1
394
+ if (match_len = has_terminal?("'", false, index))
395
+ r11 = true
396
+ @index += match_len
387
397
  else
388
398
  terminal_parse_failure("'")
389
399
  r11 = nil
@@ -393,19 +403,21 @@ module Fig
393
403
  s12, i12 = [], index
394
404
  loop do
395
405
  i13 = index
396
- if has_terminal?('\G[^\'\\\\]', true, index)
406
+ if has_terminal?(@regexps[gr = '\A[^\'\\\\]'] ||= Regexp.new(gr), :regexp, index)
397
407
  r14 = true
398
408
  @index += 1
399
409
  else
410
+ terminal_parse_failure('[^\'\\\\]')
400
411
  r14 = nil
401
412
  end
402
413
  if r14
414
+ r14 = SyntaxNode.new(input, (index-1)...index) if r14 == true
403
415
  r13 = r14
404
416
  else
405
417
  i15, s15 = index, []
406
- if has_terminal?('\\', false, index)
407
- r16 = instantiate_node(SyntaxNode,input, index...(index + 1))
408
- @index += 1
418
+ if (match_len = has_terminal?('\\', false, index))
419
+ r16 = true
420
+ @index += match_len
409
421
  else
410
422
  terminal_parse_failure('\\')
411
423
  r16 = nil
@@ -413,7 +425,7 @@ module Fig
413
425
  s15 << r16
414
426
  if r16
415
427
  if index < input_length
416
- r17 = instantiate_node(SyntaxNode,input, index...(index + 1))
428
+ r17 = true
417
429
  @index += 1
418
430
  else
419
431
  terminal_parse_failure("any character")
@@ -429,6 +441,7 @@ module Fig
429
441
  r15 = nil
430
442
  end
431
443
  if r15
444
+ r15 = SyntaxNode.new(input, (index-1)...index) if r15 == true
432
445
  r13 = r15
433
446
  else
434
447
  @index = i13
@@ -444,9 +457,9 @@ module Fig
444
457
  r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
445
458
  s10 << r12
446
459
  if r12
447
- if has_terminal?("'", false, index)
448
- r18 = instantiate_node(SyntaxNode,input, index...(index + 1))
449
- @index += 1
460
+ if (match_len = has_terminal?("'", false, index))
461
+ r18 = true
462
+ @index += match_len
450
463
  else
451
464
  terminal_parse_failure("'")
452
465
  r18 = nil
@@ -462,14 +475,16 @@ module Fig
462
475
  r10 = nil
463
476
  end
464
477
  if r10
478
+ r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
465
479
  r0 = r10
466
480
  else
467
481
  s19, i19 = [], index
468
482
  loop do
469
- if has_terminal?('\G[^\\s#:]', true, index)
483
+ if has_terminal?(@regexps[gr = '\A[^\\s#:]'] ||= Regexp.new(gr), :regexp, index)
470
484
  r20 = true
471
485
  @index += 1
472
486
  else
487
+ terminal_parse_failure('[^\\s#:]')
473
488
  r20 = nil
474
489
  end
475
490
  if r20
@@ -485,6 +500,7 @@ module Fig
485
500
  r19 = instantiate_node(SyntaxNode,input, i19...index, s19)
486
501
  end
487
502
  if r19
503
+ r19 = SyntaxNode.new(input, (index-1)...index) if r19 == true
488
504
  r0 = r19
489
505
  else
490
506
  @index = i0
@@ -41,16 +41,16 @@ module Fig
41
41
  if node_cache[:grammar_version].has_key?(index)
42
42
  cached = node_cache[:grammar_version][index]
43
43
  if cached
44
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
44
+ node_cache[:grammar_version][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
45
45
  @index = cached.interval.end
46
46
  end
47
47
  return cached
48
48
  end
49
49
 
50
50
  i0, s0 = index, []
51
- if has_terminal?('grammar', false, index)
52
- r1 = instantiate_node(SyntaxNode,input, index...(index + 7))
53
- @index += 7
51
+ if (match_len = has_terminal?('grammar', false, index))
52
+ r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
53
+ @index += match_len
54
54
  else
55
55
  terminal_parse_failure('grammar')
56
56
  r1 = nil
@@ -74,9 +74,9 @@ module Fig
74
74
  end
75
75
  s0 << r2
76
76
  if r2
77
- if has_terminal?('v', false, index)
78
- r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
79
- @index += 1
77
+ if (match_len = has_terminal?('v', false, index))
78
+ r4 = true
79
+ @index += match_len
80
80
  else
81
81
  terminal_parse_failure('v')
82
82
  r4 = nil
@@ -85,10 +85,11 @@ module Fig
85
85
  if r4
86
86
  s5, i5 = [], index
87
87
  loop do
88
- if has_terminal?('\G[\\d]', true, index)
88
+ if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index)
89
89
  r6 = true
90
90
  @index += 1
91
91
  else
92
+ terminal_parse_failure('[\\d]')
92
93
  r6 = nil
93
94
  end
94
95
  if r6
@@ -43,7 +43,7 @@ module Fig
43
43
  if node_cache[:everything].has_key?(index)
44
44
  cached = node_cache[:everything][index]
45
45
  if cached
46
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
46
+ node_cache[:everything][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
47
47
  @index = cached.interval.end
48
48
  end
49
49
  return cached
@@ -73,7 +73,7 @@ module Fig
73
73
  s5, i5 = [], index
74
74
  loop do
75
75
  if index < input_length
76
- r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
76
+ r6 = true
77
77
  @index += 1
78
78
  else
79
79
  terminal_parse_failure("any character")
@@ -1,6 +1,7 @@
1
1
  require 'highline'
2
2
  require 'net/netrc'
3
3
 
4
+ require 'fig/logging'
4
5
  require 'fig/user_input_error'
5
6
 
6
7
  module Fig; end
@@ -67,11 +68,23 @@ module Fig::Protocol::NetRCEnabled
67
68
  end
68
69
 
69
70
  def get_authentication_from_user(host)
70
- username = HighLine.new.ask("Username for #{host}: ") { |q| q.echo = true }
71
- password = HighLine.new.ask("Password for #{username}@#{host}: ") {
72
- |q| q.echo = false
73
- }
71
+ # This defaults to true, but Net::SSH::Prompt turns it off. Unfortunately,
72
+ # this causes HighLine to barf when there's no input on STDIN, e.g. when
73
+ # running on a continuous integration server.
74
+ HighLine.track_eof = true
75
+
76
+ begin
77
+ username =
78
+ HighLine.new.ask("Username for #{host}: ") { |q| q.echo = true }
79
+ password = HighLine.new.ask("Password for #{username}@#{host}: ") {
80
+ |q| q.echo = false
81
+ }
74
82
 
75
- return NetRCEntry.new username, password
83
+ return NetRCEntry.new username, password
84
+ rescue EOFError => error
85
+ Fig::Logging.debug(error)
86
+
87
+ return nil
88
+ end
76
89
  end
77
90
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fig
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.22.0
4
+ version: 1.22.1.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Foemmel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-20 00:00:00.000000000 Z
11
+ date: 2014-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -404,9 +404,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
404
404
  version: 1.9.2
405
405
  required_rubygems_version: !ruby/object:Gem::Requirement
406
406
  requirements:
407
- - - ">="
407
+ - - ">"
408
408
  - !ruby/object:Gem::Version
409
- version: '0'
409
+ version: 1.3.1
410
410
  requirements: []
411
411
  rubyforge_project:
412
412
  rubygems_version: 2.2.2