« Back to channel list

#ruby - 25 May 2018

« Back 1 day Forward 1 day »
[00:02:45] jenrzzz: has joined #ruby
[00:09:57] x0F: has joined #ruby
[00:10:49] banisterfiend: has joined #ruby
[00:18:34] lilherc: has left #ruby: ("Leaving")
[00:20:00] ogres: has joined #ruby
[00:22:54] alfiemax: has joined #ruby
[00:23:00] venmx: has joined #ruby
[00:23:10] shadeslayer: has joined #ruby
[00:23:15] elphe: has joined #ruby
[00:29:02] shadeslayer: has joined #ruby
[00:29:32] shadeslayer: has joined #ruby
[00:30:50] cagomez: has joined #ruby
[00:31:57] orbyt_: has joined #ruby
[00:51:13] lystra_: Can anyone help me with https://stackoverflow.com/questions/50072911/augmenting-gem-search-path?
[00:51:37] sytherax: has joined #ruby
[00:51:57] khanred: has joined #ruby
[00:52:18] hlmjr: has joined #ruby
[00:52:45] dviola: has joined #ruby
[00:56:06] ur5us: has joined #ruby
[00:56:59] khanred: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[00:57:11] venmx: has joined #ruby
[00:57:47] Deesl: has joined #ruby
[01:03:28] havenwood: lystra_: Does it work without the --local flag?
[01:04:06] ur5us: has joined #ruby
[01:05:36] havenwood: lystra_: You want to install it from the remote source, yeah?
[01:06:24] havenwood: gem install rails --local #!> ERROR: Could not find a valid gem 'rails' (>= 0) in any repository
[01:08:13] dviola: has joined #ruby
[01:08:54] dbugger_: has joined #ruby
[01:09:13] havenwood: lystra_: The default is --both, which allows local or remote sourced gems to be installed. It seems you're meaning to install from a remote source, so the default or --remote will work, but you don't have loquacious.gem locally, so it can't be found with --local.
[01:09:45] Radar: seems a bit like "Installing Ruby: The Hard Way"
[01:10:20] bayprogrammer: has joined #ruby
[01:11:02] Radar: But yeah, I think havenwood is right. --local is probably the cause of the problem here.
[01:11:16] dbugger__: has joined #ruby
[01:13:29] Dbugger: has joined #ruby
[01:16:12] eckhardt: has joined #ruby
[01:18:20] nertzy: has joined #ruby
[01:18:41] Puffball: has joined #ruby
[01:21:17] white_lilies: has joined #ruby
[01:32:11] lystra_: havenwood: Let me try.
[01:33:05] GodFather: has joined #ruby
[01:33:10] lystra_: havenwood: That worked. Thanks! I was using the same installation procedure as with ruby-2.0 so I expected things to work for future Ruby versions as well. Thanks a lot.
[01:35:04] rivalomega: has joined #ruby
[01:35:44] lystra_: havenwood: I don't really get the difference between local/remote but things work with --local.
[01:37:37] havenwood: lystra_: With --local you're saying you have the loquacious.gem file locally, and you'd like to install it from your local version.
[01:37:46] lystra_: Radar: Yeah, it might not seem intuitive but we want to keep the base Ruby installation and any 3rd-party gems separate. We do something similar with Python, Perl, Tcl/Tk, etc.
[01:38:30] kmurphy4: has joined #ruby
[01:39:05] havenwood: lystra_: With --both (default) or --remote, it'll look for the gem in your remote sources as well (default https://rubygems.org/).
[01:39:24] havenwood: lystra_: See what you have set for remote gem sources: gem env remotesources
[01:40:10] lystra_: havenwood: https://rubygems.org/ which I guess is the default.
[01:40:37] havenwood: lystra_: Yup, just the --local flag was overriding the --both default, telling RubyGems not to look at https://rubygems.org/.
[01:41:04] havenwood: lystra_: Without already having a local copy of those gems, it couldn't find them.
[01:41:38] lystra_: havenwood: Well, we have /tmp/ruby24p/vendor/lib/2.4.0/cache/loquacious-1.9.1.gem which I would expect it to find with --local.
[01:42:31] alfiemax: has joined #ruby
[01:46:25] lystra_: havenwood: Actually, our preference is for gem install not to fetch anything from the Internet.
[01:47:38] lystra_: havenwood: BTW, if I install to the default directory (i.e. omit --bindir and --install-dir), then even with --local, I can install little-plugger, loquacious, and bones successfully. Only when installing outside of the default installation path is there a problem. So, I think the problem remains that Ruby is not search out custom installation directory for gems to match the dependency.
[01:47:40] havenwood: lystra_: I'm curious if we'd be able to give better suggestions if we knew more about what you're doing.
[01:48:20] lystra_: havenwood: I just want to install all gems (via gem install) to a separate directory from where ruby was installed.
[01:49:09] lystra_: havenwood: So if I install ruby 2.4.4 to /tmp/ruby24, I want to install all gems for it to /tmp/ruby24p.
[01:49:24] havenwood: lystra_: Normally in prod we use a Gemfile.lock to specify the exact gem versions then install them to vendor/bundle relative to the root of the project.
[01:49:49] havenwood: lystra_: If you don't want to download remote gems, how do they get on the server?
[01:50:03] havenwood: lystra_: You can pass the location of the .gem file to --local.
[01:50:16] lystra_: havenwood: I download them manually. I just don't want them downloaded automatically. Sorry for the poor wording.
[01:50:37] havenwood: lystra_: You can also run your own local gemserver. It's hard to give recommendations without knowing more about why you're doing what you're doing.
[01:50:47] havenwood: lystra_: no prob
[01:52:25] lystra_: havenwood: We're packaging Ruby for some customers. When we provide an RPM to them, Ruby will be installed to /usr/local/ruby24. The customers also want some gems and we don't want to install the gems to the same directory as Ruby so we're installing the gems to /usr/local/ruby24p. We also want Ruby, when someone requires the gem, to search for the gems in /usr/local/ruby24 *and* /usr/local/ruby24p.
[01:55:53] havenwood: lystra_: I'd say just pass the location of the *.gem to --local.
[01:56:42] lystra_: havenwood: I am installing with /tmp/ruby24/bin/gem install -V --rdoc --ri --bindir=/tmp/ruby24p/bin --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 --local /opt/src/2018.01.01/ruby/bones-3.8.4/src/bones-3.8.4.gem. Isn't that passing the location of the gem file?
[01:59:44] alfiemax: has joined #ruby
[01:59:46] bga57: has joined #ruby
[02:01:37] havenwood: lystra_: yes, looks right to me
[02:02:14] lystra_: havenwood: That's the command that's failing. It succeeds without --local.
[02:03:51] havenwood: lystra_: --rdoc and --ri are deprecated, you can use --document instead but you're not changing the default so I'd omit them
[02:04:51] lystra_: havenwood: Ok, thanks. I see that with 'gem install --help. Didn't notice it. Holdovers from how we installed things with Ruby 2.0.
[02:06:16] havenwood: lystra_: Sanity check that .gem file really is there?: file /opt/src/2018.01.01/ruby/bones-3.8.4/src/bones-3.8.4.gem
[02:06:48] lystra_: havenwood: Yep. I use the same command line for Ruby 2.0 but just change 24 -> 20 and it works fine.
[02:07:18] lystra_: havenwood: If the .gem file wasn't there, it wouldn't know loquacious was a dependency and generate the error message about not finding it.
[02:07:46] lystra_: havenwood: If I strace the command, /tmp/ruby24p/vendor/lib/2.4.0/specifications is never searched unlike when I use Ruby 2.0.
[02:07:51] havenwood: lystra_: oh! you're not trying to install loquacious, it's a dep of a gem?
[02:08:10] havenwood: I mean not trying to install it directly?
[02:09:47] lystra_: havenwood: Correct. bones needs little-plugger and loquacious. We manually installed both using the same method. Then, when we try to install bones, it fails because it cannot find its dependencies. So our custom gem installation path isn't getting searched for dependencies.
[02:11:18] havenwood: lystra_: So you're installing the gems while online with --install-dir BLARG then moving all those gems and their deps over to your server from BLARG/cache/*.gem?
[02:14:34] RyanMcCoskrie: has joined #ruby
[02:15:04] havenwood: lystra_: Interesting. I don't know why it's not finding the deps.
[02:15:59] lystra_: havenwood: No, we're installing directly to our custom gem path, /tmp/ruby24p for now to test things. When we have this issue figured out, we'll rebuild Ruby and the gems and install to /usr/local/ruby24 and /usr/local/ruby24p and then generate an RPM directly from that directory. We're doing all this while online but using local paths to find all the gems.
[02:17:34] lystra_: havenwood: Ok, thanks. I'll post to ruby-talk and hopefully someone will have an answer.
[02:35:44] coderphive: has joined #ruby
[02:37:25] j416: has joined #ruby
[02:42:46] sleetdrop: has joined #ruby
[02:47:27] enigma: has joined #ruby
[02:50:50] sleetdrop: has joined #ruby
[02:52:09] alfiemax: has joined #ruby
[02:54:41] hlmjr: has joined #ruby
[02:55:48] krawchyk: has joined #ruby
[03:00:11] cadillac_: has joined #ruby
[03:00:32] thapakazi: has joined #ruby
[03:10:07] braincrash: has joined #ruby
[03:10:36] conta: has joined #ruby
[03:16:04] howdoi: has joined #ruby
[03:18:06] alfiemax: has joined #ruby
[03:21:22] alfiemax_: has joined #ruby
[03:27:02] white_lilies: has joined #ruby
[03:28:51] elphe: has joined #ruby
[03:29:28] sleetdrop: has joined #ruby
[03:33:41] cagomez: has joined #ruby
[03:35:14] Radar: Is roo still the latest and greatest gem to use for reading Excel files?
[03:36:28] coderphive: has joined #ruby
[03:40:33] orbyt_: has joined #ruby
[03:43:29] mtkd: has joined #ruby
[03:46:36] gix-: has joined #ruby
[03:55:05] dbugger_: has joined #ruby
[03:56:59] skryking: has joined #ruby
[03:59:28] \void: has joined #ruby
[04:00:13] phate408: has joined #ruby
[04:13:03] rkazak: has joined #ruby
[04:20:24] jamesaxl: has joined #ruby
[04:22:19] eckhardt: has joined #ruby
[04:22:36] johnny56_: has joined #ruby
[04:23:01] eckhardt: has joined #ruby
[04:23:17] reber: has joined #ruby
[04:26:24] conta: has joined #ruby
[04:27:46] phaul: has joined #ruby
[04:31:23] elphe: has joined #ruby
[04:43:03] anisha: has joined #ruby
[04:55:22] jcarl43: has joined #ruby
[04:55:49] apeiros: has joined #ruby
[04:56:53] pskosinski: has joined #ruby
[04:58:01] rivalomega: has joined #ruby
[05:01:53] elphe: has joined #ruby
[05:02:42] eck: has joined #ruby
[05:08:00] Bryan: has joined #ruby
[05:10:57] ur5us: has joined #ruby
[05:11:12] elomatreb: has joined #ruby
[05:12:29] alfiemax: has joined #ruby
[05:18:30] rivalomega: has joined #ruby
[05:24:03] sauvin: has joined #ruby
[05:32:05] Asher: has joined #ruby
[05:38:29] KeyJoo: has joined #ruby
[05:39:28] KeyJoo: has joined #ruby
[05:41:18] aupadhye: has joined #ruby
[05:49:06] ciscam: has joined #ruby
[05:52:04] Asher: has joined #ruby
[05:53:22] z3uS: has joined #ruby
[05:54:49] kapil___: has joined #ruby
[06:03:32] clemens3: has joined #ruby
[06:03:43] emilford: has joined #ruby
[06:11:32] conta: has joined #ruby
[06:12:44] tag: has joined #ruby
[06:13:06] clemens3_: has joined #ruby
[06:23:33] schleppel: has joined #ruby
[06:27:06] xuanrui: has joined #ruby
[06:29:12] olspookishmagus: has joined #ruby
[06:32:11] ciscam: has joined #ruby
[06:33:19] biberu: has joined #ruby
[06:36:20] RougeR: has joined #ruby
[06:36:32] apeiros: has joined #ruby
[06:48:38] burgestrand: has joined #ruby
[06:53:28] elphe: has joined #ruby
[07:00:34] Asher: has joined #ruby
[07:00:53] Deesl: has joined #ruby
[07:04:16] tvw: has joined #ruby
[07:12:46] elphe: has joined #ruby
[07:13:07] claudiuinberlin: has joined #ruby
[07:13:59] clemens3: has joined #ruby
[07:16:15] suukim: has joined #ruby
[07:16:35] aufi: has joined #ruby
[07:23:15] ArtCorvelay: has joined #ruby
[07:24:00] vondruch: has joined #ruby
[07:26:44] dinfuehr: has joined #ruby
[07:28:50] DarthGandalf: has joined #ruby
[07:29:56] c0ncealed1: has joined #ruby
[07:33:49] ellcs: has joined #ruby
[07:45:44] sytherax: has joined #ruby
[07:53:46] lxsameer: has joined #ruby
[07:54:12] sysvalve: has joined #ruby
[07:56:17] mlkkk: has joined #ruby
[08:01:51] yohji: has joined #ruby
[08:03:05] NL3limin4t0r: has joined #ruby
[08:03:16] marr: has joined #ruby
[08:11:23] dionysus69: has joined #ruby
[08:18:13] burgestrand: has joined #ruby
[08:19:10] Mia: has joined #ruby
[08:19:11] Mia: has joined #ruby
[08:19:19] duderonomy: has joined #ruby
[08:19:39] mrush: has joined #ruby
[08:21:23] redlegion: has joined #ruby
[08:24:51] alfiemax: has joined #ruby
[08:26:16] alfiemax: has joined #ruby
[08:28:00] guille-moe: has joined #ruby
[08:29:53] elphe: has joined #ruby
[08:30:20] duderono_: has joined #ruby
[08:30:39] amar: has joined #ruby
[08:36:39] mrush_: has joined #ruby
[08:37:50] ellcs: guys, can someone explain me why this behavior exists? xD
[08:37:56] ellcs: `nil.to_i # => 0`
[08:40:00] apeiros: that's a very good question and I have no good answer for it.
[08:40:40] dminuoso: ellcs: nil.to_a works too
[08:40:42] dminuoso: nil.to_s works too
[08:40:46] dminuoso: lots of surprising things.
[08:40:49] apeiros: I guess you'd have to ask matz
[08:41:06] apeiros: nil.to_s at least makes some sense. though you could argue about "" vs "niL"
[08:41:41] apeiros: but yeah, nil.to_i, .to_f, .to_<numeric>, .to_a, .to_h all make no sense IMO
[08:42:18] dminuoso: nil.to_s makes sense?
[08:42:50] dminuoso: apeiros is on the righteous path of type theory
[08:43:01] apeiros: sure. "printable representation of the object" makes sense for almost all objects.
[08:43:40] dminuoso: >> nil.to_str
[08:43:50] Asher: has joined #ruby
[08:43:53] dminuoso: >> nil.to_ary
[08:44:05] phaul: however is nil an object that represents the absence of any object? :)
[08:44:36] apeiros: yes, that's its purpose. implementing the nullobject pattern :)
[08:45:02] ellcs: i dont want to start a war, but aren't there two concepts mixed up? neutral elements and non-existence?
[08:45:09] ellcs: but i see the purpose now, thanks!
[08:45:30] mtkd: has joined #ruby
[08:45:57] apeiros: ellcs: that's probably where it comes from. but neutral element in numbers isn't always 0 either. it depends on the operation (e.g. multiplication, 0 is not neutral, 1 is). which makes 0 even less of a meaningful choice.
[08:46:39] apeiros: ACTION pokes ruby[bot]
[08:46:49] ruby[bot]: You can find an overview of my commands at http://ruby-community.com/ruboto/commands
[08:46:56] ruby[bot]: apeiros: # => 2 (https://eval.in/1009775)
[08:49:36] phaul: I mean what I said there feels like a contradiction in itself. :) but it's rather philosophical and a bit pointless argument..
[08:51:45] apeiros: I understood. but having a value representing the absence of a value is a widely used concept, known as the nullobject pattern. it's not just limited to nil.
[08:52:13] apeiros: in an authentication/authorization system you could e.g. have a NullUser
[08:52:36] apeiros: so while it may be contradictory, it's useful
[08:53:26] apeiros: I'd love it if ruby allowed subclassing NilClass for this purpose
[08:54:00] apeiros: so that: `class NullUser < NilClass; end; user =NullUser.new; user ? true : false` => false
[08:55:01] ellcs: but why subclassing it, i mean you can just use nil itself
[08:55:23] apeiros: can you do nil.privileges ?
[08:55:33] apeiros: or nil.has_privilege?("edit_stuff")?
[08:55:50] ellcs: no, but your programm crashes at this point
[08:55:56] apeiros: which is not what I want
[08:56:23] phaul: but doesn't that mean u need to sublcass User?
[08:56:32] phaul: at least for the interface
[08:56:35] apeiros: all I need is a duck
[08:57:10] apeiros: if it quacks like a user and walks like a user, it is a user. it just is not allowed to do anything :)
[08:57:37] ellcs: well, you might have a user "nil" entry xD
[08:57:43] apeiros: it simplifies the design a lot.
[08:58:02] apeiros: without the nulluser, I either have crashing apps, or I have to take care of nil *everywhere*
[08:58:39] phaul: yeah, I'm just not seeing why subclassing NilClass is needed
[08:58:48] ellcs: i mean, having a 'nil'-user in your database has the same benefits.
[08:58:55] apeiros: it isn't. it'd just make a couple of things nicer.
[08:59:14] apeiros: without that, I just use predicates
[08:59:19] apeiros: user.logged_in? f.ex.
[08:59:33] apeiros: hardcoded to true for User, hardcoded to false for NullUser
[08:59:57] apeiros: but it means you have to invent a predicate for every kind of class
[09:00:00] t0xik: has joined #ruby
[09:00:18] apeiros: I'd rather treat NullObjects as falsy.
[09:00:42] XB23: has joined #ruby
[09:01:06] dhollinger: has joined #ruby
[09:01:14] venmx: has joined #ruby
[09:02:49] Charliebr73: has joined #ruby
[09:03:35] Charliebr73: has left #ruby: ()
[09:03:40] Charliebr73: has joined #ruby
[09:04:00] phaul: where Im unsure about your design is that would you def has_priviledge? in your NullUser < NilClass? Or would have checks outside
[09:04:25] apeiros: NullUser has the same interface as User
[09:05:04] apeiros: since NullObjects usually deviate wildly from their non-null counterpart, a shared codebase was rarely a consideration
[09:05:28] apeiros: but yeah, maybe we could use a different approach than subclassing to turn an entire class falsy
[09:11:27] phaul: >> Object.instance_methods.grep(/to_/)
[09:11:28] ruby[bot]: phaul: # => [:to_enum, :to_s] (https://eval.in/1009793)
[09:12:41] phaul: at least to_s is there. I was thinking based on the same argument as the NullUser should have the interface of the User, NilClass should have the same interface as Object. But object doesn't respond to those things..
[09:13:32] apeiros: >> Object.instance_methods & NilClass.instance_methods
[09:13:33] ruby[bot]: apeiros: # => [:instance_of?, :public_send, :instance_variable_get, :instance_variable_set, :instance_variable_def ...check link for more (https://eval.in/1009794)
[09:13:41] apeiros: that's the common interface
[09:14:08] apeiros: >> {object_only: Object.instance_methods - NilClass.instance_methods, nil_only: NilClass.instance_methods - Object.instance_methods}
[09:14:09] ruby[bot]: apeiros: # => {:object_only=>[], :nil_only=>[:&, :^, :|, :to_a, :to_i, :to_f, :to_h, :to_r, :rationalize, :to_c]} (https://eval.in/1009796)
[09:14:56] apeiros: and as said, IMO the to_<num> and to_<collection> methods should not be in there
[09:15:58] apeiros: and while I see a reason for the logical operation methods, they probably shouldn't be either
[09:16:57] yohji: has joined #ruby
[09:17:34] sytherax_: has joined #ruby
[09:20:40] mouni: has joined #ruby
[09:20:55] mouni: has left #ruby: ()
[09:25:43] rivalomega: has joined #ruby
[09:26:57] sytherax: has joined #ruby
[09:31:09] NL3limin4t0r: The object_only method result is kinda obvious since:
[09:31:15] NL3limin4t0r: >> NillClass.superclass
[09:31:16] ruby[bot]: NL3limin4t0r: # => uninitialized constant NillClass ...check link for more (https://eval.in/1009825)
[09:31:18] minimalism: has joined #ruby
[09:31:21] NL3limin4t0r: >> NilClass.superclass
[09:31:22] ruby[bot]: NL3limin4t0r: # => Object (https://eval.in/1009826)
[09:31:34] conta: has joined #ruby
[09:33:58] phaul: &ri Object.[]
[09:34:38] amelliaa: has joined #ruby
[09:36:01] xuyuheng: has joined #ruby
[09:37:17] dminuoso: Where is adaedra
[09:37:29] phaul: [] is not an instance method of Object here on 2.5...
[09:37:39] duderonomy: has joined #ruby
[09:38:19] dminuoso: 11:00 apeiros | I'd rather treat NullObjects as falsy.
[09:38:20] phaul: /o\ I'm stupid :D
[09:38:24] dminuoso: How about not allowing it all.
[09:38:39] alfiemax: has joined #ruby
[09:38:59] phaul: I thought object_only: [] was object_only: [ :[] ] :D
[09:40:08] Sylario: has joined #ruby
[09:41:08] roshanavand: has joined #ruby
[09:42:18] conta: has joined #ruby
[09:47:58] duderonomy: has joined #ruby
[09:51:11] roshanavand: has joined #ruby
[10:00:36] jyaworski: has joined #ruby
[10:05:14] conta: has joined #ruby
[10:05:29] Dbugger: has joined #ruby
[10:06:54] apparition: has joined #ruby
[10:06:56] elphe: has joined #ruby
[10:13:43] elphe: has joined #ruby
[10:15:56] kirun: has joined #ruby
[10:20:02] quobo: has joined #ruby
[10:20:37] karapetyan: has joined #ruby
[10:21:09] anisha: has joined #ruby
[10:21:22] karapetyan: has joined #ruby
[10:23:30] Mike11: has joined #ruby
[10:23:49] apeiros: has joined #ruby
[10:24:10] plexigras: has joined #ruby
[10:24:24] guille-moe: has joined #ruby
[10:25:22] xuyuheng: has joined #ruby
[10:31:24] elphe: has joined #ruby
[10:36:17] viq: has joined #ruby
[10:36:38] viq: ruby bundler question: I'm trying to run "bundle install" pretty much on https://github.com/chef/inspec/blob/master/examples/kitchen-puppet/Gemfile and keep getting errors like "Network error while fetching https://rubygems.org/quick/Marshal.4.8/minitest-5.11.3.gemspec.rz (execution expired)", what am I doing wrong?
[10:39:09] guille-moe: has joined #ruby
[10:41:53] ur5us: has joined #ruby
[10:42:12] alfiemax: has joined #ruby
[10:42:26] duderonomy: has joined #ruby
[10:42:43] webhat: has joined #ruby
[10:44:13] ellcs: has joined #ruby
[10:44:54] ciscam: has joined #ruby
[10:50:09] mtkd: has joined #ruby
[10:53:12] guille-moe: has joined #ruby
[10:56:11] phaul: viq, fwiw I can download that link here, so it's not the server side.
[10:56:27] nertzy2: has joined #ruby
[10:56:34] viq: phaul: so can I using curl. Yet "bundle install" consistently fails
[10:58:09] rmerry: has left #ruby: ()
[10:58:43] plexigras: has joined #ruby
[10:59:29] karapetyan: has joined #ruby
[11:00:53] elphe: has joined #ruby
[11:02:20] ur5us: has joined #ruby
[11:05:52] emilford: has joined #ruby
[11:08:26] jamesaxl: has joined #ruby
[11:08:37] contradictioned: has joined #ruby
[11:13:05] xuyuheng: has joined #ruby
[11:14:42] viq: phaul: it started working when I disabled IPv6 on my machine...
[11:15:50] phaul: viq: all is well then :)
[11:17:46] paul0: has joined #ruby
[11:19:46] Cavallari: has joined #ruby
[11:23:38] duderono_: has joined #ruby
[11:25:29] ellcs: has joined #ruby
[11:29:46] dionysus69: has joined #ruby
[11:31:54] ciscam: has joined #ruby
[11:32:18] ur5us: has joined #ruby
[11:33:06] coderphive: has joined #ruby
[11:34:54] AJA4350: has joined #ruby
[11:35:09] ipe: has joined #ruby
[11:35:34] ur5us: has joined #ruby
[11:41:09] jottr: has joined #ruby
[11:41:47] ldnunes: has joined #ruby
[11:42:24] Guest25333: has joined #ruby
[11:42:26] contradictioned: has joined #ruby
[11:44:12] brucebag: has joined #ruby
[11:44:12] brucebag: has joined #ruby
[11:44:21] graingert: has joined #ruby
[12:00:47] jrabe: has joined #ruby
[12:11:26] donofrio: has joined #ruby
[12:12:40] alfiemax: has joined #ruby
[12:13:35] alfiemax: has joined #ruby
[12:16:50] jcalla: has joined #ruby
[12:20:05] canton7: has joined #ruby
[12:25:46] sytherax: has joined #ruby
[12:29:36] catphish: has joined #ruby
[12:30:12] catphish: is there a correct way to allow instance of a custom class to be "coerced" into an expected object?
[12:30:54] catphish: for example Fixnum#+ expects a number as a parameter, but i want to pass something that's not a numeric
[12:31:23] ShekharReddy: has joined #ruby
[12:31:50] oleo: has joined #ruby
[12:31:54] catphish: (and allow it to be coerced)
[12:33:04] phaul: does that thing respond to to_i? Can you make it to if not?
[12:33:19] phaul: that's what I would try
[12:33:34] phaul: not sure if it's "the correct way" tho
[12:33:34] catphish: i just found there's a method called coerce that might help
[12:33:36] apeiros: catphish: see #coerce
[12:34:26] apeiros: probably best Numeric#coerce
[12:34:32] apeiros: (for docs I mean)
[12:35:19] apeiros: >> class Two; def coerce(other); [other, 2]; end; end; two = Two.new; 1 + two
[12:35:20] ruby[bot]: apeiros: # => 3 (https://eval.in/1010072)
[12:35:48] catphish: coerce is odd
[12:36:10] dminuoso: catphish: wait a sec!
[12:36:28] catphish: 1) first of all, method_missing doesn't receive coerce
[12:37:18] catphish: defining "def coerce; super; end" causes different behaviour to not defining it
[12:39:06] dminuoso: catphish: https://eval.in/1010074
[12:39:09] dminuoso: Coercing done right.
[12:39:32] dminuoso: Usual disclaimer: I will not be held responsible if you run this in production code. ;o
[12:41:59] catphish: basically, i can't extend primative classes, so doing something like this to carry them around in a wrapper https://paste.ubuntu.com/p/FFyNh9BDHS/
[12:42:23] catphish: not the actual code, i paraphrase, but that's the concept, not sure why it's necessary to define coerce explicitly here
[12:42:41] catphish: not sure how ugly this is, but it works
[12:43:09] codymj: has joined #ruby
[12:46:44] chouhoulis: has joined #ruby
[12:50:22] gnufied: has joined #ruby
[12:50:23] apeiros: catphish: your object probably recevies a respond_to?(:coerce)
[12:50:47] apeiros: so if you omitted a proper respond_to_missing? impl, then it won't even try to invoke .coerce
[12:51:30] apeiros: and seeing your paste, you did in fact not add a proper respond_to_missing. you should amend that. there's a couple of things which will not work properly without it.
[12:53:26] apeiros: baweaver: ruby tip for tomorrow: "if you implement method_missing, also implement a corresponding respond_to_missing?" ;-)
[12:58:55] catphish: apeiros: thanks, i'll implement respond_to_missing, it seems that at least #corerce and #to_s are implicitly definied, and so don't go to method_missing
[13:00:06] catphish: or it may be the result of my respond_to_missing, or a combination :)
[13:00:17] catphish: *my missing respond_to_missing
[13:00:28] Mike11: has joined #ruby
[13:01:08] dminuoso: ACTION gave you the best coerce in the world
[13:01:12] dminuoso: and you ignored it :(
[13:01:32] dminuoso: Because it was called _cast?
[13:01:42] catphish: that did scare me a little, yes
[13:01:59] catphish: would you like a slice of my gdpr cake to make up for it? https://i.imgur.com/hvEh0V6.jpg
[13:02:07] dminuoso: It directly pokes in the ruby land vm and changes the class pointer!
[13:03:58] marr: has joined #ruby
[13:06:25] sysvalve: has joined #ruby
[13:06:43] jarnalyrkar: has joined #ruby
[13:10:49] kmurphy4: has joined #ruby
[13:12:34] gigetoo: has joined #ruby
[13:15:49] jarnalyrkar: has joined #ruby
[13:21:32] shinnya: has joined #ruby
[13:25:07] mostlybadfly: has joined #ruby
[13:28:48] chouhoulis: has joined #ruby
[13:30:48] duderonomy: has joined #ruby
[13:34:03] bmurt: has joined #ruby
[13:35:37] rippa: has joined #ruby
[13:40:49] tAn: has joined #ruby
[13:41:30] norfumpit: has joined #ruby
[13:41:59] mjolnird: has joined #ruby
[13:43:58] norfumpit: is it safe to change value of Net::HTTP::HTTPVersion inside a passenger environment? i think I might be having some concurrency issues due to my changing that constant around a block of code
[13:50:45] viq: has left #ruby: ()
[13:51:33] houhoulis: has joined #ruby
[13:53:41] jyaworski: has joined #ruby
[13:54:14] rivalomega: has joined #ruby
[13:56:45] mtkd: has joined #ruby
[13:58:56] grilix_: has joined #ruby
[13:59:50] Rapture: has joined #ruby
[14:00:33] Asher: has joined #ruby
[14:05:28] krawchyk[away]: has joined #ruby
[14:10:48] bmurt: has joined #ruby
[14:12:28] apeiros: catphish: sorry, got distracted by RL. you should google for examples of how to implement numeric-like classes in ruby. iirc there are good examples around.
[14:16:47] kmurphy4: has joined #ruby
[14:22:42] venmx: has joined #ruby
[14:23:11] sysfault: has joined #ruby
[14:23:38] catphish: apeiros: RL is boring
[14:27:09] syndikate: has joined #ruby
[14:27:16] eckhardt_: has joined #ruby
[14:27:21] \13k: has joined #ruby
[14:28:49] alfiemax: has joined #ruby
[14:29:13] bmurt: has joined #ruby
[14:35:48] DTZUZO: has joined #ruby
[14:42:02] mlkkk: has joined #ruby
[14:42:28] jamiejackson: has joined #ruby
[14:47:49] chouhoulis: has joined #ruby
[14:47:58] hlmjr: has joined #ruby
[14:52:11] DTZUZO: has joined #ruby
[14:54:17] mostly-harmless: has joined #ruby
[14:56:07] conta: has joined #ruby
[14:57:43] lxsameer: has joined #ruby
[14:59:00] beefjoe70: has joined #ruby
[14:59:32] coderphive: has joined #ruby
[15:14:57] nayena: has joined #ruby
[15:16:45] cagomez: has joined #ruby
[15:19:38] sytherax: has joined #ruby
[15:26:56] kapil___: has joined #ruby
[15:27:01] apeiros: has joined #ruby
[15:27:26] mtkd: has joined #ruby
[15:30:15] rivalomega: has joined #ruby
[15:31:51] plexigras: has joined #ruby
[15:33:26] rivalomega: has joined #ruby
[15:40:19] paul0: has joined #ruby
[15:41:21] Meowcenary: has joined #ruby
[15:42:21] zacts: has joined #ruby
[15:42:57] nayena: has joined #ruby
[15:43:37] alfiemax: has joined #ruby
[15:45:01] beefjoe70: can I get the type of the result for eval(1+1) ?
[15:46:25] havenwood: beefjoe70: The type is always Object, arguably. ;-P
[15:46:48] havenwood: beefjoe70: You can ask any Object its class with Object#class.
[15:46:58] havenwood: >> eval('1 + 1').class
[15:46:59] ruby[bot]: havenwood: # => Fixnum (https://eval.in/1010186)
[15:47:10] havenwood: (Integer, in modern Ruby.)
[15:47:20] beefjoe70: what's the method to return the typeOf ?
[15:48:16] mozzarella: focus brother
[15:48:48] havenwood: >> 'beefjoe70'.class
[15:48:50] ruby[bot]: havenwood: # => String (https://eval.in/1010189)
[15:50:00] beefjoe70: oh didn't see it before
[15:50:09] mtkd: has joined #ruby
[15:52:07] chouhoulis: has joined #ruby
[15:53:42] Asher: has joined #ruby
[16:00:58] cthulchu: has joined #ruby
[16:02:48] rivalomega: has joined #ruby
[16:03:13] Deesl: has joined #ruby
[16:09:20] quobo: has joined #ruby
[16:10:08] Deesl: has joined #ruby
[16:13:36] tAn: has joined #ruby
[16:20:56] rivalomega: has joined #ruby
[16:22:09] elomatreb: has joined #ruby
[16:26:37] thapakazi: has joined #ruby
[16:26:50] tipyn: has joined #ruby
[16:33:29] wontruefree: has joined #ruby
[16:34:34] jcarl43: has joined #ruby
[16:38:27] mtkd: has joined #ruby
[16:42:32] eckhardt_: has joined #ruby
[16:43:11] amar: has joined #ruby
[16:43:16] ldnunes: has joined #ruby
[16:43:58] alfiemax_: has joined #ruby
[16:48:03] phaul: has joined #ruby
[16:50:10] amar: has joined #ruby
[16:50:46] eckhardt_: has joined #ruby
[16:51:45] raynold: has joined #ruby
[16:52:44] \void: has joined #ruby
[16:55:00] baweaver: apeiros: I already have a list :P
[16:55:09] apeiros: thought as much
[16:55:30] baweaver: I've made it some 15 days in advance so far, aiming for 30 to 60 when I have some spare time to sit down and write more.
[16:56:00] baweaver: Struct is a fun one. It acts like a hash, an array, and an object.
[16:57:40] amar: has joined #ruby
[16:58:13] emilford: has joined #ruby
[16:58:16] nitric: has joined #ruby
[16:59:21] havenwood: >> require 'json/add/struct'; Point = Struct.new(:x, :y); JSON.load Point.new(42, 42).to_json
[16:59:22] ruby[bot]: havenwood: # => #<struct Point x=42, y=42> (https://eval.in/1010245)
[16:59:23] pilne: has joined #ruby
[16:59:48] yehdawg: has joined #ruby
[17:00:19] biberu: has joined #ruby
[17:00:35] ramfjord: has joined #ruby
[17:02:13] havenwood: >> require 'json/add/symbol'; JSON.load([:ok].to_json)
[17:02:14] ruby[bot]: havenwood: # => [:ok] (https://eval.in/1010253)
[17:02:28] yehdawg: hey I was trying to get into Ruby but don't really know where to start. Any recommendations of resources that helped you?
[17:02:31] havenwood: baweaver: Yeah, Struct is an interesting one.
[17:03:06] havenwood: yehdawg: https://ruby-community.com/pages/links
[17:03:07] havenwood: yehdawg: https://www.ruby-lang.org/en/documentation/
[17:03:14] havenwood: yehdawg: https://gist.github.com/baweaver/57a7c8296ca2c03effbd8fac1e7f6b40
[17:03:49] arne: has joined #ruby
[17:03:59] arne: is it true that if a method is called with a block and params
[17:04:06] havenwood: yehdawg: Once you get the basics, Exercism.io is a nice way to get feedback on challenges.
[17:04:15] arne: and i "overload" it, the block gets passed on implictly?
[17:04:19] havenwood: yadnesh: tryruby.org is a good thing to get started on
[17:04:24] havenwood: yadnesh: oops, MT
[17:04:36] sytherax: has joined #ruby
[17:05:04] arne: it's a bug.. nota feature :o
[17:05:06] havenwood: arne: Show an example of what you mean?
[17:05:07] havenwood: arne: When you say overload it, do you mean using?: super
[17:05:09] arne: https://bugs.ruby-lang.org/issues/6434
[17:05:14] arne: pretty much what is said there
[17:05:44] havenwood: arne: super without parens passes on args automagically
[17:05:50] havenwood: arne: super() with parens doesn't
[17:05:58] arne: havenwood: well, exactly that's what i expected
[17:06:11] arne: but super() will still send the block
[17:06:29] arne: and so will super(some_fancy_params*)
[17:06:48] havenwood: arne: yeah, that's true
[17:06:58] arne: wow, that really caught me offguard
[17:07:17] thinkpad: has joined #ruby
[17:08:54] yehdawg: @havenwood thank you!
[17:09:51] amar: has joined #ruby
[17:10:02] jenrzzz: has joined #ruby
[17:10:36] emilford: has joined #ruby
[17:12:54] NL3limin4t0r: yehdawg: The Ruby docs have also some documentation that pretty usefull when new to Ruby. See the first alinea of http://ruby-doc.org/core-2.5.1/ This however is not in tutorial form and just shows you things like controll expressions, assignment, etc.
[17:17:15] segy: has joined #ruby
[17:22:10] Immune: has joined #ruby
[17:22:18] yehdawg: has joined #ruby
[17:23:01] roshanavand: has joined #ruby
[17:24:18] apeiros: havenwood: I really wish they'd have put this into JSON.<something>_load instead of plain .load
[17:24:33] apeiros: that kind of thing is a primary source for security issues
[17:24:51] emilford: has joined #ruby
[17:24:57] Immune: has left #ruby: ()
[17:25:02] nachoman: has joined #ruby
[17:25:23] BTRE: has joined #ruby
[17:25:30] arashb: has joined #ruby
[17:27:11] beefjoe: has joined #ruby
[17:27:20] sytherax: has joined #ruby
[17:27:45] clemens3: has joined #ruby
[17:28:31] sytherax: has joined #ruby
[17:32:00] Puffball: has joined #ruby
[17:33:56] sanscoeur: has joined #ruby
[17:34:29] segy: has joined #ruby
[17:34:44] karapetyan: has joined #ruby
[17:36:22] mostlybadfly: has joined #ruby
[17:36:34] nitric_: has joined #ruby
[17:37:05] physicist__: has joined #ruby
[17:39:54] jrich523: has joined #ruby
[17:39:54] jyaworski: has joined #ruby
[17:40:18] jrich523: what are the things like %Q{} called?
[17:44:18] alfiemax: has joined #ruby
[17:44:22] jenrzzz_: has joined #ruby
[17:44:38] elomatreb: Percent-literals is the usual term I think
[17:46:34] jrich523: awesome, thanks
[17:47:08] Deesl: has joined #ruby
[17:47:28] jrich523: that got me to a pretty solid page, thanks! https://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Literals
[17:47:35] amar_: has joined #ruby
[17:50:21] chouhoulis: has joined #ruby
[17:50:40] xuyuheng: has joined #ruby
[17:50:52] ramfjord_: has joined #ruby
[17:53:19] cthulchu_: has joined #ruby
[17:54:58] cthulchu_: has joined #ruby
[17:55:15] havenwood: arne: I did a little Gist example showing the odd super keyword rules: https://gist.github.com/havenwood/3ca22b3e03a16509708002d6c3c13562
[17:55:15] segy: has joined #ruby
[17:55:51] havenwood: I do think Bongo and Wombat are little-known.
[17:55:59] mtkd: has joined #ruby
[17:56:00] arashb_: has joined #ruby
[17:56:37] cthulchu_: has joined #ruby
[17:56:39] rivalomega: has joined #ruby
[17:56:57] havenwood: Qux is a more widely-known idiosyncrasy of super.
[18:00:36] apeiros: havenwood: you should add `def foo(arg); arg = "changed"; super; end`
[18:05:51] bmurt: has joined #ruby
[18:09:51] tipyn: has joined #ruby
[18:11:42] chouhoulis: has joined #ruby
[18:12:51] amar: has joined #ruby
[18:13:31] Deesl: has joined #ruby
[18:13:36] amar: has joined #ruby
[18:18:36] xuyuheng: has joined #ruby
[18:22:44] sanscoeur: has joined #ruby
[18:24:37] Mike11: has joined #ruby
[18:25:54] mtkd: has joined #ruby
[18:28:58] segy: has joined #ruby
[18:29:12] alfiemax: has joined #ruby
[18:29:27] dviola: has joined #ruby
[18:31:24] donkey-hotei: has joined #ruby
[18:37:19] chouhoulis: has joined #ruby
[18:38:01] karapetyan: has joined #ruby
[18:38:42] xuyuheng: has joined #ruby
[18:39:55] donkey-hotei: Hello, I posted a ruby question on SO about Ruby's memoization operator and the null object pattern https://stackoverflow.com/questions/50535106/ruby-memoization-and-null-object-pattern
[18:40:08] donkey-hotei: Maybe ya'll rubyists have a clue ;-)
[18:42:06] alfiemax_: has joined #ruby
[18:42:34] chef_byd: has joined #ruby
[18:44:06] tAn: has joined #ruby
[18:44:55] tdy: has joined #ruby
[18:45:58] baweaver: donkey_hotei: Huh. That's interesting. I'd think overwriting `=` might do it.
[18:46:16] emilford: has joined #ruby
[18:46:36] chouhoulis: has joined #ruby
[18:46:51] baweaver: Give me a bit to play with it
[18:47:59] apeiros: donkey_hotei: no, you can't
[18:48:19] apeiros: || is syntax and it does not use any method on the object to identify falsiness. it uses object identity with nil/false
[18:50:04] apeiros: I'd do memoization with NullObjects like: `def initialize; @thing = NoThing.new; end; def memoized_thing; if @thing.none? then @thing = Thing.new end; @thing; end`
[18:50:17] apeiros: though honestly if you memoize, when would you actually use the NullObject?
[18:50:29] apeiros: and if you don't ever actually use it: just go with nil and ||=
[18:50:46] baweaver: donkey_hotei: also stay away from windmills
[18:51:07] apeiros: why? is the don not one of your idols?
[18:51:29] baweaver: Windmills did nothing wrong T_T
[18:51:55] apeiros: they're evil incarnate
[18:52:19] baweaver: Now I kinda want the ability to make something falsy...
[18:52:35] apeiros: you missed our earlier conversation about nullobjects then :)
[18:52:47] baweaver: donkey_hotei: You might enjoy the idea of Either.
[18:55:24] baweaver: donkey_hotei: https://medium.com/@baweaver/functional-programming-in-ruby-flow-control-565bbdcdf2a2
[18:56:01] baweaver: Option / Either / Maybe come from FP land, but do a lot more than a null object pattern.
[18:57:09] t0xik: has joined #ruby
[18:58:08] ramfjord: has joined #ruby
[19:01:48] segy: has joined #ruby
[19:02:25] tipyn: has joined #ruby
[19:06:10] donkey-hotei: apeiros: good point, for now I went with switching on class name instead of memoizing
[19:07:26] contradictioned: has joined #ruby
[19:08:08] donkey-hotei: baweaver: haha ;-) thanks for the link - always love seeing FP patterns in OOP
[19:08:21] emilford: has joined #ruby
[19:08:58] camilacott: has joined #ruby
[19:11:44] baweaver: There are a few more articles around it and I have a lot more on the way.
[19:12:00] duderonomy: has joined #ruby
[19:14:50] ModusPwnens: has joined #ruby
[19:15:31] ModusPwnens: can someone explain why I can't do "(".tr('(', '%28')? I can't find any documentation on this anywhere and its driving me nuts
[19:16:13] ModusPwnens: for some reason it unexpectly outputs "%" instead of "%28"
[19:17:34] elomatreb: String#tr substitues single characters
[19:17:51] elomatreb: It finds the matching index in the first argument, and replaces it with the corresponding index in the second
[19:18:09] elomatreb: gsub may be what you want
[19:18:19] ModusPwnens: Yeah, i'll have to resort to using gsub then
[19:19:00] xuyuheng: has joined #ruby
[19:21:49] emilford: has joined #ruby
[19:23:34] reber: has left #ruby: ("Leaving")
[19:23:56] mkroman: has joined #ruby
[19:26:37] jenrzzz: has joined #ruby
[19:26:38] jenrzzz: has joined #ruby
[19:28:01] shinnya: has joined #ruby
[19:28:19] baweaver: gsub also takes a hash second argument which is fun
[19:29:08] baweaver: >> '((fun))'.gsub(/[\(\)]/, '(' => '<', ')' => '>')
[19:29:09] ruby[bot]: baweaver: # => "<<fun>>" (https://eval.in/1010330)
[19:29:54] baweaver: Hm. Gsub tricks. That'll give me another 4-5 days
[19:30:49] apeiros: go through ruby core and you have enough for a year I think 😂
[19:30:56] apeiros: it's a great idea btw.
[19:34:17] mrush: has joined #ruby
[19:37:10] eckhardt_: has joined #ruby
[19:37:43] quobo: has joined #ruby
[19:39:06] xuyuheng: has joined #ruby
[19:40:58] KeyJoo: has joined #ruby
[19:42:56] karapetyan: has joined #ruby
[19:42:56] alfiemax: has joined #ruby
[19:43:14] GodFather: has joined #ruby
[19:44:55] sagax: has joined #ruby
[19:45:23] jenrzzz_: has joined #ruby
[19:45:45] eckhardt_: has joined #ruby
[19:46:28] conta: has joined #ruby
[19:48:57] jyaworski: has joined #ruby
[19:49:06] mtkd: has joined #ruby
[19:58:38] karapetyan: has joined #ruby
[19:59:12] xuyuheng: has joined #ruby
[20:01:09] ur5us: has joined #ruby
[20:03:30] alfiemax: has joined #ruby
[20:06:17] karapetyan: has joined #ruby
[20:08:51] tipyn_: has joined #ruby
[20:10:05] tag: has joined #ruby
[20:10:13] cthu|: has joined #ruby
[20:10:54] ipe: has left #ruby: ("Leaving")
[20:13:41] Deesl: has joined #ruby
[20:15:11] drakko: has joined #ruby
[20:19:10] desperek: has joined #ruby
[20:19:18] xuyuheng: has joined #ruby
[20:23:22] tAn: has joined #ruby
[20:23:25] dr3wo: has joined #ruby
[20:29:17] coderphive: has joined #ruby
[20:34:11] arashb: has joined #ruby
[20:34:40] alfiemax_: has joined #ruby
[20:37:25] f3ttX]: has joined #ruby
[20:39:25] xuyuheng: has joined #ruby
[20:49:05] sanscoeur: has joined #ruby
[20:52:37] eckhardt_: has joined #ruby
[20:57:38] Deesl: has joined #ruby
[20:59:29] xuyuheng: has joined #ruby
[21:03:41] sanscoeur: has joined #ruby
[21:03:56] banisterfiend: has joined #ruby
[21:11:08] mlkkk: has joined #ruby
[21:14:19] cyberg: has joined #ruby
[21:19:32] xuyuheng: has joined #ruby
[21:19:39] jenrzzz: has joined #ruby
[21:27:01] emilford: has joined #ruby
[21:31:29] wontruefree: has joined #ruby
[21:38:22] emilford: has joined #ruby
[21:39:36] xuyuheng: has joined #ruby
[21:42:20] wontruefree: has joined #ruby
[21:46:21] Immune: has joined #ruby
[21:47:03] jenrzzz: has joined #ruby
[21:47:03] jenrzzz: has joined #ruby
[21:47:34] chihhsin: has joined #ruby
[21:47:43] Immune: has left #ruby: ()
[21:48:27] emilford: has joined #ruby
[21:52:03] jenrzzz: has joined #ruby
[21:52:03] jenrzzz: has joined #ruby
[21:53:20] wontruefree: has joined #ruby
[21:55:47] emilford: has joined #ruby
[21:59:46] xuyuheng: has joined #ruby
[22:00:34] yokel: has joined #ruby
[22:00:41] ruby[bot]: has joined #ruby
[22:00:41] ChanServ: +o ruby[bot]
[22:01:19] emilford: has joined #ruby
[22:12:14] banisterfiend: has joined #ruby
[22:12:18] Glenjamin: has joined #ruby
[22:12:26] ciscam: has joined #ruby
[22:13:24] Glenjamin: Hi all, I'm getting an odd error from bundler, and it's proving very hard to google for, can anyone point me in the right direction?
[22:13:24] Glenjamin: Gem::FilePermissionError: You don't have write permissions for the
[22:13:24] Glenjamin: /var/folders/dl/n48gqs8s6fq81lxplt137spc0000gn/T/bundler20180525-69026-131qnmddiff-lcs-1.3/bin directory.
[22:13:25] Glenjamin: That dir is inside $TMPDIR, and doesn't seem to exist after the failure
[22:13:54] Paraxial: has joined #ruby
[22:14:08] Glenjamin: I do get prompted for sudo, but it fails anyway
[22:18:06] baweaver: Glenjamin: how did you install Ruby?
[22:18:12] baweaver: how do you normally install gems?
[22:18:16] emilford: has joined #ruby
[22:18:25] Glenjamin: OSX system ruby i think - first time i've used Ruby on this laptop
[22:18:26] baweaver: Can you run `which ruby`, `ruby -v`
[22:18:45] Glenjamin: > which ruby; ruby -v
[22:18:46] Glenjamin: /usr/bin/ruby
[22:18:46] Glenjamin: ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
[22:18:59] baweaver: Gotcha. It's old enough that I'd probably avoid it
[22:19:01] baweaver: they upgraded
[22:19:01] Glenjamin: bundler installed via `sudo gem install bundler`
[22:19:07] baweaver: Anyways, one sec, got a guide for OSX
[22:19:07] jyaworski: has joined #ruby
[22:19:12] cthulchu_: has joined #ruby
[22:19:14] baweaver: Remember that sudo and your user are different
[22:19:27] baweaver: meaning anything you try and get path to afterwards is different, including ruby version and the rest of it
[22:19:43] baweaver: https://ryanbigg.com/2015/06/mac-os-x-ruby-ruby-install-chruby-and-you
[22:19:48] xuyuheng: has joined #ruby
[22:19:50] baweaver: That should get you on a stable version.
[22:19:55] baweaver: Latest is 2.5.1 on Ruby
[22:20:03] baweaver: but the instructions are pretty well the same.
[22:20:14] Glenjamin: ah ok, ta - i'll try an up-to-date ruby
[22:20:36] venmx: has joined #ruby
[22:20:59] baweaver: Yeah, anything that sudo installs a gem is a mess waiting to happen, because then you have an arms race of always needing it to do anything
[22:21:00] baweaver: especially because sudo will root own everything it touches on that
[22:21:02] baweaver: which is likely the cause of your problems
[22:24:23] Glenjamin: but the symptoms don't match that
[22:24:43] Glenjamin: bundler correctly prompts for sudo to try and install into the system gem folder, and the permissions error is on a tempdir
[22:25:11] Glenjamin: i'm thinking this might be because of the version of rubygems that comes with 2.3.0 though
[22:26:04] emilford: has joined #ruby
[22:28:43] Glenjamin: hrm, I've added some debug logging into bundler to help understand the issue more - the generated tempdir itself is user-owned, but the `bin` dir inside it is root owned
[22:30:33] zenspider: can anyone confirm that bbatsov/rubocop doesn't have a clean test run out of the box (I *just* checked out)
[22:31:06] jenrzzz: has joined #ruby
[22:32:41] zenspider: ah. and it appears that it is literally running the tests twice and doco and and and when you run the default task.
[22:33:43] Glenjamin: aha, found it - it's a bug in bundler that only kicks in under weird circumstances
[22:34:07] havenwood: zenspider: cloned and run locally with 2.5.1, seeing two test runs and both passing with pendings
[22:34:22] havenwood: zenspider: 21700 examples, 0 failures, 6 pending
[22:34:59] Glenjamin: https://github.com/bundler/bundler/blob/master/lib/bundler/source/rubygems.rb#L138-L147
[22:35:44] zenspider: havenwood: thanks. I'm seeing that too. Is there a cheap/easy way to filter out the pendings so I don't even see them?
[22:36:07] Glenjamin: if `requires_sudo?` is true, and rubygems is < 2.7.5, then it runs `mkdir_p bin_path`, but internally that also checks `requires_sudo?` and makes the dir as root
[22:36:09] zenspider: WHAT I REALLY WANT: a good ruby project that uses rspec idiomaticall and dosn't have nasty external dependencies
[22:36:48] zenspider: preferably faster than these... 45 seconds for the one run is a bit much... totally doable... I could also just run a subset
[22:38:13] emilford: has joined #ruby
[22:39:53] xuyuheng: has joined #ruby
[22:40:07] zenspider: time rspec spec/rubocop/formatter/ # => 2.88 seconds. that's doable
[22:40:18] zenspider: but man... 2.88 seconds for 1.12 seconds worth of tests. WTF?+
[22:40:29] jmux: has joined #ruby
[22:41:22] zenspider: "files took 1.04 seconds to load"... that means 25% of the time is unaccounted for
[22:41:44] zenspider: has joined #ruby
[22:41:46] havenwood: zenspider: Seems there's not an RSpec option to silence pending, so you'd need a custom formatter: https://github.com/rspec/rspec-core/issues/2377
[22:43:01] zenspider: I'd rather just cut them out
[22:43:14] zenspider: but for now, I can run those formatter tests and get 90% of what I need for now
[22:44:56] Glenjamin: wrote up the bundler issue as https://github.com/bundler/bundler/issues/6555 in case anyone was following along with interest :)
[22:45:36] zenspider: just running one file: (1.715−0.051−0.989)/1.715 = ~40% unaccounted for... why is rspec SO heavy?
[22:46:24] ogres: has joined #ruby
[22:47:43] zenspider: consistently 25-40% overhead for the smaller sets
[22:48:21] cthu|: has joined #ruby
[22:49:47] ur5us: has joined #ruby
[22:51:08] emilford: has joined #ruby
[22:51:28] zenspider: havenwood: if you just run `rspec spec/cop` do you get 2 failures + 6 pending?
[22:51:54] mostly-harmless: has joined #ruby
[22:53:08] havenwood: zenspider: with `bundle exec rspec spec/rubocop` I got: 21682 examples, 0 failures, 6 pending
[22:53:41] havenwood: (i don't have a spec/cop, using clone of master)
[22:54:07] zenspider: `gem list rspec-rails` has output for you, I assume?
[22:54:27] zenspider: looks like they depend on it in the tests, but don't declare it to bundler
[22:57:35] GodFather: has joined #ruby
[22:58:36] emilford: has joined #ruby
[23:00:02] xuyuheng: has joined #ruby
[23:00:54] havenwood: zenspider: nope, I don't have it installed
[23:01:16] havenwood: gem which rspec-rails #!> ERROR: Can't find Ruby library file or shared library rspec-rails
[23:01:50] zenspider: huh! I wonder why I'm seeing that. doesn't matter. Anything noisy I'm just gonna cut out. there are ~22k specs here. I've got plenty to poke at.
[23:04:57] mostly-harmless: has joined #ruby
[23:05:52] emilford: has joined #ruby
[23:06:09] capellaS7: has joined #ruby
[23:08:57] chouhoulis: has joined #ruby
[23:11:10] emilford: has joined #ruby
[23:12:24] orbyt_: has joined #ruby
[23:25:01] ciscam: has joined #ruby
[23:25:14] emilford: has joined #ruby
[23:35:20] emilford: has joined #ruby
[23:37:27] go|dfish: has joined #ruby
[23:47:58] herbmillerjr: has joined #ruby
[23:54:24] white_lilies: has joined #ruby
[23:54:29] karapetyan: has joined #ruby
[23:56:44] shortdudey123_: has joined #ruby