livetext 0.8.92 → 0.8.93

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: e2ce1136c00d4d9696ce4642802da8805ae6ca23992d831d6848f86e87a75863
4
- data.tar.gz: 6656d250c5b2b5864809791b7ae192629afe5db372f4aa700eb21a872752a221
3
+ metadata.gz: e1f54d0984df3ed72f1e75e93088d4df2287d00baad296c0002da2c558fca79e
4
+ data.tar.gz: 6190f65650f8680d9e72093913667d336a7998fbefd3c4d1ae2409004d86d38c
5
5
  SHA512:
6
- metadata.gz: 0073a3ef6256769c2cdb8179416ecaa554a9452d37a787b6bdc431636f40f92ae7023d5c591d04f357cf8b480fec54f7a6366e5e53a27bacc4af8a6d5e77593d
7
- data.tar.gz: b6cee10d8bb591b1bd9869fe35aee04ab1359089953787ed32af397258f61e97da21467c2b7ee899763a8a7607eca06260f1924ec50975a71fb0b93991cd9797
6
+ metadata.gz: 4e87c966f8ad0b0200135e70c6f07f7b73d898fa9081b50fce3f06c05eda799cdfa8d02d189ecea5fe080040aa878e543a55e8ab369600945e4c1594eae7807a
7
+ data.tar.gz: edb16b91ac8501388e3aecb72b96a99b3ff09f7b9d23d09a65b0e4668b94df35f7e1818eb8943519849711042bb8f5dfd413d98fc4cab4496124ef57b6f26203
@@ -70,6 +70,11 @@ loop do
70
70
  puts Livetext::Path
71
71
  when "-b", "--backtrace"
72
72
  @backtrace = true
73
+ when "-m", "--mixin"
74
+ mod = ARGV.shift
75
+ STDERR.puts "Got mod: #{mod}"
76
+ x.mixin(ARGV.shift)
77
+ next
73
78
  when "-s", "--stdin"
74
79
  src = STDIN.read
75
80
  x.process(src)
@@ -78,6 +83,8 @@ loop do
78
83
  when "-i", "--install"
79
84
  lib = ARGV.shift
80
85
  system("cp #{lib} #{Livetext::Path}/../plugin/")
86
+ # when /-.*/
87
+ # raise "Unknown argument '#{arg}'"
81
88
  when Object
82
89
  x.process_file(arg, true) # , @backtrace)
83
90
  end
@@ -1,5 +1,5 @@
1
1
  class Livetext
2
- VERSION = "0.8.92"
2
+ VERSION = "0.8.93"
3
3
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
4
4
  end
5
5
 
@@ -44,6 +44,10 @@ class Livetext
44
44
  @indentation = [0]
45
45
  end
46
46
 
47
+ def mixin(mod)
48
+ @main._mixin(mod)
49
+ end
50
+
47
51
  def _setvar(var, val)
48
52
  str, sym = var.to_s, var.to_sym
49
53
  Livetext::Vars[str] = val
@@ -25,6 +25,7 @@ class Livetext
25
25
  @output = ::Livetext.output = (output || File.open("/dev/null", "w"))
26
26
  @sources = []
27
27
  @indentation = @parent.indentation
28
+ @_mixins = []
28
29
  end
29
30
 
30
31
  def output=(io)
@@ -156,6 +156,7 @@ EOS
156
156
  end
157
157
 
158
158
  def set
159
+ # FIXME bug -- .set var="RIP, Hope Gallery"
159
160
  assigns = @_data.chomp.split(/, */)
160
161
  # Do a better way?
161
162
  # FIXME *Must* allow for vars/functions
@@ -205,11 +206,21 @@ STDERR.puts "-- var=val #{[var, val].inspect}"
205
206
  end
206
207
 
207
208
  def _seek(file)
208
- if File.exist?(file)
209
- return file
210
- else
211
- value = nil
212
- value = _seek("../#{file}") unless Dir.pwd == "/"
209
+ require 'pathname' # ;)
210
+ value = nil
211
+ if File.exist?(file)
212
+ return file
213
+ else
214
+ count = 1
215
+ loop do
216
+ front = "../" * count
217
+ count += 1
218
+ here = Pathname.new(front).expand_path.dirname
219
+ break if here == "/"
220
+ path = front + file
221
+ value = path if File.exist?(path)
222
+ break if value
223
+ end
213
224
  end
214
225
  return value
215
226
  rescue
@@ -220,6 +231,7 @@ STDERR.puts "-- var=val #{[var, val].inspect}"
220
231
  # like include, but search upward as needed
221
232
  file = @_args.first
222
233
  file = _seek(file)
234
+ STDERR.puts "---- _seek found: #{file.inspect}"
223
235
  _error!(file, "No such include file '#{file}'") unless file
224
236
  @parent.process_file(file)
225
237
  _optional_blank_line
@@ -264,6 +276,11 @@ STDERR.puts "-- var=val #{[var, val].inspect}"
264
276
  # _optional_blank_line
265
277
  # end
266
278
 
279
+ def _mixin(name)
280
+ @_args = [name]
281
+ mixin
282
+ end
283
+
267
284
  def mixin
268
285
  name = @_args.first # Expect a module name
269
286
  file = "#{Plugins}/" + name.downcase + ".rb"
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.8.92
4
+ version: 0.8.93
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-17 00:00:00.000000000 Z
11
+ date: 2019-10-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A smart text processor extensible in Ruby
14
14
  email: rubyhacker@gmail.com