Sina has quit [Quit: Connection closed for inactivity]
victorgama has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
victorgama has joined #ruby
<leftylink>
hmm
<leftylink>
it wouldn't be sensible to assign and use the just-assigned thing in a modifier-if, would it... it would be legal code, but it'd always be nil because the assignment hasn't happened yet
MinSrodowiska has quit [Quit: Bye Bye]
<leftylink>
&>> puts "hello #{a = 5}" if a # won't say hello, a is nil
<alayde>
I have a question in regards to a bit of a learning exercise I'm undergoing- I have a 1000 line file that I'm attempting to parse using four forks. Fork number one takes lines 1-250, fork two takes 251-500, etc. To avoid having to load the whole file into memory I'm using File.foreach, and giving each fork its assigned number of lines to read/process. Unfortunately this seems to result in blocking IO as only
<alayde>
one fork can read the file at a time. Is there perhaps a flag I can pass to foreach to allow for non-blocking reads? I've been peruising the IO docs but can't seem to put the pieces together and this is something a bit newer for me to try and tackle in Ruby.
<phaul>
personally I would open the file 4 times
<phaul>
4 file descriptors, nothing to do with each other
<phaul>
the next problematic bit is knowing where the second,third or fourth thread has to start reading.. You can seek to a byte position. But if the 1000 lines don't infer that information (ie different line sizes) then you don't know in thread 2 where to start from
<havenwood>
alayde: lines are variable length?
<alayde>
havenwood: They are, yeah.
<phaul>
yeah probably the best you can do is count down 250 lines in thread #2, as you don't know the byte position...
xGrind has quit [Quit: Saindo]
<alayde>
phaul: that's kind of where I ended up last night
<phaul>
right. but if you open 4 file descriptors, you still can make it work, you won#t ate least get the "one fork can read at a time" issue
akemhp_ has joined #ruby
<phaul>
won't get at least*
<alayde>
phaul: Alright, perfect. I'll head down that path then, which is most helpful. Thank you
<phaul>
yw
<alayde>
Ideally I wouldn't want to introduce this kind of complexity when parsing a file, but ya know- sometimes you get a crazy idea in your head and have to try it haha
<alayde>
havenwood: Okay, cool. I'll check into that too, see if it can help get me what I'm looking for
<alayde>
thank you!
<havenwood>
alayde: dunno the boundaries of your experiment, but this reminds me of ioquatix's awesome Fiber-backed async-io lib. You can pair that with Falcon webserver to. have your IO be non-blocking: https://github.com/socketry/async-io
<alayde>
Oh nice, I'll have to add that to my list of things to check out too. Admittedly concurrent/parallel programming is not my strong suit so this is all one big learning experience. I'm starting off small, so atm my boundaries are just focus on this 1000 line file
mossplix has quit [Remote host closed the connection]
hiroaki has quit [Ping timeout: 252 seconds]
<alayde>
havenwood, phaul: thanks again for your help, I'll wander back in if I have any other questions. Take care
alayde has left #ruby ["WeeChat 2.3"]
<phaul>
happy days...
<phaul>
havenwood: did you see @ offtopic I signed up for my first rails girls?
<havenwood>
phaul: woot!
<phaul>
yeah. how's the little one coming along ? I hope everything is in order? when's due?
Ai9zO5AP has quit [Ping timeout: 240 seconds]
BH23 has joined #ruby
AJA4350 has quit [Ping timeout: 276 seconds]
<phaul>
btw; sorry if I was too personal...
ur5us has joined #ruby
<havenwood>
phaul: All is well afaik! March 12.
<phaul>
cool then! exciting times :D
Intelo has quit [Remote host closed the connection]
Ai9zO5AP has joined #ruby
ur5us has quit [Ping timeout: 265 seconds]
mikecmpbll has joined #ruby
Ai9zO5AP has quit [Read error: Connection reset by peer]
Ai9zO5AP has joined #ruby
hiroaki has joined #ruby
Ai9zO5AP has quit [Read error: Connection reset by peer]
MinSrodowiska has joined #ruby
hiroaki has quit [Read error: Connection reset by peer]
hiroaki has joined #ruby
mossplix has joined #ruby
salinasc has quit [Ping timeout: 246 seconds]
Ai9zO5AP has joined #ruby
queip_ has joined #ruby
queip has quit [Ping timeout: 265 seconds]
queip_ is now known as queip
foo66 has joined #ruby
<foo66>
Hello....I need help understanding why bundler prebuilts module in my root file
dkmueller has joined #ruby
<phaul>
foo66: we are all ears. tell us the details
<foo66>
Anyone familiar with bundler and Ruby executables?
<havenwood>
foo66: Ask away!
<phaul>
probably. or maybe not. just lay out what you are faceing and if anybody can help "they will likely do so"
<foo66>
Getting used to freenode ...sorry for my time delay
dkmueller has quit [Quit: WeeChat 2.3]
dkmueller has joined #ruby
<foo66>
Also regarding terminal commands:. What is purpose behind Ruby -Ilib
akem__ has joined #ruby
cyclonis_ has quit [Ping timeout: 246 seconds]
<phaul>
-Ilib tells ruby to look for files in the said directory when someone does require. It becomes partof the load path which is accessable by $:
<phaul>
&>> $:
<rubydoc>
# => ["/usr/lib/ruby/site_ruby/2.6.0", "/usr/lib/ruby/site_ruby/2.6.0/x86_64-linux",... check link for more (https://carc.in/#/r/7wcx)
akemhp_ has quit [Ping timeout: 240 seconds]
cyclonis has joined #ruby
<foo66>
Phaul, (still noob here) it seems to be the same as say: ruby foo.rb
Intelo has joined #ruby
<havenwood>
foo66: It's just like that, but with the -I flag, which is: Used to tell Ruby where to load the library scripts. Directory path will be added to the load-path variable ($:).
<havenwood>
foo66: $: is the same as $LOAD_PATH.
<havenwood>
(Aliases.)
<havenwood>
foo66: See `ruby -h` or `man ruby` for info on -I and other option flags.
dkmueller has quit [Quit: WeeChat 2.3]
akemhp has joined #ruby
<foo66>
Ok... I wanted to make sure it didn't have special relevance for executables such as in /foo I am taught to run ruby -Ilib ./bin/foo
<havenwood>
foo66: $LOAD_PATH is where #require will look to find code. By adding -I/path/to/dir you make a specific directory available for loading code.
dkmueller has joined #ruby
<foo66>
Ok got it thanks
suukim has quit [Quit: Konversation terminated!]
akem__ has quit [Ping timeout: 240 seconds]
akemhp has quit [Read error: Connection reset by peer]
akemhp_ has joined #ruby
<havenwood>
foo66: As to your SO question, lib/foo.rb is a RubyGems convention. The file structure should mirror your namespace structure.
<havenwood>
foo66: Then you can run the executable with just: bin/foo
<havenwood>
foo66: Once you install the gem, you can use just: foo
dkmueller has joined #ruby
akemhp has quit [Ping timeout: 268 seconds]
<havenwood>
foo66: Does that make sense?
<foo66>
I have to think about this to understand it lol my apologies
<havenwood>
foo66: Yeah, PRs are tough but just persevere! I often feel really silly after the first PR review.
<foo66>
Conceptually it makes sense.
lucasb has quit [Quit: Connection closed for inactivity]
BH23 has quit [Remote host closed the connection]
<havenwood>
foo66: I mistyped above >.>, should have said: Then you can run the executable with just: exe/foo
<foo66>
My hiccup is how do I treat exe in my gemspec. I pretty much ignore the ext in my gem file
<foo66>
What about if I need to share it with others who maybe run windows or don't have ruby installed
<havenwood>
foo66: You need Ruby to run Ruby code, typically. Ruby is preinstalled on macOS and many Linux distros but you'd need to ship Ruby with your code for Windows.
<foo66>
Chmod +x is shortform for chmod a+x correct?
<havenwood>
foo66: yup
<havenwood>
foo66: There are a few solutions for shipping Ruby with your code or packing it into an executable.
<foo66>
I always figured exe compiled to machine code
<foo66>
Chmod is fantastic...but takes a while to really get a feel for it! I am still working on the number equivalent of chmod
<foo66>
Which is easier to interact with packer or traveling? I've heard packer is difficult to wrangle down
<havenwood>
foo66: packer is fancier in that you get a single executable. traveling ruby is less magic.
mossplix has quit [Remote host closed the connection]
<havenwood>
foo66: Or there's mruby.
<foo66>
To run exe/foo I do not have to be in /foo
<havenwood>
foo66: MRuby is a subset of Ruby but can be embedded in C and compiled to an executable.
<havenwood>
foo66: JRuby can also ship a JAR.
<havenwood>
foo66: yes
<havenwood>
foo66: Or add exe to your PATH.
Jonopoly has joined #ruby
<havenwood>
foo66: When you build the gem, RubyGems will make it available in the RubyGems bin/ dir - which is presumably in your PATH.
<havenwood>
foo66: In development, from the gem root directory, you can just: exe/foo
<havenwood>
foo66: Once you install the gem, just: foo
<foo66>
Gem root is always lib/foo.rb correct?
<havenwood>
foo66: Yes, that's the convention for a regular gem. If it's a plugin it might be: lib/other_gem/foo.rb
<havenwood>
Which would be a gem named: other_gem-foo
<foo66>
But shouldn't it then be ../bin/foo?
<havenwood>
foo66: With a Bundler scaffolded gem, you'll not use the bin/ dir at all.
<foo66>
Also when u say "When you build the gem, RubyGems will make it available in the RubyGems bin/ dir - " what is IT specifically
<havenwood>
foo66: It's a helper dir in Bundler's mind. Neither library code nor executables go in bin/ directory.
henninb has joined #ruby
<havenwood>
foo66: IT is the executable files.
<havenwood>
foo66: How familiar are you with PATH generally?
henninb has quit [Client Quit]
<foo66>
That's in exe as far as bundler is concerned
<havenwood>
foo66: yes
conta has joined #ruby
<havenwood>
foo66: Bundler changes the default from bin/ to exe/ for the executable directory.
<foo66>
I get the occasional hiccups between require_relative and require...but I'm ok I think with PATH
<foo66>
I can navigate Linux paths fine...struggle Abit with gems due to conventions
mossplix has joined #ruby
MinSrodowiska has joined #ruby
<havenwood>
foo66: Let me give some context unrelated to Ruby. When you run a command from terminal on a posix system, it'll see if there's an alias, a function, shell built-in then it'll look at the $PATH environment variable. If none are found, you'll get something like: command not found
<foo66>
Yes I read that I. The docs....don't understand the thinking there...makes it harder for noobs
<havenwood>
foo66: PATH is a colon-delimited list of directories to search for the commannd.
henninb has joined #ruby
<havenwood>
foo66: See: printenv PATH
<havenwood>
foo66: Or: echo $PATH
<foo66>
I have successfully edited my $PATH before👏
<havenwood>
foo66: It'll check each directory, in order. So if you type `foo` it'll try first/directory/foo and so on for every directory in PATH.
<havenwood>
foo66: Check your PATH and see how the RubyGems bin/ directory is there.
<havenwood>
foo66: When you install this gem, the files in your exe/ directory will appear in that folder.
<havenwood>
foo66: echo $(gem env gemdir)/bin
<havenwood>
foo66: echo $PATH
<havenwood>
foo66: So, your gemspec is saying to violate the RubyGems convention of bin/ and instead use exe/ for where to look for executables to add to the RubyGems bin/ directory, which is presumably in your PATH.
<havenwood>
foo66: I can say more but will stop if that ^ makes sense.
<foo66>
My gems are is var/lib/gems/2.3.0/gem which I added to my PATH
<havenwood>
foo66: Take a look at this directory: echo $(gem env gemdir)/bin
<havenwood>
foo66: That's ^ where gem executable shims live.
<havenwood>
That's the directory that should be in your PATH.
mossplix has quit [Read error: Connection reset by peer]
<havenwood>
You install your gem, a shim to its executable gets put in that directory. You type `foo` and it finds it there.
InfinityFye has joined #ruby
<foo66>
Sorry but spec.bindir = "exe" is necessary correct?
greengriminal has joined #ruby
<foo66>
In my gemspec that is
ur5us has joined #ruby
<foo66>
How do find gem env gemdir? Specifically.
<havenwood>
foo66: type: gem env gemdir
<havenwood>
foo66: (from the command line)
<havenwood>
foo66: see: gem env -h
<havenwood>
foo66: `spec.bindir = "exe"` was generated by Bundler. It changes the default bindir from "bin" to "exe" and nothing else.
<havenwood>
It was "bin" and that line makes it "exe" which is what Bundler intended to do because they wanted bin/ for a development purpose. I don't agree with that choice, and think Bundler should default to RubyGems' choice, but not a fight I care to wage with a PR.
mikecmpbll has quit [Quit: inabit. zz.]
<havenwood>
I talked about it with rubygems and bundler maintainers at rubyconf. I don't like the idea of adding `./bin` to PATH at all, personally, so I don't care for the Bundler pattern.
<havenwood>
A relative path in PATH makes me nervous. I don't like it.
* havenwood
grumbles
<foo66>
Of course...but I'm reconfirming . Kudos for getting invited to rubyconf. Wish that'd be me lol
InfinityFye has quit [Quit: Leaving]
<havenwood>
I've been nine years in a row but haven't been invited once!
greengriminal has quit [Quit: This computer has gone to sleep]
bitwinery has joined #ruby
bitwinery has quit [Remote host closed the connection]
cd has joined #ruby
bitwinery has joined #ruby
bhaubert has quit [Quit: bhaubert]
matheusmoreira has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.6]
schne1der has quit [Ping timeout: 240 seconds]
cyclonis_ has joined #ruby
shirak has quit [Ping timeout: 250 seconds]
Fernando-Basso has joined #ruby
cyclonis has quit [Ping timeout: 252 seconds]
chalkmonster has joined #ruby
dionysus69 has quit [Quit: dionysus69]
dionysus69 has joined #ruby
<foo66>
@havenwood I should ask how many mirrors does rubygems have?
AJA4351 has joined #ruby
<havenwood>
foo66: Many! I don't know.
wymillerlinux has quit [Remote host closed the connection]
<havenwood>
foo66: You can run your own easily.
AJA4350 has quit [Ping timeout: 250 seconds]
AJA4351 is now known as AJA4350
<foo66>
Actually...that would be amazing
dionysus69 has quit [Ping timeout: 245 seconds]
<foo66>
It does make gaging real downloads very hard tho
Technodrome has quit [Ping timeout: 240 seconds]
wymillerlinux has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
bambanx has joined #ruby
ellcs has quit [Ping timeout: 264 seconds]
<foo66>
@havenwood sorry just realized something...with my ruby executable. If I mkdir exe && touch foo. Why am I still going through bin/foo instead of exe/foo. Unless /bin corresponds to my #! Not my gem tree
<havenwood>
foo66: exe/foo only, no bin/
Nicmavr has joined #ruby
<foo66>
That makes sense ... And I don't really need #bindir it's set to exe by default
kx has quit [Ping timeout: 240 seconds]
<havenwood>
foo66: Or delete contents of bin/ that was scaffolded, delete the bindir line from your gemspec, and use bin/ for executables.
<havenwood>
foo66: Your call.
<foo66>
Meant #bindir="exe" obviously
<havenwood>
yup
<foo66>
Or I can rn bin/ to exe/
drincruz has joined #ruby
johnny56 has joined #ruby
<foo66>
My understanding is is bundler defaults to exe ...so if no#bindir line, then bundler assumes exe on its own
johnny56_ has quit [Ping timeout: 240 seconds]
chalkmonster has quit [Quit: WeeChat 2.6]
<havenwood>
foo66: It's a RubyGems thing. If you delete the line, it defaults to "bin".
mossplix has quit [Remote host closed the connection]
<havenwood>
foo66: Bundler generated the gemspec file, and with that line overwrote the default.
<havenwood>
foo66: If you delete the line, the behavior reverts to default, "bin" #bindir.
<havenwood>
foo66: Give it a try.
A124 has joined #ruby
A124 has quit [Client Quit]
akem__ has joined #ruby
<foo66>
I `mv bin/ exe/` Then `ruby exe/foo` loaderror
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
akemhp_ has quit [Ping timeout: 240 seconds]
cyclonis_ has quit [Ping timeout: 268 seconds]
Esa_ has quit [Ping timeout: 276 seconds]
<havenwood>
foo66: Push your changes to GitHub so we can see them?
<havenwood>
foo66: It'd not be `ruby exe/foo`, just `exe/foo`.
<havenwood>
foo66: From the gem root directory, type: exe/foo
cyclonis has joined #ruby
<foo66>
Ok give me a sex
<foo66>
Sec***
sagax has quit [Read error: Connection reset by peer]
chalkmonster has joined #ruby
hutch1 has quit [Remote host closed the connection]
<foo66>
Bash: #! : Event not found
hutch1 has joined #ruby
chalkmonster has quit [Client Quit]
<foo66>
I fixed the bash error ...🤞
shirak has joined #ruby
ellcs has joined #ruby
jantje has quit [Remote host closed the connection]
henninb has quit [Quit: leaving]
TomyLobo has quit [Read error: Connection reset by peer]
dkmueller has quit [Quit: WeeChat 2.3]
dkmueller has joined #ruby
ellcs has quit [Ping timeout: 264 seconds]
shirak has quit [Ping timeout: 265 seconds]
chalkmonster has joined #ruby
chalkmonster has quit [Client Quit]
TheMoonMaster has quit [Quit: Later!]
foo66 has quit [Remote host closed the connection]
TheMoonMaster has joined #ruby
dbugger has quit [Quit: Leaving]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
salinasc has joined #ruby
davor_ has joined #ruby
davor has quit [Ping timeout: 268 seconds]
davor_ is now known as davor
code_zombie has quit [Quit: Leaving]
hutch1 has quit [Ping timeout: 245 seconds]
hutch1 has joined #ruby
drincruz has quit [Ping timeout: 276 seconds]
clemens3 has quit [Quit: WeeChat 1.6]
hiroaki has quit [Ping timeout: 276 seconds]
dkmueller has quit [Quit: WeeChat 2.3]
Spitfire has quit [Ping timeout: 240 seconds]
xpitr has quit [Ping timeout: 246 seconds]
MzrE has joined #ruby
Spitfire has joined #ruby
Spitfire has joined #ruby
Spitfire has quit [Changing host]
xpitr has joined #ruby
<havenwood>
foo, ah, they left
cyclonis has quit [Ping timeout: 268 seconds]
cyclonis_ has joined #ruby
MinSrodowiska has quit [Quit: Bye Bye]
tpanarch1st has joined #ruby
Jonopoly has quit [Quit: WeeChat 2.5]
greengriminal has joined #ruby
greengriminal has quit [Client Quit]
greengriminal has joined #ruby
ElFerna has joined #ruby
teardown has quit [Ping timeout: 268 seconds]
Fernando-Basso has quit [Ping timeout: 265 seconds]
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #ruby
greengriminal has quit [Quit: This computer has gone to sleep]