rubytext 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f9706214a64b67c6b81b72adc3b951dba3cfe1af3aacadd562cdb0e62876eb5
4
- data.tar.gz: fcd6794f8397d6536f1092c1cd16c911ab4dbb9ee076b609bd4a15191e69451a
3
+ metadata.gz: 99428391f66696394d33b29b3e7a271a7d467e19270d856f8108702ed891d20f
4
+ data.tar.gz: 89b0b3c2da89a6baa418fb6507d19e81df904b31150529390f40b30449239266
5
5
  SHA512:
6
- metadata.gz: 7ebfef6f7281a59917264662ccca043228b4c0ec690988469e07892e768a32398cc91bbc8eddddf479b3902d0417707c008777a70aabb557a10ef31fbae71217
7
- data.tar.gz: 7f72ac0747d0b5b4b8d6b1cdafb31c725a35d74bee19711ac25f885909df5a660d79cc14c2df94a4fd7066fe3001cea862df46b3dfdfbde749b328eea5378a6c
6
+ metadata.gz: f4a7ad1d7ecc395deefa954f61752a4f83ea0eb6dd3ea40bb7b2aa5b454925e6004607b2e5129b2373fe737e7fbd44a93304d50aef74c2ef8f44872ecc9c1093
7
+ data.tar.gz: caa38b18eaa7a4a9c90bbabc42017915513f315de89df1a9ffe0014e3d74de8403394fae42dca2c1573fdabee61d0a00683c76fa08fa9b51ecc00aa712ee433e
data/README.md CHANGED
@@ -15,6 +15,16 @@ or both.
15
15
  $ rubytext tutorial # (On OS/X) opens tutorial.html
16
16
  ```
17
17
 
18
+ You can also use the `example` subcommand:
19
+
20
+ ```
21
+ $ rubytext example # list all examples
22
+ $ rubytext example progname # run 'prog' example
23
+ ```
24
+
25
+ When you specify the example name, there is no need to
26
+ use the `.rb` extension.
27
+
18
28
  ### Getting started
19
29
 
20
30
  Here's the obligatory hello-world program.
data/bin/rubytext CHANGED
@@ -4,7 +4,7 @@ require 'rubytext' # Remember: Specify STDOUT as needed!
4
4
 
5
5
  path = RubyText::Path
6
6
 
7
- cmd = ARGV.first
7
+ cmd, arg = ARGV
8
8
 
9
9
  case cmd
10
10
  when nil
@@ -15,4 +15,14 @@ case cmd
15
15
  system("#{path}/../examples/slides")
16
16
  when "tutorial"
17
17
  system("open #{path}/../tutorial/tutorial.html")
18
+ when "example"
19
+ if arg.nil?
20
+ list = Dir["#{path}/../examples/**"]
21
+ list.map! {|x| File.basename(x).sub(/.rb$/, "") }
22
+ list = list - %w[check demo duh fixme hmmm ide multitest README showme slides]
23
+ puts list
24
+ else
25
+ system("cd #{path}/../examples; ruby showme.rb #{arg}.rb pause; cd -")
26
+ end
18
27
  end
28
+
data/lib/menu.rb CHANGED
@@ -16,14 +16,12 @@ module RubyText
16
16
  mr, mc = r+self.r0, c+self.c0
17
17
  mwin = RubyText.window(high, wide, r: mr, c: mc,
18
18
  fg: fg, bg: bg)
19
-
20
19
  where = self == STDSCR ? [r, c+1] : [r-1, c+1] # wtf?
21
20
  unless title.nil?
22
21
  self.go(*where) do # same row as corner but farther right
23
22
  self.print fx("[ #{title} ]", :bold, fg, bg: bg)
24
23
  end
25
24
  end
26
-
27
25
  X.stdscr.keypad(true)
28
26
  sel = curr
29
27
  max = items.size - 1
@@ -49,6 +47,7 @@ module RubyText
49
47
  self.restback(high, wide, r, c)
50
48
  RubyText.show_cursor
51
49
  return [sel, items[sel]]
50
+ else X.beep
52
51
  end
53
52
  RubyText.show_cursor
54
53
  end
@@ -95,8 +94,11 @@ module RubyText
95
94
  raise
96
95
  end
97
96
  end
97
+ when 9 # tab
98
+ X.flash
98
99
  when quit # parameter
99
100
  exit
101
+ else X.beep # all else is trash
100
102
  end
101
103
  end
102
104
  rescue
data/lib/output.rb CHANGED
@@ -238,6 +238,8 @@ class RubyText::Window
238
238
  when 258 # down
239
239
  next if @history.nil? # move this?
240
240
  gs.history_next
241
+ when Integer
242
+ X.beep
241
243
  else
242
244
  gs.add(ch)
243
245
  end
data/lib/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  module RubyText
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
 
5
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  end
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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton