<michigan>
It goes to ftp.usa.openbsd.org, finds the highest release number, chdirs to that directory, downloads ports.tar.gz, extracts it, and lists all the categories and then all the ports
crankharder has joined #ruby
<michigan>
(I'm trying to give something back to the openbsd community by indexing all their ports inside a Rails app)
jl- has joined #ruby
crankharder has quit [Ping timeout: 276 seconds]
<constxd>
nice :)
jl- has quit [Ping timeout: 276 seconds]
crankharder has joined #ruby
crankharder has quit [Ping timeout: 244 seconds]
dionysus69 has quit [Ping timeout: 240 seconds]
crankharder has joined #ruby
crankharder has quit [Ping timeout: 276 seconds]
markong has quit [Ping timeout: 246 seconds]
jpn has joined #ruby
<michigan>
Can anyone tell why `File.read` at line 21 at https://gist.github.com/basicfeatures/4eb1f646730fc187d059d9da91385b82 gives me `Errno::ENOENT (No such file or directory @ rb_sysopen - ports/archivers/arc/pkg/DESCR)`, whereas if I run `File.read` outside of the loop, it seems to work fine?
jpn has quit [Ping timeout: 276 seconds]
stylo has joined #ruby
crankharder has joined #ruby
<michigan>
Nevermind, I got this 👍
crankharder has quit [Ping timeout: 244 seconds]
<michigan>
No I don't
<michigan>
Can anybody tell why `File.read` won't seem to work inside this loop? https://clbin.com/xrimW
<michigan>
Could it be some sorta conflict with Pathname maybe?
<michigan>
sec
<weaksauce>
i don't think the cwd changes inside a loop like that ... that would be madness
crankharder has joined #ruby
<weaksauce>
the fact that you aren't getting any output is concerning
<weaksauce>
oh wait
<weaksauce>
yeah first doesn't take a block
<michigan>
`p ports` works as expected: `["arc", "blosc", "brotli" ...`
<michigan>
I'm getting the same for `each` too though
<weaksauce>
either way first doesn't take a block
<weaksauce>
so that code will never be run
<michigan>
No wait actually, when I change first to each, I get: Errno::ENOENT (No such file or directory @ rb_sysopen - ports/archivers/bzip/pkg/DESCR)
<michigan>
running `puts file = File.read("ports/archivers/arc/pkg/DESCR")` outside of the loop works as expected
<michigan>
im sure
<weaksauce>
bzip is different than arc
<weaksauce>
so do the thing on that
<michigan>
my bad, but yeah its the same
<michigan>
:/
jhass has joined #ruby
<weaksauce>
there's nothing about each loops that make it any different though
<weaksauce>
so the fact that it's failing on bzip leads me to believe that doesn't exist
<michigan>
its the same with arc, i was just messing up the copy/paste..
<michigan>
could you try running the entire thing? ports.tar.gz is a bit big though so it might take a while to unzip it
crankharder has quit [Ping timeout: 244 seconds]
Linux_Kerio has quit [Ping timeout: 240 seconds]
<weaksauce>
michigan gem::package new doesn't work for me
<weaksauce>
oh well i'll open it manually
<michigan>
:D maybe its not the cleanest way to extract a tgz.. anyway works here after i `require "rubygems/package"`
swaggboi has quit [Read error: Connection timed out]
<weaksauce>
yeah it doesn't always have that file
<weaksauce>
michigan you are going to have to figure out a better way to get the files you want since that doesn't seem standard
<weaksauce>
arc has it
<michigan>
basically im trying to make an interactive and searchable index of OpenBSD's ports collection in Rails, downloading and unzipping the .tgz is the only way I can think of
crankharder has joined #ruby
<michigan>
Its gotta be an absolute/relative path thing i bet, due to Pathname
crankharder has quit [Ping timeout: 244 seconds]
jl- has joined #ruby
jpn has joined #ruby
Ziyan has quit [Ping timeout: 244 seconds]
Ziyan has joined #ruby
swaggboi has joined #ruby
<weaksauce>
i'm telling you michigan if you look around not all of the directories have DESC
<weaksauce>
you will have to have a different approach to populating that list
<michigan>
weaksauce!!! :D
<weaksauce>
you can do recursive globs but even then i'm not sure
<michigan>
removing all other folders except `ports/archivers/arc` makes the whole script work :D
crankharder has joined #ruby
<michigan>
different approach in what way?
<michigan>
also if there's anything else you see that could be improved do let me know. that thing is just a rough copy/paste experiment from old stackoverflow posts..
<weaksauce>
i guess assuming that the file exists in the first place?
<weaksauce>
you can just guard on that and have a pared down list of things
<weaksauce>
or do a recursive glob
<weaksauce>
and only match on things that end with DESCR
constxd has quit [Ping timeout: 264 seconds]
crankharder has quit [Ping timeout: 244 seconds]
crankharder has joined #ruby
swaggboi has quit [Read error: Connection timed out]
crankharder has quit [Ping timeout: 240 seconds]
crankharder has joined #ruby
swaggboi has joined #ruby
<michigan>
weaksauce: Did as you said... I think we have it working now!
<weaksauce>
nice michigan
crankharder has quit [Ping timeout: 244 seconds]
desnudopenguino has quit [Ping timeout: 264 seconds]
<ox1eef>
mooff: lately i used to avoid #each as a workaround to some other issue, and looks like under the hood it just uses #each
<ox1eef>
btw using flock got me thinking of kodak black music. arguably much worse.
<havenwood>
mooff: like ox1eef said, even if you don't want to use #each your `for` is going to turn into: [:send, {:mid=>:each, :flag=>0, :orig_argc=>0}, ...
<havenwood>
mooff: And it's not as good with encapsulation.
<havenwood>
#each is correct
John_Ivan has quit [Remote host closed the connection]
<havenwood>
You don't often see that ^ semicolon trick with block args, but it's handy to know it exists.
<leah2>
huh
<leah2>
since 1.9 o.o
llua has quit [Ping timeout: 240 seconds]
ur5us has joined #ruby
llua has joined #ruby
ur5us has quit [Ping timeout: 264 seconds]
darkdrgn2k has joined #ruby
<darkdrgn2k>
hi all im getting " OpenIDConnect::Discovery::DiscoveryFailed (SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate)):
<darkdrgn2k>
"
<darkdrgn2k>
but curl into the domain in question works fine
<darkdrgn2k>
does ruby use a differnt cert/ca stack?
<adam12>
darkdrgn2k: It can.
<adam12>
darkdrgn2k: How'd you install Ruby?
<darkdrgn2k>
its part of a docker
<darkdrgn2k>
(alpine linux but kinda old)
<adam12>
Is it one of the official ruby images?
<adam12>
Who's ca on the cert for that site?
<darkdrgn2k>
FROM ruby:2.7.2-alpine AS base
<darkdrgn2k>
and its trying to access a Lets Encrypt cert
<adam12>
Lets Encrypt had to change their root cert a while back. I bet its' related.
<darkdrgn2k>
yeh
<darkdrgn2k>
well one of their root expired and they switched the a differnt one
<darkdrgn2k>
but the expired root cause tones of problems
<darkdrgn2k>
but, it does work from curl which is wierd
<adam12>
curl from the host tho? or inside the container.
<darkdrgn2k>
i tried using SSL_CERT_DIR/SSL_CERT_FILE to set to the OS directory but that didnt look