livetext 0.5.3 → 0.5.4
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/livetext.rb +19 -5
- data/livetext.gemspec +2 -2
- data/test/test.rb +13 -13
- 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: 58616785a3710e488a7544ebbddf8252b0c1c3c1
|
4
|
+
data.tar.gz: f72aabb6d7ac5a8e82853432feba4cb3a7f764d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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.
|
4
|
-
s.date = '2017-02-
|
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
|
34
|
-
def
|
33
|
+
def test_hello_world; external_files end
|
34
|
+
def test_basic_formatting; external_files end
|
35
35
|
|
36
|
-
def
|
37
|
-
def
|
36
|
+
def test_comments_ignored_1; external_files end
|
37
|
+
def test_block_comment; external_files end
|
38
38
|
|
39
|
-
def
|
40
|
-
def
|
39
|
+
def test_simple_vars; external_files end
|
40
|
+
def test_more_complex_vars; external_files end
|
41
41
|
|
42
|
-
def
|
42
|
+
def test_sigil_can_change; external_files end
|
43
43
|
|
44
|
-
def
|
44
|
+
def test_def_method; external_files end
|
45
45
|
|
46
|
-
def
|
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
|
52
|
+
def test_raw_text_block; external_files end
|
53
53
|
|
54
|
-
def
|
55
|
-
def
|
54
|
+
def test_example_alpha; external_files end
|
55
|
+
def test_example_alpha2; external_files end
|
56
56
|
|
57
|
-
def
|
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.
|
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-
|
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
|