<havenwood>
axsuul: ^ is that along the lines of what you were wanting? If not, could you give another example?
<axsuul>
Ah genius :) yep, that's it! thanks so much
duderonomy has joined #ruby
<havenwood>
axsuul: No prob - you might consider #then too, if you ever want the return value of the block.
coniptor has quit [Ping timeout: 260 seconds]
blackmesa1 has joined #ruby
<havenwood>
axsuul: It'd work the same as the #tap ones above.
<axsuul>
Interesting, never knew about #then... wow
<havenwood>
Actually I guess #then doesn't work for the first example, without an explicit `self.then`. ¯\_(ツ)_/¯
dfucci has joined #ruby
coniptor has joined #ruby
rzjian has joined #ruby
dfucci has quit [Ping timeout: 246 seconds]
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
venmx has joined #ruby
world has joined #ruby
dfucci has joined #ruby
venmx has quit [Ping timeout: 256 seconds]
dfucci has quit [Ping timeout: 240 seconds]
world has left #ruby [#ruby]
dfucci has joined #ruby
<dorian>
trying to sort out a sensible solution for a cli tool with subcommands where one of the subcommands is a shell with access to the other subcommands and completion/history/yada
<dorian>
thor looks nicer than commander/highline but its shell doesn't look as fleshed out
nofxx__ has joined #ruby
dfucci has quit [Ping timeout: 265 seconds]
nofxx_ has quit [Ping timeout: 246 seconds]
venmx has joined #ruby
venmx has quit [Ping timeout: 240 seconds]
SeepingN has joined #ruby
jl4 has quit [Ping timeout: 246 seconds]
dfucci has joined #ruby
SeepingN has quit [Ping timeout: 256 seconds]
dfucci has quit [Ping timeout: 264 seconds]
SeepingN has joined #ruby
SeepingN has quit [Ping timeout: 265 seconds]
jl4 has joined #ruby
SeepingN has joined #ruby
coniptor has quit [Ping timeout: 240 seconds]
dfucci has joined #ruby
schaerli has joined #ruby
coniptor has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FrankyCyborg>
hmm, i'm preparing deployable packages and now have hit the ruby stuff and wonder, if rake has something like a DESTDIR approach, which I use for the other software - if not, how would I do this with ruby modules / gems? Is it just copying files to their correct location? right now, it's modules for ruby 3.0, but older ruby versions might follow later, so that users have a choice.
pwnd_sfw has quit [Ping timeout: 256 seconds]
Rudd0 has quit [Ping timeout: 264 seconds]
<FrankyCyborg>
ah, it seems 'gem' does the trick, not 'rake' ..
<FrankyCyborg>
gem install --local --force --install-dir in particular
roshanavand has joined #ruby
pwnd_sfw has joined #ruby
coniptor has quit [Ping timeout: 272 seconds]
fercell has joined #ruby
coniptor has joined #ruby
roshanavand has quit [Ping timeout: 264 seconds]
TCZ has quit [Remote host closed the connection]
venmx has quit [Ping timeout: 246 seconds]
pwnd_sfw6 has joined #ruby
pwnd_sfw has quit [Ping timeout: 264 seconds]
pwnd_sfw6 is now known as pwnd_sfw
wnd has quit [Quit: Disconnecting from stoned server.]
wnd has joined #ruby
viporli has joined #ruby
viporli has quit [Read error: Connection reset by peer]
ZeroFux has quit [Ping timeout: 265 seconds]
harlin has quit [Quit: Leaving]
prion has joined #ruby
al2o3-cr-null has quit [Quit: WeeChat 3.0]
venmx has joined #ruby
al2o3-cr has joined #ruby
fanta1 has joined #ruby
pjdavis has joined #ruby
totoro2021 has joined #ruby
shokohsc has joined #ruby
iNs has quit [Ping timeout: 240 seconds]
iNs has joined #ruby
fanta1 has quit [Quit: fanta1]
thinkpad has quit [Ping timeout: 260 seconds]
TCZ has joined #ruby
thinkpad has joined #ruby
adu has joined #ruby
adu has quit [Quit: adu]
factormystic has joined #ruby
coniptor has quit [Ping timeout: 265 seconds]
cloud69 has quit [Quit: Connection closed for inactivity]
coniptor has joined #ruby
thinkpad has quit [Ping timeout: 264 seconds]
thinkpad has joined #ruby
TorpedoSkyline has joined #ruby
moldorcoder7 has quit [Quit: %bye mirc%]
noctux has quit [Read error: Connection reset by peer]
noctux has joined #ruby
Technodrome has joined #ruby
moldorcoder7 has joined #ruby
moldorcoder7 has quit [Quit: %bye mirc%]
akem has joined #ruby
moldorcoder7 has joined #ruby
blackmesa1 has quit [Ping timeout: 246 seconds]
Rudd0 has joined #ruby
thinkpad has quit [Ping timeout: 256 seconds]
thinkpad has joined #ruby
cthulchu_ has joined #ruby
dfucci has joined #ruby
jl4 has quit [Ping timeout: 256 seconds]
dfucci_ has quit [Ping timeout: 264 seconds]
SeepingN has quit [Read error: Connection reset by peer]
SeepingN has joined #ruby
kristian_on_linu has joined #ruby
thinkpad has quit [Ping timeout: 240 seconds]
yokel has quit [Ping timeout: 246 seconds]
yokel has joined #ruby
schne1der has quit [Quit: schne1der]
thinkpad has joined #ruby
pjdavis has quit [Remote host closed the connection]
coniptor has quit [Ping timeout: 256 seconds]
coniptor has joined #ruby
kristian_on_linu has quit [Remote host closed the connection]
kristian_on_linu has joined #ruby
blackmesa1 has joined #ruby
kristian_on_linu has quit [Remote host closed the connection]
coniptor has quit [Ping timeout: 256 seconds]
blackmesa has joined #ruby
blackmesa1 has quit [Ping timeout: 260 seconds]
TCZ has quit [Remote host closed the connection]
thinkpad has quit [Ping timeout: 246 seconds]
venmx has quit [Ping timeout: 246 seconds]
coniptor has joined #ruby
thinkpad has joined #ruby
jl4 has joined #ruby
venmx has joined #ruby
gix has joined #ruby
vondruch has quit [Read error: Connection reset by peer]
BTRE has quit [Ping timeout: 240 seconds]
BTRE has joined #ruby
jl4 has quit [Ping timeout: 264 seconds]
alextee has quit [Ping timeout: 256 seconds]
TomyLobo has joined #ruby
TomyWork has quit [Quit: Leaving]
Tempesta has quit [Quit: See ya!]
<scriptonaut>
is there a way in ruby to create a file object, gzip it, and send it over ssh/rsync/etc without actually writing the file to the filesystem?
<scriptonaut>
I have a rake task that is going to generate about 1 million json files, that need to be written to another server on the network
alextee has joined #ruby
<scriptonaut>
Instead of actually writing it to the local file system, is there a good way to essentially pipe it through a gzip and scp/ssh?
<CommunistWolf>
sure, you could probably do that with net-ssh
<scriptonaut>
how would I handle the file part, using tempfiles?
<scriptonaut>
I would rather avoid pointless IO that will take up a lot of time
<scriptonaut>
writing the file just to transfer it immediately after
<scriptonaut>
now I just gotta figure out how to compress it
<CommunistWolf>
ruby libraries tend to be quite poor about this kind of thing, but in theory you could stream them without needing to hold the entire document in RAM. might not be an issue if you only have small ones though
<apotheon>
scriptonaut: Do you want it compressed only in transit, or do you want to store compressed data on the receiving end?
<apotheon>
In this case, I'm guessing the files are small, given the description of "about 1 million json files".
alextee has quit [Ping timeout: 246 seconds]
cd has joined #ruby
jwr has joined #ruby
fercell has quit [Quit: WeeChat 3.0]
alextee has joined #ruby
reyfi9e has joined #ruby
<jwr>
Can anybody advise how to get bundler to play nicely with a multistage Docker build? The error message and the steps I'm following / how to reproduce are here: https://pastebin.com/EBP8p8Ls
<adam12>
jwr: If you're looking at the build output, I'd be curious if it said `Installing rake` or just mentioned `Using rake` (or whatever bundler says when it uses a system dep).
thinkpad has quit [Ping timeout: 240 seconds]
<jwr>
adam12: thanks for looking. I can share the whole Gemfile.lock if that's helpful, but rake is indeed in there.
<adam12>
jwr: Hmm. Nothing really stands out. I swore it would of been because of rake being a default gem, but I guess I'm wrong.
jerome___ has quit [Quit: Leaving]
jeromelanteri has quit [Quit: Leaving]
<jwr>
adam12: thanks. I'm expecting that BUNDLE_PATH is the thing that should instruct the run-image to know to look in vendor/bundle. But since that's not working, is there perhaps some other variable or bit of config to tell bundle where these gems are?
<adam12>
jwr: That should of been fine, but bundler does set some things in .bundle. Are you carrying around one with you?
<adam12>
jwr: From `bundle env`, it looks like it might have been set in /usr/local/bundle so presumably you're not, but you never know.
pjdavis has joined #ruby
<jwr>
adam12: in my build-image, I do see a /usr/local/bundle/.bundle/config, the contents of which are only `BUNDLE_PATH: "vendor/bundle"`.
SeepingN has quit [Ping timeout: 272 seconds]
SeepingN_ has joined #ruby
<jwr>
adam12: huh, your comment about /usr/local/bundle seems to have unblocked me. If I stop using --path and BUNDLE_PATH, and instead just copy /usr/local/bundle into my run-image, it seems to work. https://pastebin.com/raw/8GtjVNMz
<adam12>
jwr: LOL. That will do it too. Awesome :)
coniptor has quit [Ping timeout: 264 seconds]
thinkpad has quit [Ping timeout: 240 seconds]
DTZUZU has quit [Read error: Connection reset by peer]
DTZUZU has joined #ruby
thinkpad has joined #ruby
coniptor has joined #ruby
lucasb has joined #ruby
pjdavis_ has joined #ruby
pjdavis has quit [Ping timeout: 240 seconds]
Eiam has joined #ruby
bambanx has joined #ruby
thinkpad has quit [Ping timeout: 246 seconds]
thinkpad has joined #ruby
cloud69 has joined #ruby
jl4 has quit [Ping timeout: 265 seconds]
ua has quit [Ping timeout: 246 seconds]
jpz has quit [Ping timeout: 240 seconds]
jpz has joined #ruby
orbyt_ has joined #ruby
blackmesa has quit [Read error: Connection reset by peer]
teclator has quit [Ping timeout: 246 seconds]
ua has joined #ruby
onkelhotte has joined #ruby
Furai has quit [Quit: WeeChat 3.0]
landakram has joined #ruby
onkelhotte has quit [Quit: WeeChat 3.0]
Furai has joined #ruby
bambanx has quit [Ping timeout: 272 seconds]
ur5us has joined #ruby
thinkpad has quit [Ping timeout: 256 seconds]
thinkpad has joined #ruby
cnsvc has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wald0 has joined #ruby
naftilos76 has joined #ruby
<naftilos76>
Hi, although i have been wring ruby for years i never had to dig deep. So i was wondering if i could make a class object use a custom method like ++ or -- or << . How do i do that? Any links will be appreciated. I couldn't find any links regarding my question.
<baweaver>
Ruby doesn't have ++ or --
SeepingN has joined #ruby
<naftilos76>
yes i know - that is why i am asking
<baweaver>
It does have << which is `def <<(value) ... end`
<baweaver>
You can't define it.
<naftilos76>
ok understood
<baweaver>
You'd have to get to the lexer level to do those ones.
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<naftilos76>
lexer level?
<baweaver>
Standard ops like + - * / % [] << >> | & and such can be
<baweaver>
The literal Ruby parser
<baweaver>
parse.y
SeepingN_ has quit [Ping timeout: 260 seconds]
<naftilos76>
ok i will have a look thanks
<baweaver>
You can also define prefixes. I think they were -@
<baweaver>
I'd probably not burn time on adding those
<baweaver>
+= 1 and -= 1 will be what they tell you to use on the bug tracker
venturimi has joined #ruby
Emmanuel_Chanel has quit [Ping timeout: 264 seconds]
thinkpad has quit [Ping timeout: 246 seconds]
thinkpad has joined #ruby
venmx has quit [Ping timeout: 272 seconds]
<phaul>
there is an other point to this (why one shouldn't go down this rabbit hole), yes, you could define a++ to mean a += 1, which in itself is a weird bolt on feature, but you definately can't define them to be methods even if the ++ was available as method name as Integers are imutable. Same way you can't define class Integer; def succ!; self = self + 1; end; end;
linoge has quit [Remote host closed the connection]
<phaul>
normal operators are just methods, with the added extra of precednece. +=, -=, are exeptions, as they are not "just methods" but language addition for abbreviating a += x to be a = a + x
<naftilos76>
is this supposed to produce random results on ctr? due to racing conditions?
<naftilos76>
i am trying to demonstrate the fact that not using a mutex results in errors but it keeps giving me 0
coniptor has joined #ruby
<phaul>
your thinking I think is correct it should. My worry is that none of the ctr += 1, ctr -= 1 steps are interrupted because they are too small steps, and therefore executed effectively atomically. And then even if ctr has different values during different runs, ultimately it gets 1000000 increases and 1000000 decrases each run. even if the order of increasing/decreasing is different per run
Axy has joined #ruby
Axy has joined #ruby
<phaul>
track what ctr max becomes each run and see if that varies per run
landakram has quit [Remote host closed the connection]
<naftilos76>
seems like it - i have even put the whole thing in a 50.times {} block but it is still 0 after completion
Mia has quit [Read error: Connection reset by peer]
Emmanuel_Chanel has joined #ruby
<phaul>
it would only be non 0 if in the middle of the execution of ctr += 1 it gets interrupted. ie ctr read out of memory, gets interrupted by ctr -= 1 then the +1 uses the stale value when writes it back to ctr. Try using some rand sleep in the threads to demonstatre this maybe
<naftilos76>
ok will do thanks
dfucci has quit [Ping timeout: 240 seconds]
bambanx has joined #ruby
Emmanuel_Chanel has quit [Quit: Leaving]
nickb has quit [Ping timeout: 260 seconds]
kashike has quit [Ping timeout: 260 seconds]
BuildTheRobots has quit [Ping timeout: 260 seconds]
jcp has quit [Ping timeout: 260 seconds]
s_ has quit [Ping timeout: 260 seconds]
ReinH__ has quit [Ping timeout: 260 seconds]
s_ has joined #ruby
nickb has joined #ruby
BuildTheRobots has joined #ruby
kashike has joined #ruby
jcp has joined #ruby
ReinH__ has joined #ruby
cuerbot has joined #ruby
elcuervo has quit [Ping timeout: 256 seconds]
<phaul>
&>> ctr = 0; x = Thread.new { 10.times { a = ctr; sleep rand(0 .. 0.01); ctr = a + 1 ; puts ctr }}; y = Thread.new { 10.times { b = ctr; sleep rand(0 .. 0.01); ctr = b - 1; puts ctr }}; x.join; y.join; puts ctr
<rubydoc>
stderr: playpen: application terminated abnormally with signal 31 (Bad system call) (https://carc.in/#/r/a9hj)
<phaul>
looks fairly random here although still more deterministic than I expected
Emmanuel_Chanel has joined #ruby
dfucci has joined #ruby
<phaul>
from the results I wonder if the blocks make a local copy of the ctr variable and keep working on that rather than the global one. every run either results in +10 or -10
<phaul>
I mean every run
jwr has quit [Remote host closed the connection]
coniptor has quit [Ping timeout: 264 seconds]
<naftilos76>
i still can't get it to produce random results
bambanx has quit [Remote host closed the connection]
dfucci has quit [Ping timeout: 240 seconds]
bambanx has joined #ruby
<phaul>
yeah, I'm starting to wonder if there is more to this in mri internals that I do not understand. There might be optimizations there that make the results more deterministic than one naively assumes
bambanx has quit [Remote host closed the connection]
bambanx has joined #ruby
coniptor has joined #ruby
<phaul>
it would be interesting to try this on non-mri rubies
cthulchu_ has quit [Ping timeout: 260 seconds]
lightstalker has quit [Remote host closed the connection]
dfucci has joined #ruby
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FrankyCyborg>
browsing through rubygems.org is like browsing through a dictionary ...
dfucci has quit [Ping timeout: 272 seconds]
<FrankyCyborg>
seems to have many japanese authors
venmx has joined #ruby
SeepingN has joined #ruby
naftilos76 has quit [Quit: Leaving]
dfucci has joined #ruby
<deimos_>
ai-o
dfucci has quit [Ping timeout: 260 seconds]
pjdavis_ has quit [Remote host closed the connection]
dfucci has joined #ruby
ZeroFux has joined #ruby
akem has quit [Ping timeout: 272 seconds]
mojca has quit [Quit: quitting]
dfucci has quit [Ping timeout: 246 seconds]
mojca has joined #ruby
ruby[bot] has quit [Remote host closed the connection]