#ruby - 12 September 2017
« Back 1 day Forward 1 day »
[02:32:31] Orbixx[m]: I'm trying to set up a automated testing workflow for a Ruby project and want to use a docker image to do so. I also want to avoid having the docker image redownload gems on each execution, so would ideally like to install them into the docker image using the project's Gemfile.lock.
[02:32:35] Orbixx[m]: If the project's Gemfile/Gemfile.lock contents change and one or more gems need installing and/or updating, can I simply run bundle install to update the existing gems and install new gems on a system that already has the previous project version's gems installed?
[03:51:47] craysiii: Hello everyone, I am having troubles with HTTParty. I am able to gain an access_token from the Twitch API via HTTParty, and I am able to authenticate that access_token via curl, but not via my method which appears to me to be the same request. Maybe there is something I am missing?
[06:12:25] havenwood: funkycrunchy: https://github.com/steakknife/rb-fsevent/blob/master/ext/fsevent_watch/signal_handlers.c#L57
[06:16:37] tamouse__: neat! i'm doing a general drop-in thing weekly now, but it's not focused on any particular tech (most folks are attending from bootcamps and are learning JS)
[06:18:15] tamouse__: i think what i'm looking for is the sort of stuff i can use to help me put together a plan of sorts; this thing is supposed to run for 8 sessions, then be over
[06:18:35] havenwood: tamouse__: First wed of the month we have a night for new folk, to get Ruby and other tools installed, etc.
[06:21:49] tamouse__: the tuesday night group is great and it's really been building a community for women in tech
[06:23:49] tamouse__: i think i want to really focus on practical coding practice, not lectures or slides and crap like that
[06:24:37] tamouse__: exercism is great for that, i've also got a few people going through brian hogan's book
[06:58:03] tamouse__: havenwood: here's one of the challenges: most of them are probably coming from the world of JS, where objects are so vastly different from the ruby world; bridging that, well, idk
[07:09:06] baweaver: >> require 'ipaddr'; IPAddr.new('10.0.0.0/8') === '10.0.0.1' # baweaver used Ruby trickshot!
[07:11:10] tamouse__: good. very good. the new job i started at the end of march as "API-driven Rubyist" has morphed into "API-driven Ruby and Reactist"
[07:12:11] tamouse__: i've been given the task of dragging our 12 year old nasty rails app forward into the age of graphql apis serving modern front end
[07:13:06] baweaver: He spent a good deal of time doing to same with older apps and may have some good stuff stashed.
[07:14:32] tamouse__: actually, i'll be there a while, arrive the 20th, depart the 31st. but i'm also spending time with my kids
[08:58:09] conall: When generating documentation with rdoc, lets say I have a directory with 3 modules in it and each has a README. I want to generate documentation from these READMEs so that under the "pages" tab, it will show the full path to all of these READMEs. Is this possible?
[09:12:05] Orbixx[m]: Has anybody experienced their rspec test failing to exit/return after completion?
[12:23:48] randy2009: Hi, i have a question, what does this statement?: if @resource[:source] == false
[12:27:19] randy2009: https://github.com/voxpupuli/puppet-windowsfeature/blob/master/lib/puppet/provider/windowsfeature/default.rb
[12:30:03] randy2009: https://github.com/voxpupuli/puppet-windowsfeature/commit/2841db2806de1189a443bfebff3d17bf7d485c87#diff-66e6e238a59acf587544c45bc15e3080
[16:11:07] craysiii: Sorry to post again everyone, I am having troubles with HTTParty. I am able to gain an access_token from the Twitch API via HTTParty, and I am able to authenticate that access_token via curl, but not via my method which appears to me to be the same request. Maybe there is something I am missing?
[16:21:35] havenwood: craysiii: Here's a handy curl-to-ruby generated conversion of your curl command to Net::HTTP: https://gist.github.com/havenwood/eac4b183d33a2d489b5578ac685cbe9f
[16:25:03] havenwood: craysiii: I get the same response for both curl and net-http, but I don't have a valid auth.
[16:32:03] Salmonidae: i don't know the context here. at all. but if they are in any way important, don't bother.
[16:36:01] Salmonidae: try to provide gists that show the call paths you're making. it will help. or raise an exception when you get an invalid response, and show the backtrace.
[16:36:13] Salmonidae: it makes identifying the issue easier without you having to provide any credentials
[17:20:11] Zoffix: \o Any idea what might be causing error about "gems/bundler" (full output here: https://gist.github.com/zoffixznet/11be36951d327c8646917557cb5b9aca ). I don't use Ruby in this project, but apparently it contains some files that trigger some ruby process when I try to use git on windows and git push fails with that error. Any hits what to look for?
[17:20:57] elomatreb: As the output suggests it's on the remote, maybe there is some broken receive hook on the server?
[17:40:18] Zoffix: Turned out to be a GitLab issue documented here https://github.com/gitlabhq/gitlabhq/issues/7230 . Fixed it by changing the shebang in ~/gitlab-shell/hooks/update to from /usr/bin/env ruby to /usr/local/bin/ruby. I guess there's another version of ruby kicking around on that box that it was using instead of the right one. Oh well. Works For Now™ :)
[19:00:52] theRoUS: how can i tell on linux whether a particular PID is alive or not? (exist or not)
[19:12:20] apeiros: don't remember why I used wait2 over other available methods, so feel free to investigate which wait methods support WNOHANG
[19:15:00] theRoUS: apeiros: i'm basically having to spawn() an ssh command to set up a tunnel to a remote non-ssh port -- and if the server isn't listening, i can't figure out how to tell
[19:16:21] theRoUS: apeiros: of course, if i'm not going to feed multiple commands, i coul probably use open3 instead
[19:18:58] eam: 19:00 < theRoUS> how can i tell on linux whether a particular PID is alive or not? (exist or not)
[19:21:26] eam: this will not actually interrupt the process with a signal, but you will be able to tell if the process is signalable or not
[19:21:58] havenwood: if it raises an Errno::EPERM, it's there you just don't have permission to signal it
[19:30:06] Salmonidae: Process.kill 0, pid_that_isnt_running raises Errno::ESRCH tho. still good though.
[19:38:15] eam: Salmonidae: yeah, the tricky thing here is that the underlying unix api intends errors to be useful
[19:38:36] eam: and that kinda makes for an antipattern of using exceptions for flow control when mapped into ruby
[19:39:18] Salmonidae: yeah. i think i just rescue SystemCallError false. basically. which would be better as a fine thought list of system errors that could apply.
[19:51:50] Slinky_Pete: Question on running a cgi script from the command line. using var such as text=cgi['text'] and puts
[19:53:43] Slinky_Pete: what do I run from the command line to make this return correct; at the moment I am running $ file.rb 'text=hello' but getting no putpt
[22:01:18] Slinky_Pete: Reading through Beginning Ruby, chap 10 you create a GenericServer, every time I attempt to run the server I get a address already in use error https://gist.github.com/cgibsonmm/8385d41e8b5ceb0c8c868f39325c30ac
[22:10:25] zenspider: Slinky_Pete: you probably kept a process open. You can't reopen the same port so either randomize it or make sure you kill all backgrounded processes
[22:12:22] Slinky_Pete: lsof | grep (myportnumber) doesn't return anything no matter what port I try
[22:12:23] tcopeland: there’s an interesting comment about that warning here: https://stackoverflow.com/questions/10261477/tcpserver-error-address-already-in-use-bind2 - “Note that the problem can also be a harmless warning coming from an IPv6 configuration issue: the server first binds to a dual-stack IPv4+IPv6 address, then it also tries to bind to a IPv6-only address; and the latter doesn't work because the IPv6 address is already taken by the
[22:12:40] matthewd: zenspider: I've been meaning to ask you... high level, could I use minitest-server to improve https://github.com/rails/rails/blob/acea68de026ba657cb65c4dd0fc1f24ba67e1cf8/railties/Rakefile#L16-L27 ?
[22:13:14] tcopeland: I see that warning locally also and lsof shows that nothing is running on that port - and when I run GenericService on a port I can telnet to it and get a timestamp response
[22:14:14] zenspider: matthewd: assuming I understand your q... tenderlove and I have talked about having a client that shows up to the server and asks for jobs but we haven't done it yet.
[22:14:16] matthewd: zenspider: Basically it currently has a series of individual test runs (because we want a clean ruby env for each, because reasons)... am I right in thinking that mt-s could do the same thing, but gather those children's results into a single series of dots?
[22:15:02] matthewd: So no, simpler than that: I just want to aggregate results from child processes, no fancy work-assignment stuff here
[22:17:08] zenspider: matthewd: right now, not so much. you can look at how minitest-bisect uses minitest-server ... and tenderlove does have some stuff (I think for github, not rails directly) for forking tests out... but at some point I'd like a minitest "job" server and clients that show up and run them. It'd basically take over for ... what's that called. ugh. I forget the name. not pigeon-hole... :)
[22:20:36] matthewd: Okay, thanks. Is there any sort of existing API by which I can.. I guess inject multiple test-run results into a/the runner (or whatever it is that sits between the individual MT::Test subclass instances and the reporter)? Or maybe I should be trying to inject them directly into the reporter?
[22:21:01] zenspider: Slinky_Pete: ok. 1) it's a WARN, not an error. 2) I can reproduce the warning... but I suspect it is not on the default interface. 3) nc localhost 3321 works fine and reports the time
[22:22:02] zenspider: 4) it only happens on the stock ruby! my rbenv install of 2.4.0 doesn't warn at all
[22:24:40] matthewd: At which point it depends on OS and maybe even compile-time flags as to whether the IPv6 listener defaults to IPv6-only, or dual stack
[22:26:54] Slinky_Pete: So, I am getting return on nc local; but noting in the browser. Oh well not really the biggest issue right now. I will keep looking around, I am sure I will figure out my error somewhere.
[22:39:21] matthewd: zenspider: Did you see my last? No worries if it was getting too complicated/boring/whatever.. just checking in case it slid by.
[22:44:48] zenspider: matthewd: no, catching up... nothing sits between a test and the reporter. It's all passed down to the class and then instance level run methods.
[22:45:51] matthewd: Ah, so maybe I just want to replace the reporter in the children, and manually construct a regular reporter in the parent and feed it directly
[22:46:05] zenspider: I would unify the run at the rake level and then try to do the split / map / reduce inside
[22:47:16] matthewd: This is about having a clean ruby environment (constants, loaded features, etc), so I don't think we can avoid the forking
[22:47:53] matthewd: I'd just rather not have output that looks like https://travis-ci.org/rails/rails/jobs/274411234#L793
[22:48:24] zenspider: not suggesting otherwise... pretty sure tenderlove has done this. Also pretty sure that... evan? the sequel guy has a minitest exension of the same sort. Tho I think he goes about it a bit wrong
[22:48:50] zenspider: yeah. it'd also be nice to have the rails bootstrap in the parent process and the forks for free
[22:49:43] matthewd: Yeah.. we do now do https://github.com/rails/rails/blob/master/railties/Rakefile#L52, which I recently resurrected from a change tenderlove tried a while ago
[22:49:43] zenspider: I think the majority of the complication on tenderlove's side was cloning/splitting the db connections as well
[22:50:43] zenspider: I should get a version of this, clean it up, and add it to minitest. and/or the client job thingy
[22:50:46] matthewd: Ah, yes, I know tenderlove has more complex stuff for parallel running in multiple processes
[22:51:23] zenspider: not sure if that was for rails or github tho... pretty sure he could share it either way. My eyeballs have touched it :)
[22:52:18] matthewd: I think that's a whole level more complicated than this one though -- here we're purely serial
[23:00:45] zenspider: matthewd: right... you're just forking for a fresh env (which is SAD by the way!) ... it'd be equivalent to only having one client worker spawned. I don't see that being much more than a cmdline flag
[23:02:47] matthewd: Sad but necessary.. we have to know we've got all the requires we need ¯\_(ツ)_/¯
[23:03:39] matthewd: If it was just about our own (actually very minimal) global state, we could arrange to reset it
[23:07:37] matthewd: zenspider: Talking of forks, I wish I could have a Minitest.dont_autorun / Minitest.forget_everything... but I do understand why it's objectionable
[23:07:51] matthewd: https://github.com/rails/rails/blob/master/railties/test/isolation/abstract_unit.rb#L255-L256 makes me sad
[23:09:52] matthewd: I want "neutralize the at_exit handler (because our forked child may not be a test at all), but if the child tries to arrange autorun for itself, then go ahead and un-neutralize it"
[23:10:03] zenspider: you could group_by + clear... fork children, and have them pull from the group_by partitions
[23:11:25] matthewd: I get the first half by installing an at_exit that'll just exit! before minitest gets a chance
[23:11:28] zenspider: it's kinda unfortunate that at_exit is forked as well and there seems to be no forked hook method
[23:11:42] matthewd: But then that means we never get the original one if it's really meant to happen
[23:13:37] zenspider: matthewd: I'd be open to suggestion in that area. I'm not fond of my alternatives in either direction
[23:14:31] matthewd: Totally literally-haven't-run-it untested, but something like https://gist.github.com/matthewd/b28a10f1334ba81d27d57a75efcc3dca might work
[23:24:16] matthewd: Slightly more complete wild guess: https://gist.github.com/matthewd/5f80623cafb20dc22d22bb34433295e3
[23:31:14] matthewd: It'll install it the first time, because @@installed_at_exit is still false from initialize