livetext 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/lib/livetext.rb +19 -5
  3. data/livetext.gemspec +2 -2
  4. data/test/test.rb +13 -13
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e687858325843870a52b6326917c6fd29064dd8
4
- data.tar.gz: ab6d2aedac807c98a661267f3143037f7404be69
3
+ metadata.gz: 58616785a3710e488a7544ebbddf8252b0c1c3c1
4
+ data.tar.gz: f72aabb6d7ac5a8e82853432feba4cb3a7f764d8
5
5
  SHA512:
6
- metadata.gz: 00972e0a5a2256bbac5a88aad28dd0feb601c14907b8c8daac46bb7dbf162842b0447f65db2f755f52296f168d078aa9ee298ca867b9c0feacbe3832ed7941c2
7
- data.tar.gz: a597ae81fa81400a6c15571de5fad559e4c748d7113d19899aa415909ad2ac87c748bfd92b1d6e23fba39f4e27515211447a9495fb097d02692ab489b741fc23
6
+ metadata.gz: 5eb339456e6106843986d544b011644e1ebe1d1c0de18f3c5d44496bd8895d4b48e5423dd826a60a5da7e925e805c1e10f65533504f9670b5d2e7affcbfb57df
7
+ data.tar.gz: f6278c805e1aee2e0a2ca9a217a87c69591f3efdec5eda9fbd606f53b5544a6c6c31f42fee9249ed51081dc859e44e5797012004ac1686ef251b207bc0a393b6
data/lib/livetext.rb CHANGED
@@ -15,7 +15,7 @@ class Enumerator
15
15
  end
16
16
 
17
17
  class Livetext
18
- VERSION = "0.5.3"
18
+ VERSION = "0.5.4"
19
19
 
20
20
  MainSigil = "."
21
21
  Sigils = [MainSigil]
@@ -460,21 +460,32 @@ module Livetext::Standard
460
460
  _optional_blank_line
461
461
  end
462
462
 
463
+ def _pushfile(fname)
464
+ @source_files ||= []
465
+ @source_files.push(@file)
466
+ @file = fname
467
+ end
468
+
469
+ def _popfile
470
+ @file = @source_files.pop
471
+ end
472
+
463
473
  def _include
464
474
  file = _args.first
465
475
  lines = ::File.readlines(file)
466
- @file = file
476
+ _pushfile(file)
467
477
  # STDERR.puts "_include: ****** Set @file = #@file"
468
478
  lines.each {|line| _debug " inc: #{line}" }
469
479
  rem = @input.remaining
470
480
  array = lines + rem
471
481
  @input = array.each # FIXME .with_index
472
482
  _optional_blank_line
483
+ _popfile
473
484
  end
474
485
 
475
486
  def include!
476
487
  file = _args.first
477
- @file = file
488
+ _pushfile
478
489
  # TTY.puts "include!: ****** file = #{file}"
479
490
  existing = File.exist?(file)
480
491
  return if not existing
@@ -485,6 +496,7 @@ module Livetext::Standard
485
496
  array = lines + rem
486
497
  @input = array.each # FIXME .with_index
487
498
  _optional_blank_line
499
+ _popfile
488
500
  end
489
501
 
490
502
  def mixin
@@ -492,21 +504,23 @@ module Livetext::Standard
492
504
  file = "#{CWD}/" + name + ".rb"
493
505
  return if @_mixins.include?(file)
494
506
  @_mixins << file
495
- @file = file
507
+ _pushfile(file)
496
508
  # TTY.puts "mixin: ****** file = #{file} "
497
509
  text = ::File.read(file)
498
510
  self.class.class_eval(text)
499
511
  init = "init_#{name}"
500
512
  self.send(init) if self.respond_to? init
501
513
  _optional_blank_line
514
+ _popfile
502
515
  end
503
516
 
504
517
  def copy
505
518
  file = _args.first
506
- @file = file
519
+ _pushfile(file)
507
520
  # TTY.puts "copy: ****** file = #{file}"
508
521
  @output.puts ::File.readlines(file)
509
522
  _optional_blank_line
523
+ _popfile
510
524
  end
511
525
 
512
526
  def r
data/livetext.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'livetext'
3
- s.version = '0.5.3'
4
- s.date = '2017-02-05'
3
+ s.version = '0.5.4'
4
+ s.date = '2017-02-09'
5
5
  s.summary = "A smart processor for text"
6
6
  s.description = "A smart text processor extensible in Ruby"
7
7
  s.authors = ["Hal Fulton"]
data/test/test.rb CHANGED
@@ -30,31 +30,31 @@ class TestingLiveText < MiniTest::Test
30
30
  system("rm -f #{out} #{err}") # only on success
31
31
  end
32
32
 
33
- def xtest_hello_world; external_files end
34
- def xtest_basic_formatting; external_files end
33
+ def test_hello_world; external_files end
34
+ def test_basic_formatting; external_files end
35
35
 
36
- def xtest_comments_ignored_1; external_files end
37
- def xtest_block_comment; external_files end
36
+ def test_comments_ignored_1; external_files end
37
+ def test_block_comment; external_files end
38
38
 
39
- def xtest_simple_vars; external_files end
40
- def xtest_more_complex_vars; external_files end
39
+ def test_simple_vars; external_files end
40
+ def test_more_complex_vars; external_files end
41
41
 
42
- def xtest_sigil_can_change; external_files end
42
+ def test_sigil_can_change; external_files end
43
43
 
44
- def xtest_def_method; external_files end
44
+ def test_def_method; external_files end
45
45
 
46
- def xtest_single_raw_line; external_files end
46
+ def test_single_raw_line; external_files end
47
47
 
48
48
  def test_simple_include; external_files end
49
49
  def test_simple_mixin; external_files end
50
50
  def test_simple_copy; external_files end
51
51
  def test_copy_is_raw; external_files end
52
- def xtest_raw_text_block; external_files end
52
+ def test_raw_text_block; external_files end
53
53
 
54
- def xtest_example_alpha; external_files end
55
- def xtest_example_alpha2; external_files end
54
+ def test_example_alpha; external_files end
55
+ def test_example_alpha2; external_files end
56
56
 
57
- def xtest_functions; external_files end
57
+ def test_functions; external_files end
58
58
 
59
59
  end
60
60
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: livetext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-05 00:00:00.000000000 Z
11
+ date: 2017-02-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A smart text processor extensible in Ruby
14
14
  email: rubyhacker@gmail.com