<isene>
havenwood: rcurses are getting fuctional - but there's a snag that I cannot get my wits around. I added `rcurses_example.rb` in rcurses_example.rb. When I run it, I get this error (as if io/console was not pulled in - but it is, otherwise I will get another error on .raw in another place); rcurses.rb:144:in `getchr': undefined method `ready?' for #<IO:<STDIN>>
<isene>
... or anyone else in here that wants to check this out...
<isene>
It should be noted that running the content of rcurses_example.rb in irb works just fine
<Sampersand77>
isene `ruby -e 'p $stdin.ready?'` also fails
<Sampersand77>
`ready?` might just be for stdout?
<Sampersand77>
hm`ready?` might just be for stdout?
<Sampersand77>
nope, t's in `io/wait`
<Sampersand77>
isene `ruby -rio/wait -I./lib rcurses_example.rb` works; you should add `require 'io/wait'`
<isene>
Damn, that was the one. Thanks.
<isene>
How did you find it?
Linux_Kerio has quit [Ping timeout: 260 seconds]
<Sampersand77>
cd'd to the ruby repo on my computer and did `rg '\bready\?' .` . It told me it was in `./ext/io/wait/wait.c`, so i tried `-rio/wait` and it worked
crysbot has joined #ruby
crysbot has quit [Client Quit]
<Sampersand77>
also isene, you should make a `csi` and `esc` functions, so you can `def scroll_down = esc('N')`
<Sampersand77>
and on line 174 and co did you literally type in the character `\x01` lol
<isene>
That I didn't understand. Could we try Swahili?
<Sampersand77>
which part
<isene>
csi/esc
<Sampersand77>
ah. ignore it, i was just being silly
<Sampersand77>
Something more important is that ruby actually has escape sequences for control: `"\C-A"` is actually the same as `"\1"`
<Sampersand77>
so you can `when "\C-A" then chr = "C-A"`
<Sampersand77>
ruby also has `\M` so you can `"\M-\C-A` if you really want to lol
<bovis>
If I 'gem install rack', should I expect to see a rack binary? I see 'rackup'. Is there a gem command to view all associated files with an installed gem?
<o0x1eef>
'gem which rack' might help, that'll show you the unpacked gem, and you can see what files are included
hightower4 has quit [Ping timeout: 252 seconds]
polishdub has quit [Remote host closed the connection]
<bovis>
o0x1eef: I'm having an issue with nginx unit being unable to load rack. https://bpa.st/NXJA 'rackup' seems to run fine on its own. Just trying to get to the heart of the problem.
<o0x1eef>
Do you have a config.ru file ? Are you using Bundler ? Maybe you need to activate Bundler first ?
<o0x1eef>
You can do that with "require 'bundler/setup'"
kludger has quit [Quit: kludger]
<o0x1eef>
Btw nginx unit looks cool indeed
___nick___ has quit [Ping timeout: 252 seconds]
<bovis>
o0x1eef: https://unit.nginx.org/howto/samples/#ruby I'm trying that config.ru. What I'm getting is the error in the paste above. Adding the require 'bundler/setup' doesn't get me any different result.
<o0x1eef>
does 'gem list' include rack ?
kludger has joined #ruby
<bovis>
Yes. Rack, rack-session, rack-test, and rackup
<o0x1eef>
It does not look like bundler is used in that example. Your system gems should be used. Are your gems installed local to a user or for all users ? What user runs nginx unit ? How does 'gem list' look for that user ?
user71 has quit [Quit: Leaving]
kludger has quit [Ping timeout: 252 seconds]
<bovis>
o0x1eef: Gems are installed locally. There's only one non-privileged user, which I'm running these attempts as. Unit has its own user 'unit'.
<bovis>
'su unit' asks for a password. That's not something I've set up... any attempt fails.
<o0x1eef>
Did you install the gems as root ? Or as an unprivileged user ? If done as root then they should be available to all users, 'unit' included
<o0x1eef>
If rbenv or chruby or similar is being used, then you might need to adjust the approach. Those tools usually isolate installs to one user.
<bovis>
Gems are installed as my user 'bovis'. No use of version control. Ruby is installed from the Alpine repo.
<bovis>
Changing the chown unit:unit to the config.ru doesn't change the result.
<adam12>
bovis: You have a Gemfile in that folder I'm assuming?
<adam12>
(Gemfile and Gemfile.lock?)
<o0x1eef>
The problem is that you have installed gems as boris, and those gems are isolated to that user. That's my guess with everything you said so far.
<adam12>
bovis: Can you share your nginx config?
<adam12>
Oh. Unless the only thing you have is a `config.ru`?
<adam12>
(the example at the top of that Unit docs page)
<bovis>
adam12: No Gemfile for my attempts with https://unit.nginx.org/howto/samples/#ruby. I'm trying to narrow down a wider use of Rails where Unit won't upload a config, and I'm receiving the broader '/usr/bin/ruby No file or directory' even though it's definitely installed.
<adam12>
bovis: How'd you install nginx unit? and what distro?
<bovis>
adam12: Alpine linux. Nginx Unit and the Ruby module are both from the repo.
kludger has joined #ruby
<adam12>
So you've installed unit-ruby?
<bovis>
adam12: Yes
kludger has quit [Ping timeout: 252 seconds]
<bovis>
o0x1eef: If it's a user isolation issue, then I guess I'm unsure about how to give Unit access to my gems.
<bovis>
Looks like Unit looks to that path... which would be wrong.
kludger has joined #ruby
<o0x1eef>
You should investigate where 'boris' installs their gems. My guess is that their installation is unique to them. /usr/lib would require root access to write - at leaat typically.
<o0x1eef>
And solving that problem is a challenge in itself. Ideally you would not install gems as root. Bundler might help.
<bovis>
Later, though. Thanks for now. I appreciate the help.
<o0x1eef>
No worries
bovis has quit [Quit: leaving]
<isene>
So, rcurses is now tested and fully functional as far as I can see. I just may start porting my curses programs to this new library (astropanel, telescope, rtfm, imdb, etc.). Editing text in panes is now much smoother than with ruby-ncurses and the code is a lot less. Any and all suggestions for functionality or improvements are highly welcome. (https://github.com/isene/rcurses)
<isene>
Sampersand: How does Ruby get Ctrl-Alt-Shift-PgUp as escape code? Is there a complete list of codes somewhere? This could simplify rcurses a lot...
<Sampersand>
is that even soemthign ruby _Can_ capture?
<isene>
Well, the problem is it's multi-character, hence my Rinput part of rcurses. But if I could somehow simplify that, it would be nice...
mange has joined #ruby
<Sampersand>
not sure, i only jsut started learning about escape sequences actually
donofrio__ has quit [Read error: Connection reset by peer]
donofrio__ has joined #ruby
kludger has quit [Read error: Connection reset by peer]
kludger has joined #ruby
<johnjaye>
hmm. how do i require dl?
<johnjaye>
was it removed in ruby 2.x maybe?
<johnjaye>
i'm trying to call a windll on this machine
<johnjaye>
ok i got it working somehow. i had to type Fiddle::Function and Fiddle::TYPE_VOID
<johnjaye>
why do i need that if I required fiddle already?
<johnjaye>
frankly i'm amazed this works at all. all the examples are for linux and the *sole* example for windows is here and not really commented well
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
<o0x1eef>
I used Fiddle a little bit for interfacing with capsicum(4) and it was a very positive experience. I enjoyed it more than writing C extensions, but it's not always easier. Depends. Still definitely worth exploring imo
desnudopenguino has quit [Read error: Connection reset by peer]