Sha256: 6abdc48d5d75a32ac168abaef6cb5a7d19c3ebb6b9e09ef470956375dce3cf94

Contents?: true

Size: 1.15 KB

Versions: 26

Compression:

Stored size: 1.15 KB

Contents

if ARGV.size != 2
  STDERR.puts "Usage: ruby ide.rb libname.rb progname.rb"
  exit
end

require 'rubytext'

RubyText.start

@lib, @code = ARGV

def shell(str)
  STDSCR.clear
  RubyText.show_cursor
  system("stty sane")   # FIXME - dumb hack
  STDSCR.puts "\n\n  When you exit, you will\n  return to the IDE.\n "
  system(str)
  Curses.noecho   # FIXME Shouldn't have to do this stuff
  Curses.stdscr.keypad(true)
  Curses.cbreak   # by default
end

items = ["Edit lib",   # 0
         "Edit code",  # 1
         "Run code",   # 2
         "pry",        # 3
         "Shell",      # 4
         "irb",        # 5
         "RubyDocs",   # 6
         "Quit"]       # 7

def show
  STDSCR.clear
  puts
  puts " World's Simplest Ruby IDE\n "
  puts " Lib  = #{@lib}"
  puts " Code = #{@code}"
  puts 
end

loop do
  show
  n, str = STDSCR.menu(r: 10, c: 5, items: items)
puts n.inspect
  case n
    when 0; system("vi #{@lib}")
    when 1; system("vi #{@code}") 
    when 2; system("tput clear; ruby #{@code}; sleep 5")
    when 3; shell("pry")
    when 4; shell("bash")
    when 5; shell("irb")
    when 6; system("open -a Safari http://ruby-doc.org")
    when 7; exit
  end
end

Version data entries

26 entries across 22 versions & 1 rubygems

Version Path
rubytext-0.1.29 examples/topmenu.rb
rubytext-0.1.29 examples/ide.rb
rubytext-0.1.28 examples/topmenu.rb
rubytext-0.1.28 examples/ide.rb
rubytext-0.1.26 examples/ide.rb
rubytext-0.1.26 examples/topmenu.rb
rubytext-0.1.25 examples/topmenu.rb
rubytext-0.1.25 examples/ide.rb
rubytext-0.1.23 examples/ide.rb
rubytext-0.1.22 examples/ide.rb
rubytext-0.1.21 examples/ide.rb
rubytext-0.1.20 examples/ide.rb
rubytext-0.1.19 examples/ide.rb
rubytext-0.1.18 examples/ide.rb
rubytext-0.1.17 examples/ide.rb
rubytext-0.1.16 examples/ide.rb
rubytext-0.1.15 examples/ide.rb
rubytext-0.1.14 examples/ide.rb
rubytext-0.1.13 examples/ide.rb
rubytext-0.1.12 examples/ide.rb