rkumar / rbcurse

ruby based curses widgets: fields, buttons, textarea. menus, message boxes, tabbed panes, tables, listboxes, splitpanes, scrollpanes. Event based, MVC architecture. (DEPRECATED - PLS USE rbcurse-core)
http://totalrecall.wordpress.com/
138 stars 15 forks source link

About Ruby ncurses gem dependency under Ruby 1.9 #2

Closed ibc closed 14 years ago

ibc commented 14 years ago

Hi, rbcurse master fails to install under Ruby 1.9:

irb> require "rbcurse"                                                                                                                                      
SyntaxError: /usr/local/lib/ruby1.9/gems/1.9.1/gems/rbcurse-0.1.3/lib/rbcurse/rwidget.rb:122: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n'
/usr/local/lib/ruby1.9/gems/1.9.1/gems/rbcurse-0.1.3/lib/rbcurse/rwidget.rb:124: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n'             
    from /usr/local/lib/ruby1.9/gems/1.9.1/gems/rbcurse-0.1.3/lib/rbcurse.rb:3:in `require'                                                                         
    from /usr/local/lib/ruby1.9/gems/1.9.1/gems/rbcurse-0.1.3/lib/rbcurse.rb:3:in `<top (required)>'

So I want to test the branch "rbcurse19". However it depends of Ruby ncurses library, but the gemspec doesn't include such dependency.

Anyhow there are some existing ncurses gems, but the only that can be installed under Ruby1.9 is "elliottcable-ncurses". Is it the expected behavior? This gem creates the "ncurses.so" required by rbcurse.

Also, when building the gem using "gem build rbcurse.gemspec" it fails since some files don't exist (as Manifest.txt, README and so).

rkumar commented 14 years ago

For rbcurse19 branch, please see the readme.markdown (under the 19 branch) which explains how to get the ncurses gem or compile it. I have put up a working ncurses gem on a public folder.

Strange about the missing files. I will check, but perhaps you can delete the missing files and retry -- if they are only readme and such text files.

As far as not mentioning ncurses in the gemspec dependency, could you help me - how exactly do i specify it -- i am not sure of syntax.

No - elliotcable's ncurses does not work - same problem as original one - IIRC.

ibc commented 14 years ago

Thanks for the response, I'll check it.

About gem dependency, your gemspec already contains an example:

s.add_dependency(%q<hoe>, [">= 1.8.3"])

A simplesr case:

spec.add_dependency 'httpclient'
ibc commented 14 years ago

About ncurses-ruby for Ruby1.9, the READM.markdown says:

  1. Download http://prdownload.berlios.de/ncurses-ruby/ncurses-ruby-1.2.4.tar.bz2
  2. unzip the file, cd into dir
  3. run install commands as per README (ruby extconf.rb && make)
  4. Create a gemspec ... use this file http://gist.github.com/201877 Save it as ncurses.gemspec
  5. sudo gem build ncurses.gemspec
  6. sudo gem install --local ncurses-1.2.4.gem
  7. uninstall any previous ncurses or ncurses-ruby version otherwise errors will persist at runtime.
  8. check with gem list --local and you should see ncurses (1.2.4). The examples in the ncurses-ruby/examples folder should work. (Check the first line regarding interpreter first).
  9. As a last resort, I've put up a copy of the gem here.

It doesn't make sense to install it locally (with ruby extconf.rb; make; make install) and later by creating a gem and installing it. The first way alreayd installs the library under /usr/local/lib/, so they are redundant tasks.

ANyhow, by installing the library in both ways I get the following error when trying to test the documentation first example:

irb> require "rbcurse"
irb> @layout = { :height => 0, :width => 0, :top => 0, :left => 0 }
irb> @win = VER::Window.new(@layout)
NoMethodError: undefined method `stdscr' for Ncurses:Module
    from /usr/local/lib/ruby1.9/gems/1.9.1/gems/rbcurse-0.1.2/lib/ver/window.rb:249:in `default_for'
    from /usr/local/lib/ruby1.9/gems/1.9.1/gems/rbcurse-0.1.2/lib/ver/window.rb:240:in `layout_value'
    from /usr/local/lib/ruby1.9/gems/1.9.1/gems/rbcurse-0.1.2/lib/ver/window.rb:234:in `block in reset_layout'
    from /usr/local/lib/ruby1.9/gems/1.9.1/gems/rbcurse-0.1.2/lib/ver/window.rb:233:in `each'
    from /usr/local/lib/ruby1.9/gems/1.9.1/gems/rbcurse-0.1.2/lib/ver/window.rb:233:in `reset_layout'
    from /usr/local/lib/ruby1.9/gems/1.9.1/gems/rbcurse-0.1.2/lib/ver/window.rb:11:in `initialize'

However examples under examples/ directory do work.

rkumar commented 14 years ago

Actually, the samples given are not self-contained examples and cannot be copied and run. They require the setup to be done. The examples in the examples folder should be executable.

The samples are only to illustrate how the syntax for creation, to give a little flavor of what the gem provides. In fact, most likely some syntax is (slightly) obsolete.

As far as your second comment about the install redundancy, (iirc) i tried so many things to get it to work that i lost track, and (b) I was (and still am) a bit confused about installing. To create a gem, i had around a lot to find out how. Much later i found that Rake already has a command for that!

I will correct the documentation asap. Am glad you have the examples working. BTW, i am working on rbcurse19 daily and commiting, and there's every possibility that things can (and have) broken here and there.

Very hard for me to test, since its UI related.

rkumar commented 14 years ago

For installing ncurses-ruby on OS X Snow Leopard, please see http://trickyco.de/