<hays_>
i am seeking a useful pattern for ruby. here's the deal. I tend to encode config items in JSON. its pretty easy to load in a json file and then just access the stuff. but its also kinda opaque in the sense that I'm not really validating or documenting the structure of that json in my code. is there a good, concise pattern for something like this?
<havenwood>
hays: Err, is it only file storage you're looking for?
<havenwood>
I may have been hasty...
raulp has quit [Ping timeout: 268 seconds]
<havenwood>
Mmm. Actually reading your question, Protocol Buffers aren't entirely irrelevant. I've looked at json-schema for HTTP interfaces, but not actually adopted it so I'm not sure!
<havenwood>
hays: Are you running into invalid config file issues? Or just looking for best practices?
graphene has quit [Remote host closed the connection]
duckpupp- has joined #ruby
graphene has joined #ruby
duckpuppy has quit [Ping timeout: 244 seconds]
za1b1tsu has joined #ruby
Inline has quit [Quit: Leaving]
Synthead has joined #ruby
<Synthead>
what are your thoughts on foo = lots + of / logic; MyClass.new(foo: foo) vs. MyClass(foo: lots + of / logic) ?
lightstalker has quit [Ping timeout: 256 seconds]
<baweaver>
depends
dellavg has joined #ruby
<baweaver>
mostly on the context.
sauvin has joined #ruby
ryu- has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
Synthead has quit [Remote host closed the connection]
raulp has joined #ruby
<havenwood>
Synth: I'm just glad you're using keyword arguments!
<dminuoso>
havenwood: So that bug yesterday happened when I closed the lid of my macbook *while* running `bundle install` in a docker container.
<dminuoso>
This should not happen. :(
<havenwood>
dminuoso: haha
<baweaver>
ohai dminuoso
<dminuoso>
o/
G has joined #ruby
xt233 has joined #ruby
cadillac_ has quit [Ping timeout: 268 seconds]
<LiftLeft>
what's the best http module?
cadillac_ has joined #ruby
<dminuoso>
What is the best car.
<LiftLeft>
I dunno I'll use em-http-request. It seems pretty active
apeiros has quit [Remote host closed the connection]
<LiftLeft>
I dunno faraday look easier
<LiftLeft>
*looks
<dminuoso>
LiftLeft: What is the best airplane?
Furai has quit [Quit: WeeChat 2.2]
<LiftLeft>
the one easiest to fly
<LiftLeft>
kek
<dminuoso>
LiftLeft: Without knowing what you consider "good", "useful" or actually need, it's hard to say really.
<dminuoso>
The airplane easiest to fly with might not be the best to transport 10 cars with.
<dminuoso>
The airplane easiest to fly with might not be the best to transport 600 people with.
<dminuoso>
The airplaine easiert to fly with might not be the best in a dogfight.
<dminuoso>
Notice a pattern? :)
apeiros has joined #ruby
Furai has joined #ruby
jlhg has joined #ruby
jlhg has left #ruby ["ERC (IRC client for Emacs 25.1.1)"]
Dbugger has joined #ruby
moei has quit [Quit: Leaving...]
apeiros has quit [Remote host closed the connection]
s2013 has joined #ruby
xt233 has quit [Remote host closed the connection]
t0xik has quit [Quit: Connection closed for inactivity]
agent_white has quit [Ping timeout: 272 seconds]
agent_white has joined #ruby
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
[Butch] has joined #ruby
outhicat has quit []
outhicat has joined #ruby
jottr has quit [Ping timeout: 256 seconds]
Zaab1t has quit [Quit: Zaab1t]
Tempesta has joined #ruby
snuz has quit [Quit: WeeChat 2.2]
niexxx has joined #ruby
<niexxx>
hi, is there any way that installing the packages libruby and ruby-dev could cause errors in code that dont cause errors otherwise? this is on both ubuntu and alpine
<niexxx>
these are the errors:
<niexxx>
#<Thread:0x000056434c715648@/var/lib/gems/2.5.0/gems/REDACTED/lib/REDACTED/subprocesses.rb:69 run> terminated with exception (report_on_exception is true):
<niexxx>
/var/lib/gems/2.5.0/gems/REDACTED/lib/REDACTED/subprocesses.rb:70:in `each_line': stream closed in another thread (IOError)
<niexxx>
could it be that installing those shared libraries etc. is causing more errors to be reported?
johnny56 has quit [Ping timeout: 276 seconds]
<niexxx>
this is on ruby 2.5.1p57
outhicat has quit []
dhollin3 is now known as dhollinger
outhicat has joined #ruby
<apeiros>
niexxx: that sounds like a bug in your REDACTED gem
<apeiros>
looks like broken concurrent programming.
<niexxx>
yeah of course, im not worried about the bug, im pretty sure i know what that is
<apeiros>
ok. in that case, just the answer to your question: no
<niexxx>
the issue is that exception (or at least those messages) dont occur on osx, and it doesnt occur on alpine until I install the ruby-dev package, and it doesnt occur on ubuntu until I install ruby-dev and libruby
<niexxx>
very odd
jottr has joined #ruby
<apeiros>
most concurrency issues are not deterministic.
<niexxx>
ahhhh
<niexxx>
good point. i mean ive run this code thousands of times and never seen it, and now this message appears 100% of the time in the aforementioned conditons.
<apeiros>
same ruby versions? asking since the more likely reason is a change in ruby's thread scheduler, and that would (afaik) only change with the ruby version.
<apeiros>
of course it can also just be completely random.
<niexxx>
however, this error is occuring right before the process exits, I wonder if those libraries cause quite slightly different timings leading to those error messages making it to stdout before the process exits
ferhaty has quit [Quit: ferhaty]
<niexxx>
ill try changing the code to wait before it dies or something
mikecmpb_ has joined #ruby
mikecmpbll has quit [Ping timeout: 240 seconds]
agent_white has quit [Ping timeout: 240 seconds]
agent_white has joined #ruby
beeman has quit [Killed (Sigyn (Spam is off topic on freenode.))]
alem0lars has joined #ruby
<niexxx>
damn, it doesnt actually occur 100% of the time. assume makes an ass out of u and me...
<niexxx>
especially where concurrency is concerned
Inline has joined #ruby
<apeiros>
concurrency requires discipline. at least in ruby.
<niexxx>
yeah, i guess i got sidetracked because its 100% never occurred on OSX, where i actually developed the thing, so i assumed it was the environment
Blaguvest has quit [Read error: Connection reset by peer]
<niexxx>
presumably its just different timing from the different kernel schedulers or whatever
netscape101 has joined #ruby
sameerynho has joined #ruby
InfinityFye has quit [Read error: Connection reset by peer]
niexxx has quit [Ping timeout: 272 seconds]
troys has joined #ruby
niexxx has joined #ruby
johnny56 has joined #ruby
apparition has quit [Quit: Bye]
Alina-malina has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
polishdub has joined #ruby
kevinsjoberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has joined #ruby
mikecmpb_ has quit [Quit: inabit. zz.]
dionysus69 has quit [Ping timeout: 260 seconds]
mikecmpbll has joined #ruby
agent_white has quit [Ping timeout: 240 seconds]
agent_white has joined #ruby
chouhoulis has joined #ruby
chouhoulis has quit [Remote host closed the connection]
aufi has quit [Ping timeout: 272 seconds]
<niexxx>
so, whats a good pattern for reading from an IO that may or may not be closed?
Azure has quit [Read error: Connection reset by peer]
<niexxx>
until io.closed? {puts f.gets} has a race condition
Azure has joined #ruby
<niexxx>
should I just catch the IOError and move on?
<apeiros>
how about: avoid not knowing?
<apeiros>
no, that code only has a race condition if there's more code than just that.
<apeiros>
you could handle the IO in one thread instead of multiple.
<niexxx>
to explain, what im trying to do is stream the stdout of a subprocess into the stdout of my ruby process
<elomatreb>
Can you use the non-blocking operations for this?
outhicat has quit [Remote host closed the connection]
teclator has quit [Disconnected by services]
ur5us has joined #ruby
qolq has joined #ruby
benzrf has joined #ruby
<benzrf>
is there a nice way to take an iterable whose items are iterables and get an iterable which "flattens" it
s2013 has joined #ruby
<bougyman>
benzrf: example?
ur5us has quit [Ping timeout: 256 seconds]
<ccooke>
benzrf: it certainly wouldn't be hard to write one
<benzrf>
i know, but i was hoping there was already something in the stdlib :)
<benzrf>
bougyman: e.g., ['a.txt', 'b.txt'].map {|fn| File.open(fn).each_line}.join would give an Enumerable which produces the lines of 'a.txt' and then the lines of 'b.txt'
<benzrf>
i mean, you could read them all into arrays and then use Array#flatten, but that would be a bad idea
impermanence has joined #ruby
bijan_ has joined #ruby
<ccooke>
Actually, you might be able to use Enumerable#flat_map
mozzarella has quit [Remote host closed the connection]
<ccooke>
depending on your block
<ccooke>
That effectively concatenates the outputs of all the blocks
<jrich523>
i wish there was some rules on how to post generic code, so that you could search like that safely... and a general number lol.. so weird... like if you wanted to do "i want first 10" google will usually give you a suggestion for what number is more commonly searched, but... im typing too much
SeepingN has joined #ruby
cagomez has quit [Ping timeout: 272 seconds]
sanscoeur has joined #ruby
sanscoeur has quit [Remote host closed the connection]
orbyt_ has joined #ruby
bijan_ has quit [Remote host closed the connection]
orbyt_ has quit [Client Quit]
bijan_ has joined #ruby
apeiros_ has joined #ruby
cagomez_ has quit [Remote host closed the connection]
sanscoeur has joined #ruby
bijan_ has quit [Read error: Connection reset by peer]
bijan_ has joined #ruby
bijan_ has quit [Read error: Connection reset by peer]
<mroutis>
I burnt my savings going to rails conf; guess I should start saving some bucks for RubyConf 2019
venmx has quit [Ping timeout: 244 seconds]
sanscoeur has quit []
bijan_ has joined #ruby
MuffinPimp has joined #ruby
graphene has quit [Remote host closed the connection]
lxsameer has joined #ruby
graphene has joined #ruby
bijan__ has joined #ruby
bijan_ has quit [Read error: Connection reset by peer]
lxsameer has quit [Ping timeout: 256 seconds]
SCHAPiE has joined #ruby
za1b1tsu has quit [Ping timeout: 272 seconds]
darkhanb has joined #ruby
bijan__ has quit [Read error: Connection reset by peer]
bijan_ has joined #ruby
lxsameer has joined #ruby
KidSK8 has joined #ruby
kapil___ has joined #ruby
alex`` has quit [Ping timeout: 240 seconds]
clemens3 has quit [Ping timeout: 240 seconds]
<jrich523>
hey guys, with a bundle install, is there a list of locations it checks? mostly, locally before checking the 'source' (link or search term would be plenty welcome!)
bijan_ has quit [Read error: Connection reset by peer]
lxsameer has quit [Ping timeout: 240 seconds]
agent_white has quit [Ping timeout: 240 seconds]
<jrich523>
google is mostly getting me where it installs stuff to, not where it checks for gems
agent_white has joined #ruby
alex`` has joined #ruby
<havenwood>
jrich523: First Bundler will check vendor/cache, then $GEM_HOME and finally the sources in your Gemfile.
dendazen has joined #ruby
<havenwood>
jrich523: If you've installed that very gem and version before, it will use the installed version.
<jrich523>
well does it look to the folder itself? i just noticed a gem that had no path and was just basically a reference to a folder within the project
<havenwood>
jrich523: Use `gem which` to see where the file that's required for the gem lives.
<havenwood>
jrich523: For example: gem which rails
alex`` has quit [Ping timeout: 240 seconds]
lxsameer has joined #ruby
patr0clus has quit [Quit: WeeChat 2.1]
<havenwood>
jrich523: What's the problem you're running into? Getting an error? Have you tried a pristine install of the offending gem?
impermanence has quit [Remote host closed the connection]
<jrich523>
well, not so much a problem, was just sort of confused because this one has no path and its ok, but i saw someone reference... err... itself... and that confused me too, which basically just made me feel that i have no idea how bundle "finds" stuff
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
alex`` has joined #ruby
<jrich523>
this was a gem 'foreman_hooks' and it was just dump in to the foreman folder (its a plugin for it)
<jrich523>
but i recall seeing something crazy like this on another project, gem 'corp-provision', path: '.' which is super odd, cuz thats within the gem/project
<jrich523>
however it did have a 'todo: remove' so clearly why ever they did it, they knew it was a bad idea
lxsameer has quit [Ping timeout: 256 seconds]
beowuff has joined #ruby
ur5us has joined #ruby
solocshaw has joined #ruby
solocshaw has quit [Client Quit]
mroutis has quit [Ping timeout: 244 seconds]
ferhaty has joined #ruby
cadillac_ has quit [Ping timeout: 272 seconds]
ur5us has quit [Ping timeout: 256 seconds]
lxsameer has joined #ruby
cadillac_ has joined #ruby
alem0lars has quit [Ping timeout: 260 seconds]
ferhaty has quit [Quit: ferhaty]
alex``` has joined #ruby
lxsameer has quit [Ping timeout: 244 seconds]
alex`` has quit [Ping timeout: 240 seconds]
alex``` has quit [Client Quit]
lxsameer has joined #ruby
lxsameer has quit [Ping timeout: 255 seconds]
s2013 has joined #ruby
lxsameer has joined #ruby
snuz has joined #ruby
lxsameer has quit [Ping timeout: 255 seconds]
sauvin has quit [Remote host closed the connection]
akaiiro has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
agent_white has quit [Ping timeout: 272 seconds]
agent_white has joined #ruby
lxsameer has joined #ruby
dionysus69 has joined #ruby
daxroc__ has left #ruby [#ruby]
agent_white has quit [Ping timeout: 244 seconds]
agent_white has joined #ruby
lxsameer has quit [Ping timeout: 268 seconds]
mroutis has joined #ruby
beeman has joined #ruby
za1b1tsu has joined #ruby
s2013 has joined #ruby
<mroutis>
baweaver: I just saw advi's keynote, it was surprisingly emotive
lxsameer has joined #ruby
<Zarthus>
i just rounded it up as well, I added him to my beer list.
<mroutis>
this is what I love about ruby / ruby on rails community, there's always a human side of it
za1b1tsu has quit [Ping timeout: 244 seconds]
<baweaver>
avdi's a good guy, and has a heck of a story to tell. I need to get a beer with him some time later myself :)
<baweaver>
(then again I don't really drink beer, so maybe a whisky for me instead)
<mroutis>
btw. avdi has a course on OOP, I'm on the third week of the course an it have been amazing so far
lxsameer has quit [Ping timeout: 256 seconds]
mikecmpbll has joined #ruby
dviola has joined #ruby
agent_white has quit [Quit: brb]
Freshnuts has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
augcesar has joined #ruby
<mikhael_k33hl>
Will it be okay to publish a gem that is based on another one? like you just added a feature to it or changed a section?
<al2o3-cr>
mikhael_k33hl: ofc
<mikhael_k33hl>
al2o3-cr: what's ofc?
<kaleido>
of course
<al2o3-cr>
mikhael_k33hl: ok, sure you can ;)
<elomatreb>
Two aspects: 1) Legally, obey the restrictions of the source license 2) socially, if it's just a minor change or something like that and/or the gem is still maintained, a pull request may be better
<mikhael_k33hl>
oh okay, thanks
<mikhael_k33hl>
elomatreb: nah, I don't think the owner wants to add the functions/features though
<elomatreb>
If you've written the code, opening a pull request can't hurt. Although the owner doesn't appear too active
bmurt has quit [Ping timeout: 260 seconds]
<Zarthus>
The MIT license absolutely allows you to fork free of charge and make your own ruby-rsync from that, though
<mikhael_k33hl>
thanks, I'll do that and make some changes according to my needs hehe
<Zarthus>
just don't hold that guy liable if it burns your house down ;)
<elomatreb>
The problem is more that if this project now becomes active again and adds a new feature, your two implementations have diverged and people who want to use the gem will have to choose.
<elomatreb>
Esp. if you use the same toplevel namespace this is really annoying to deal with
<Zarthus>
aye, that's fair
<mikhael_k33hl>
nah, I'll place mine on a different namespace, just wanted to create a gem honestly. haha
<al2o3-cr>
mikhael_k33hl: have you experience with c extensions or libffi?
<mikhael_k33hl>
al2o3-cr: nah I don't
<mikhael_k33hl>
al2o3-cr: why? can I use that for rsync?
<al2o3-cr>
mikhael_k33hl: was going to suggest make a little gem that wraps libuuid ;)
<al2o3-cr>
if you were just putting it out there =P
<al2o3-cr>
but i see you're concentrating on rsync