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 +4 -4
- data/README.md +10 -0
- data/bin/rubytext +11 -1
- data/lib/menu.rb +4 -2
- data/lib/output.rb +2 -0
- data/lib/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 99428391f66696394d33b29b3e7a271a7d467e19270d856f8108702ed891d20f
         | 
| 4 | 
            +
              data.tar.gz: 89b0b3c2da89a6baa418fb6507d19e81df904b31150529390f40b30449239266
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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 | 
| 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
    
    
    
        data/lib/version.rb
    CHANGED