rubytext 0.0.75 → 0.0.76

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: a2acea42c858102e0d0981aff34471d14c59fb2d4d62b59f20dc0f90043df6b7
4
- data.tar.gz: 6eb49c4aebe900917daa32b677af256d8be771ce2f18d6a85b3c1c36404e15d4
3
+ metadata.gz: 57dc0a7d99cad64dde62865a3bd48f8e5cd49644390f9089371fe121a742e6b4
4
+ data.tar.gz: 4e89cb5f8394f4ac36a2e7599720b9a03111f1de4b428545e245c457b0bf7ca3
5
5
  SHA512:
6
- metadata.gz: 49eeaa10f9ef6ace669de200771ec4419606de81c3bd5c73fd1087af35a0966dcfd2fbfb87bac3aaca53d8b318e40b34f956ce37d1c63e0aaa830f1beb833599
7
- data.tar.gz: 74a6745f51c1a62fe2b16679d1e114ede879f10ae51838a6ecdfb597feb42584ef9fbc08b96ff844165f6c93216b21e0ad7f32636f41f1abd520062bd5756e4b
6
+ metadata.gz: 125ff3fe92c91935c218f80da9980242725fd6c47949e394d4b35dfc34b252c378193861041e02275cc8f9b934d6f85ca392209cd50b0a5bff18b90b149a8c41
7
+ data.tar.gz: bf92b9b47a490046e7ebc35d77d9d7bbe7e664034dae83e06b9eb97990c4db5027aa430b9d4c48b6185360904fff66167c6be329d5003761a21b7b63bf24a095
data/lib/rubytext.rb CHANGED
@@ -45,7 +45,7 @@ def make_exception(sym, str)
45
45
  define_method(sym) do |*args|
46
46
  msg = str
47
47
  list = (args + [nil]*2)[0..2]
48
- list.each.with_index {|arg, i| msg.sub!("$#{i+1}", arg) }
48
+ list.each.with_index {|arg, i| msg.sub!("$#{i+1}", arg.to_s) }
49
49
  Object.class_eval(sym.to_s).new(msg)
50
50
  end
51
51
  end
data/lib/settings.rb CHANGED
@@ -1,9 +1,16 @@
1
1
  module RubyText
2
2
  # Hmm, all these are module-level.
3
3
 
4
+ ValidArgs = [:raw, :_raw, :echo, :_echo, :cbreak, :_cbreak]
5
+
4
6
  def self.start(*args, log: "/tmp/rubytext.log",
5
7
  fg: White, bg: Blue, scroll: false)
6
8
  $debug ||= File.new(log, "w") if log # FIXME remove global
9
+
10
+ args.each {|arg| raise "#{arg} is not valid" unless ValidArgs.include?(arg) }
11
+ raise "#{fg} is not a color" unless ::Colors.include? fg
12
+ raise "#{bg} is not a color" unless ::Colors.include? bg
13
+
7
14
  main = RubyText::Window.main(fg: fg, bg: bg, scroll: scroll)
8
15
  Object.const_set(:STDSCR, main) unless defined? STDSCR
9
16
  $stdscr = STDSCR # FIXME global needed?
data/lib/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  module RubyText
3
- VERSION = "0.0.75"
3
+ VERSION = "0.0.76"
4
4
 
5
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  end
data/test/auto.rb CHANGED
@@ -19,26 +19,26 @@ class MyTest < Minitest::Test
19
19
  RubyText.start
20
20
  curr = RubyText.flags
21
21
  RubyText.stop
22
- assert curr == [:cbreak, :echo, :keypad, :cursor, :_raw]
22
+ assert curr == [:cbreak, :_echo, :keypad], "Got #{curr.inspect}"
23
23
  end
24
24
 
25
- def xtest_002_start_bad_param
25
+ def test_002_start_bad_param
26
26
  assert_raises(RTError) { RubyText.start(:foobar); RubyText.stop }
27
27
  end
28
28
 
29
- def xtest_003_start_bad_color
29
+ def test_003_start_bad_color
30
30
  assert_raises(RTError) { RubyText.start(fg: :chartreuse); RubyText.stop }
31
31
  end
32
32
 
33
33
  def test_004_set_reset
34
34
  RubyText.start
35
- orig = [:cbreak, :echo, :keypad, :cursor, :_raw]
35
+ orig = [:cbreak, :_echo, :keypad]
36
36
  assert RubyText.flags == orig
37
37
 
38
38
  used = [:raw, :_cursor, :_echo]
39
39
  RubyText.set(*used)
40
40
  curr = RubyText.flags
41
- assert used.all? {|x| curr.include? x }
41
+ assert used.all? {|x| curr.include? x }, "Got #{curr.inspect}"
42
42
 
43
43
  RubyText.reset
44
44
  assert RubyText.flags == orig
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubytext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.75
4
+ version: 0.0.76
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton