livetext 0.9.40 → 0.9.42

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08f576f3e284061af1b4dd4037c952ba805859946377d4eb0a53e9035804230c'
4
- data.tar.gz: 724a92c8cb8c58d36baff88fe4b4191b92ed35d5774128a48760e438ece1a396
3
+ metadata.gz: 3cef25ba4a47577159b300d63d723939aef6e5bef6c083685d8f6539e988601e
4
+ data.tar.gz: a20a3a5e09c47639180428833a62c855a0a13d26ec317b49a3e400b9f0b4a64c
5
5
  SHA512:
6
- metadata.gz: 90da438094e5f8c2b09bb9ebc7c93462c462f1fac73866d6acf87ee22e0b7fc5c823a20b4565fe29b8dee71fe6d9df04300586ef0cd777fefff13e3509ab423b
7
- data.tar.gz: d6c92842c26b3c4fc543df37544706190aafb6388ed226b1a0ddc550b2b596b28ce034d139734e7dc6030da6564560a3836c59a97d5bea922fcf6153053bee94
6
+ metadata.gz: b4ddc892156911f77e9bd4b3878e77ddfba0d739b03c5df0fbeefb1b22562c03f173ffdc36fceff940273557a27c12cec0a4aea3a35a5470efdfd5ec360f0261
7
+ data.tar.gz: f222133e7b2e784e15b43241e711e29bad362c10f41857e1e72883aac95d523580127a50a146a5b539e266eea98067e094b6dc3b1490e6b8a2d1b88c1a813b08
data/bin/livetext CHANGED
@@ -5,6 +5,25 @@ require 'rubygems'
5
5
  require_relative '../lib/livetext'
6
6
 
7
7
  def usage
8
+ STDERR.puts <<~EOF
9
+ Usage:
10
+ livetext [options] [filename]
11
+
12
+ Options:
13
+ -v, --version Print version information
14
+ -t, --test Run all tests
15
+ -p, --path Print the path of the installed gem
16
+ -b, --backtrace Enable backtrace information
17
+ -m name, --mixin name Load the specified mixin before processing
18
+ -s, --stdin Read from standard input
19
+ -h, --help Print this help information
20
+ -i name, --install name Install the specified plugin
21
+
22
+ EOF
23
+ exit
24
+ end
25
+
26
+ def old_usage
8
27
  STDERR.puts <<~EOF
9
28
  Usage:
10
29
  livetext filename
@@ -22,6 +41,10 @@ def usage
22
41
  livetext -p
23
42
  livetext --path
24
43
 
44
+ Load a mixin:
45
+ livetext -m name
46
+ livetext --mixin name
47
+
25
48
  Run tests:
26
49
  livetext -t
27
50
  livetext --test
@@ -49,7 +72,7 @@ end
49
72
  def testing
50
73
  file = "#{Livetext::Path}/../../test/all.rb"
51
74
  flag = @backtrace ? "-back" : ""
52
- cmd = "ruby #{file} cmdline#{flag}"
75
+ cmd = "ruby #{file} cmdline #{flag}"
53
76
  puts cmd
54
77
  system(cmd)
55
78
  end
data/lib/livetext/more.rb CHANGED
@@ -101,12 +101,10 @@ class Livetext
101
101
  obj = self.new
102
102
  mix = Array(mix)
103
103
  call = Array(call)
104
- # STDERR.puts "#{__method__}: obj meth = #{obj.methods.sort.inspect}"
105
104
  mix.each do |lib|
106
105
  obj.invoke_dotcmd(:mixin, lib.dup)
107
106
  end
108
107
  call.each {|cmd| obj.main.send(cmd[1..-1]) } # ignores leading dot, no param
109
- # vars.each_pair {|var, val| obj.setvar(var, val.to_s) }
110
108
  obj.api.setvars(vars)
111
109
  obj
112
110
  end
@@ -182,7 +182,12 @@ module Livetext::Standard
182
182
  def variables(args = nil, body = nil)
183
183
  prefix = api.args[0]
184
184
  file = api.args[1]
185
+ puts ">> variables: pre=#{prefix.inspect} file=#{file.inspect} pwd=#{Dir.pwd}"
185
186
  prefix = nil if prefix == "-" # FIXME dumb hack
187
+ here = File.dirname(file)
188
+ dok, fok = Dir.exist?(here), File.exist?(file)
189
+ raise "No such dir #{here.inspect} (file #{file})" unless dok
190
+ raise "No such file #{file.inspect} (file #{file})" unless fok
186
191
  if file
187
192
  here = ::Livetext::Vars[:FileDir] + "/"
188
193
  lines = File.readlines(here + file)
@@ -192,6 +197,9 @@ module Livetext::Standard
192
197
  pairs = Livetext::ParseGeneral.parse_vars(lines, prefix: nil)
193
198
  api.setvars(pairs)
194
199
  api.optional_blank_line
200
+ rescue => e
201
+ puts e
202
+ puts $!
195
203
  end
196
204
 
197
205
  def heredoc(args = nil, body = nil)
@@ -2,5 +2,5 @@
2
2
  # Defining VERSION
3
3
 
4
4
  class Livetext
5
- VERSION = "0.9.40"
5
+ VERSION = "0.9.42"
6
6
  end
data/test/all.rb CHANGED
@@ -1,9 +1,9 @@
1
- require 'simplecov' # These two lines must go first
2
- SimpleCov.start do
3
- puts "SimpleCov: Snapshots"
4
- enable_coverage :branch
5
- add_filter "/test/"
6
- end
1
+ # require 'simplecov' # These two lines must go first
2
+ # SimpleCov.start do
3
+ # puts "SimpleCov: Snapshots"
4
+ # enable_coverage :branch
5
+ # add_filter "/test/"
6
+ # end
7
7
 
8
8
  require_relative 'unit/all'
9
9
  require_relative 'snapshots' # snapshots
@@ -1,7 +1,9 @@
1
1
  Testing heredocs (used in a table)
2
2
  <p>
3
3
 
4
- <br><center><table width=90% cellpadding=5>
4
+ <br>
5
+
6
+ <center><table width=90% cellpadding=5>
5
7
  <tr>
6
8
  <td valign=top>This is <br>only <br>a test.<br></td>
7
9
  <td valign=top>This is <br>just <br>some <br>random text.<br></td>
data/test/snapshots.rb CHANGED
@@ -66,7 +66,8 @@ class TestingLivetext < MiniTest::Test
66
66
 
67
67
  Args = ARGV - ["cmdline"]
68
68
  dir = self.get_dir
69
- Data = "#{dir}test/snapshots"
69
+ # Data = "#{dir}/test/snapshots"
70
+ Data = "../../test/snapshots"
70
71
  Dir.chdir(Data)
71
72
  TestDirs = Dir.entries(".").reject {|fname| ! File.directory?(fname) } - %w[. ..]
72
73
 
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.9.40
4
+ version: 0.9.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-06 00:00:00.000000000 Z
11
+ date: 2024-02-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A smart text processor extensible in Ruby
14
14
  email: rubyhacker@gmail.com