<RickHull>
but looking to slurp a C file, not translate it by hand
<RickHull>
or read the object file or whatever
<RickHull>
again, apologize for any misunderstandings on the C/Posix side of things
<al2o3-cr>
no worries
DLSteve has quit [Quit: All rise, the honorable DLSteve has left the channel.]
<RickHull>
i am thinking to dlload or dlopen something. or not the right idea?
<zenspider>
"random" numbers w/o duplication aren't really random... they're nonrandom numbers shuffled with even distribution
<al2o3-cr>
dlopen or dlload with only open the library
<RickHull>
i think the goal is unpredictable
<zenspider>
RickHull: "though shuffling itself can be grossly inefficient"... care to back that up? compared to what?
<RickHull>
an oracle I guess :)
<RickHull>
I have seen it used inefficiently, as the wrong choice of algorithm
<RickHull>
i was hedging whether shuffling a sequence would actually be a good idea in this case
nofxx has quit [Remote host closed the connection]
nofxx has joined #ruby
nofxx has joined #ruby
nofxx has quit [Changing host]
<zenspider>
so not grossly inefficient. just misused in places. big difference
kht has quit [Ping timeout: 258 seconds]
<RickHull>
zenspider, btw, got any advice for trying to "automagically" determine the byte size of e.g. kernel's timeval struct from ruby?
<RickHull>
what I am really trying to do is determine whether an input event from /dev/input is 16 bytes or 24 bytes
<RickHull>
dynamically slash properly
<RickHull>
mostly as an exercise
<RickHull>
all of my searching told me it should be 16 bytes, but on my system it is 24 bytes, and it looks like that's because timeval is 16 bytes on a 64 bit platform
<RickHull>
I'd like to drill down and confirm that from ruby
hahuang65 has joined #ruby
<RickHull>
can I read some headers or object files from the system and do a sizeof?
<RickHull>
er, not I -- programatically :)
nvms has joined #ruby
ur5us has quit [Ping timeout: 256 seconds]
rfoust has joined #ruby
username_ has joined #ruby
<al2o3-cr>
RickHull: use Array#pack then
<al2o3-cr>
>> [1,2].pack('QQ').size
<RickHull>
yeah, that's what I was thinking at first
<RickHull>
if your project wants to use ruby 2.1, and ruby 2.1 is not availble or installed, perhaps that is what it means?
<lucz>
RickHull: when I run the bundle exec command in the second link I get the error
despai has joined #ruby
nankyokusei has joined #ruby
<RickHull>
i think you're going to need to get help from discourse
x0f has quit [Ping timeout: 258 seconds]
<lucz>
RickHull: it looks like ruby 2.1 isn't even an option for me to install
<RickHull>
yeah, I would take a step back for second
<lucz>
RickHull: I have 1.9.3
<RickHull>
what OS ?
markholmes has quit [Ping timeout: 255 seconds]
<lucz>
ubuntu 14.04
<RickHull>
it may be that their script doesn't support ubuntu 14.04
<RickHull>
though I would be surprised
skweek has quit [Ping timeout: 255 seconds]
<RickHull>
also, ruby 2.x should be available on that system
x0f has joined #ruby
Rodya_ has quit [Remote host closed the connection]
<RickHull>
are you a ruby programmer? how familiar are you with the ruby ecosystem?
<RickHull>
if yes and very, it's possible you could hack this together. but I'm guessing you will need support from the discourse guys
hlmjr has quit [Quit: Konversation terminated!]
herbmillerjr has joined #ruby
nankyokusei has quit [Ping timeout: 255 seconds]
<RickHull>
my guess is that you have taken a step or 2 off the happy path. and it will be better to step back to find the happy path rather than proceed forward
<lucz>
RickHull: I would much prefer the happy path.
Guest3878 is now known as ged
<RickHull>
welcome to the club xD
<lucz>
RickHull: lol
ged is now known as Guest99282
<RickHull>
"We highly recommend to read the script before performing import, as the script is meant for developers, and you will almost certainly need to modify the script file before beginning."
<RickHull>
but I bet ruby2 or similar is available
<lucz>
ya know you shouldn't always assume you're talking to a dude :)
<RickHull>
my apologies :)
<lucz>
RickHull: np ;)
nofxx has quit [Remote host closed the connection]
<RickHull>
in my head you wield a lightsaber
<Radar>
thanks lucz
nofxx has joined #ruby
<lucz>
RickHull: fantastic
<Radar>
I don't know why Bundler is giving you that error at all. mri_21 isn't specified in the Gemfile.
<lucz>
Radar: this was my confusion as well
saneax is now known as saneax-_-|AFK
<Radar>
Trying to pull down Discourse source now to grep through it but it's quite large.
<lucz>
Radar: it's a bit of a beast
<lucz>
Radar: also very fragile
<lucz>
Radar: gets upset easily
<RickHull>
i was thinking to make a trivial bundler project and start from there
alexar has joined #ruby
tercenya has quit [Remote host closed the connection]
<RickHull>
see what bundler is bringing to the table on its own
<Radar>
RickHull: I don't think that would work. The problem is the Gemfile from Discourse.
<Radar>
You could try copying over the Gemfile from Discourse into a new directory and running `bundle install`, but you'd probably end up with the same problem.
tercenya has joined #ruby
whathappens has quit [Remote host closed the connection]
SteenJobs has quit [Quit: SteenJobs]
nullfxn has quit [Quit: leaving]
Rodya_ has quit [Remote host closed the connection]
notnadir has quit [Quit: Connection closed for inactivity]
<Radar>
fwiw, `bundle install` works fine for me running Ruby 2.3.3 locally.
<lucz>
Radar: I tried that already :(
<RickHull>
maybe worth chruby now :)
<Radar>
lucz: Tried copying over the Gemfile?
<lucz>
RickHull: Radar ok I'll give that a go
<lucz>
Radar: ya
<Radar>
lucz: Ok then. Follow that guide to install Ruby 2.3.3 and try again.
markholmes has quit [Ping timeout: 255 seconds]
username_ has quit [Ping timeout: 276 seconds]
mholmes has joined #ruby
<Radar>
lucz: uninstall the current version of Ruby you have installed first.
redhedded1 has quit [Ping timeout: 252 seconds]
<RickHull>
eh, may not want to `apt remove ruby`
LoneHermit has joined #ruby
alexar_ has joined #ruby
Rodya_ has joined #ruby
<RickHull>
you can leave your apt ruby stuff in place
frozengeek__ has quit [Quit: frozengeek__]
<RickHull>
chruby and ruby-install will let you have your own ruby and ecosystem, purely local to your user in $HOME
Guest43 has joined #ruby
Guest43 has quit [Changing host]
Guest43 has joined #ruby
<RickHull>
as long as you hook chruby first when you log in, then you will use your local ruby/rubies
alexar has quit [Ping timeout: 255 seconds]
<RickHull>
sorry, I haven't read the paste -- maybe I'm barking up the wrong tree, dropping out :)
LoneHermit has quit [Ping timeout: 264 seconds]
raul782 has quit []
alxs has joined #ruby
maleghast has joined #ruby
<lucz>
RickHull: so I should or shouldn't do all that?
<RickHull>
you shouldn't need to apt remove anything ruby related
<RickHull>
doing so would probably be very disruptive
marr has quit [Ping timeout: 264 seconds]
<RickHull>
let apt do apt, and you can do ruby on your own with chruby and ruby-install
Channel6 has joined #ruby
<RickHull>
it's kind of a longstanding problem, in that apt wants to manage ruby but doesn't do a good job of it
dgarstang has joined #ruby
<RickHull>
that way, ubuntu can rely on apt's ruby
<lucz>
"Under no circumstance should you install Ruby, Rubygems or any Ruby-related packages from apt-get. This system is out-dated and leads to major headaches. Avoid it for Ruby-related packages. We do Ruby, we know what's best. Trust us."
<lucz>
lol
<RickHull>
and your dev projects can use chruby
<RickHull>
apt's ruby is good for the system to use
<RickHull>
it's not good for projects
<lucz>
RickHull: noted
<RickHull>
what instructions are you following for chruby?
nofxx has quit [Remote host closed the connection]
<RickHull>
keep both pages open
<RickHull>
the blog post is more comprehensive -- a great reference
<RickHull>
but keep in mind it can get out of date
<lucz>
RickHull: thank you :)
<RickHull>
so for every action, refer back to the github page
<RickHull>
and see if there is an update
nofxx has joined #ruby
hutch34 has joined #ruby
<RickHull>
for example, don't use the 2+ year old versions
<lucz>
Right
<RickHull>
one step that can be easy to miss is adding it to your login file, and then making sure your active session has it loaded. it's trivial, but easy to miss
<RickHull>
e.g. .bashrc
__Yiota has joined #ruby
workmad3_ has quit [Ping timeout: 260 seconds]
workmad3 has joined #ruby
<lucz>
what's the best way to do that?
<RickHull>
it's in the instructions
doug2 has joined #ruby
<RickHull>
both of them I'm sure
hutch34 has quit [Ping timeout: 258 seconds]
nvms has joined #ruby
dgarstang has quit [Ping timeout: 264 seconds]
nvms has quit [Client Quit]
coffeecupp has joined #ruby
strongcode has quit [Quit: Changing server]
weaksauce has joined #ruby
strongcode has joined #ruby
nvms has joined #ruby
coldfront has joined #ruby
kht has quit [Ping timeout: 255 seconds]
jenrzzz has quit [Ping timeout: 260 seconds]
brent__ has quit [Remote host closed the connection]
P_R_Deltoid has joined #ruby
<P_R_Deltoid>
What is the best practice for grouping a few variables together into a bundle without the use of a class?
<P_R_Deltoid>
I was thinking a dictionary or hash, but is that best practice?
<RickHull>
best to give an example. do you have a file you can paste?
<P_R_Deltoid>
Just trying to bundle the "userid" variable with "command" before handing it out to the rest of the problem
<P_R_Deltoid>
program*
kht has joined #ruby
jameser has joined #ruby
<Radar>
[12:23:11] <RickHull>note that's over 2 years old. it's a good starting point and is probably fine
<RickHull>
hashes are fine, but you have to be somewhat disciplined. you can graduate to some form of struct and then a class if you want more rigid behavior
<Radar>
First line in the blog post: Last updated: 28th January 2016
<Radar>
You were saying?
<RickHull>
ah nice
<Radar>
Like, did you not even open the page at all?
prawnzy has joined #ruby
<RickHull>
I skimmed the code sections :)
antoniobeyah has quit [Quit: Connection closed for inactivity]
<RickHull>
still that's almost a year ago :)
coffeecu1p has joined #ruby
gusrub has quit [Remote host closed the connection]
<RickHull>
P_R_Deltoid, when I use hashes like this, I like to use Hash#fetch to make sure they have the expected keys
eizua has joined #ruby
<P_R_Deltoid>
Fetch creates an exception when the key doesn't exist?
<RickHull>
yep
<RickHull>
I never rescue them. if that ever gets raised, something is broken. you use fetch only on required fields of course
SeepingN has quit [Ping timeout: 240 seconds]
<RickHull>
so you wouldn't use fetch in this code, but in the notify_observers definition
chouhoulis has joined #ruby
<RickHull>
that said, your app and development style have to be able to tolerate runtime validation and exceptions
<RickHull>
but that's clearly better than no runtime validation
kht has quit [Ping timeout: 255 seconds]
benlieb has joined #ruby
<RickHull>
I've seen many hash-passing styles with no validation that end up with unexpected nils everywhere
ur5us has joined #ruby
alxs has quit [Ping timeout: 276 seconds]
coffeecu1p has quit [Quit: leaving]
coffeecu1p has joined #ruby
splud has quit [Quit: splud]
Guest99282 is now known as ged
<P_R_Deltoid>
Not a bad idea to be careful that way, no sweat off my back
<P_R_Deltoid>
Thanks for the help, RickHull
<P_R_Deltoid>
Got it all working now
Rodya_ has quit [Remote host closed the connection]
ged is now known as Guest25050
coffeecu1p has quit [Quit: leaving]
Devalo has joined #ruby
94KAAB8QJ has joined #ruby
<lucz>
RickHull: I'm going to have a go at this tomorrow, my brain is fried now. Thanks for all your help (and Radar)
<Radar>
no worries lucz :) See you tomorrow.
<lucz>
I may loiter in here tomorrow and poke you guys if it doesnt work :D
<RickHull>
how far did you get lucz ?
<lucz>
RickHull: I didn't, I got pulled away by a director stamping his feet
workmad3_ has joined #ruby
<lucz>
RickHull: always fun
alexar_ has quit [Remote host closed the connection]
<RickHull>
Mondays...
<lucz>
RickHull: indeed
94KAAB8QJ has quit [Remote host closed the connection]
workmad3 has quit [Ping timeout: 258 seconds]
Devalo has quit [Ping timeout: 252 seconds]
coffeecu1p has joined #ruby
coffeecu1p has quit [Client Quit]
coffeecupp has joined #ruby
nofxx has quit [Remote host closed the connection]
nofxx has joined #ruby
nofxx has quit [Changing host]
nofxx has joined #ruby
whathappens has joined #ruby
govg has quit [Ping timeout: 264 seconds]
ur5us has quit []
prawnzy has quit [Remote host closed the connection]
benlieb has quit [Quit: benlieb]
maloik has quit [Remote host closed the connection]
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
maloik has joined #ruby
coffeecupp has quit [Client Quit]
workmad3_ has quit [Ping timeout: 240 seconds]
ecuanaso has joined #ruby
gusrub has joined #ruby
SteenJobs has joined #ruby
dogweather has quit [Remote host closed the connection]
SteenJobs has quit [Client Quit]
gusrub has quit [Ping timeout: 255 seconds]
prawnzy has joined #ruby
montanonic has joined #ruby
hanmac has quit [Ping timeout: 258 seconds]
tvw has quit [Ping timeout: 255 seconds]
StoneCypher has joined #ruby
dogweather has joined #ruby
jenrzzz has joined #ruby
dogweath_ has joined #ruby
chouhoulis has quit [Remote host closed the connection]
dogweath_ has quit [Remote host closed the connection]
dogweath_ has joined #ruby
StoneCypher has quit [Ping timeout: 258 seconds]
dogweather has quit [Ping timeout: 276 seconds]
dogweath_ has quit [Client Quit]
alexar has joined #ruby
Ruby_Rocks_007 has quit [Quit: Ruby_Rocks_007]
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jrafanie has joined #ruby
astrobunny has joined #ruby
guacamole has quit [Quit: leaving]
ur5us has joined #ruby
guacamole has joined #ruby
alexar has quit [Ping timeout: 256 seconds]
brent__ has joined #ruby
hanmac has joined #ruby
bkxd has joined #ruby
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
astrobunny has quit [Remote host closed the connection]
ecuanaso has joined #ruby
brent__ has quit [Ping timeout: 255 seconds]
nankyokusei has joined #ruby
swills has quit [Read error: Connection reset by peer]
workmad3 has joined #ruby
swills has joined #ruby
amclain has quit [Quit: Leaving]
redhedded1 has joined #ruby
nankyokusei has quit [Ping timeout: 255 seconds]
petrichorx_ has joined #ruby
d^sh has quit [Ping timeout: 240 seconds]
gusrub has joined #ruby
d^sh has joined #ruby
LoneHerm_ has joined #ruby
despai has quit [Quit: Connection closed for inactivity]
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Devalo has joined #ruby
<havenwood>
RickHull: How about?: sudo chruby-exec ruby-2.3 -- devsniff /dev/input/event0
<RickHull>
i'm workign around it at the moment with sudo ruby -Ilib bin/devsniff
<havenwood>
RickHull: Or `sudo -s` then source chruby and set your Ruby and run the command.
Ruby_Rocks_007 has joined #ruby
<RickHull>
(bypassing the gem, using the working dir on filesystem)
<RickHull>
let me try those in a sec, thx
ifctj has joined #ruby
Devalo has quit [Ping timeout: 240 seconds]
AnoHito_ has joined #ruby
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
govg has joined #ruby
AnoHito has quit [Ping timeout: 240 seconds]
xall_ has quit [Read error: No route to host]
troys has quit [Quit: Bye]
xall_ has joined #ruby
wugy has joined #ruby
wugy has quit [Excess Flood]
wugy has joined #ruby
wugy has quit [Excess Flood]
Rodya_ has joined #ruby
wugy has joined #ruby
wugy has quit [Excess Flood]
wugy has joined #ruby
wugy has quit [Excess Flood]
Rodya_ has quit [Ping timeout: 255 seconds]
LoneHerm_ has quit [Remote host closed the connection]
nug has quit [Ping timeout: 240 seconds]
unshadow has quit [Quit: leaving]
gnarld_ has joined #ruby
benlieb has quit [Quit: benlieb]
nowz has joined #ruby
bkxd has quit [Ping timeout: 260 seconds]
Zamyatin has quit [Quit: Knocking out. Peace y'all...]
nvms has quit [Quit: This computer has gone to sleep]
nvms has joined #ruby
teclator has joined #ruby
tpendragon has joined #ruby
nvms has quit [Client Quit]
Ruby_Rocks_007 has left #ruby [#ruby]
nvms has joined #ruby
Guest71727 is now known as ged
ged is now known as Guest64694
brent__ has joined #ruby
nankyokusei has joined #ruby
brent__ has quit [Ping timeout: 276 seconds]
ur5us has joined #ruby
nankyokusei has quit [Ping timeout: 252 seconds]
montanonic has joined #ruby
kazlock has joined #ruby
kazlock_ has joined #ruby
kazlock has left #ruby [#ruby]
lxsameer has joined #ruby
<kazlock_>
Hi, I'm trying to write a Rake task to render an erb template with parameters from a json file, is there a simple way to do this?
matp has quit [Remote host closed the connection]
maleghast has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
matp has joined #ruby
<dminuoso>
kazlock_: Show us what you have tried so far.
<dminuoso>
kazlock_: Don't let your erb template know about JSON or files though. Do that before you start rendering the erb template.
<dminuoso>
Load the file, deserialize your objects and transform them into parameters (after whatever white/blacklisting you require), and then render your template.
ruby-lang710 has joined #ruby
dionysus69 has joined #ruby
<kazlock_>
dminuoso: I was able to load the parameters, the trouble is converting them to a binding for ERB.result
<dminuoso>
RickHull: That diagram explains which files get sourced under which conditions. So the matter of where you need to load chruby depends on what kind of shell you have.
ta__ has quit [Remote host closed the connection]
<RickHull>
dminuoso, right -- my user is all set
<RickHull>
my user has a gem installed, which includes an executable
<RickHull>
sudo that_exe # doesn't work
<RickHull>
for semi-obvious reasons
<RickHull>
in the past, sudo `which that_exe` would work for me
<RickHull>
but i think the bin stubs or bin activation works differently now
<dminuoso>
kazlock_: Does the object actually have an instance variable @required_plugins ?
<kazlock_>
dminuoso: I was trying to figure out how to check the variables in the binding before I came here
Mr_Pancake has joined #ruby
<dminuoso>
kazlock_: It may be easier to not pry into an object like you did with instance_eval
ddffg has joined #ruby
hutch34 has quit [Ping timeout: 256 seconds]
<dminuoso>
kazlock_: Provide a wrapper class that a) has a get_binding method, and b) has some accessors or instance variables that you can then use directly inside your erb once you pass the wrapper class objects binding.
jameser has joined #ruby
<dminuoso>
Does this make any sense?
<kazlock_>
dminuoso: changing @required_plugins => required_plugins fixed it O_o
<dminuoso>
kazlock_: Yes, because @required_plugins is a specific instance variable that the object does not have.
Ishido has joined #ruby
minimalism has quit [Quit: minimalism]
<kazlock_>
I see
<dminuoso>
kazlock_: when you do foo.bar it doesn't impliciltly do a foo.instance_variable_get(:@bar), but foo.send(:bar)
<RickHull>
that particular bit of UX with ERb seems unfortunate to me. it kind of does what you think but really not
<dminuoso>
kazlock_: Do you have pry?
<kazlock_>
I don't have enough ruby experience to fully understand what you just said
<dminuoso>
kazlock_: It may be much much easier if you have pry.
<kazlock_>
what is pry?
<dminuoso>
kazlock_: It's like irb except tons better.
<dminuoso>
It's half a debugger basically
<kazlock_>
Oh I've heard of pry
nowz has quit [Remote host closed the connection]
<dminuoso>
kazlock_: You can then "cd params" and then inspect the object from inside its context
<dminuoso>
view what methods it has
<dminuoso>
view what instance variables it has
<dminuoso>
Amongst many other things
nowz has joined #ruby
<dminuoso>
kazlock_: If you explire this yourself, it may become immediately obvious. :)
<dminuoso>
RickHull: First, running ruby stuff under root it something you should not do or want.
<RickHull>
it is if I'm reading /dev/input :)
<dminuoso>
RickHull: So can we first establish the actual need to run ruby as root, before I tell you how?
nowz has quit [Remote host closed the connection]
<RickHull>
i can set up a chruby for root, but really I'm interested in sudo working as expected with chruby'd executables
<RickHull>
it's a bug in chruby IMHO
<RickHull>
or a notable, at least
<dminuoso>
roger_rabbit: Change the permissions in udev or whatever you are using.
<dminuoso>
RickHull: I mean
<RickHull>
sure, I know how to work around it
<dminuoso>
RickHull: Using root just because the permissions of the file are "wrong" is dangerous and not something you should get accustomed to.
<RickHull>
thanks...
<kazlock_>
dminuoso, thanks for your help, I'll check out pry some time
<dminuoso>
RickHull: The way that chruby works is by just modifying PATH. Where does that_exe lie in?
<RickHull>
just to make sure you're not barking up the wrong tree...
<RickHull>
everything works fine for my regular user
_djbkd has quit [Quit: My people need me...]
gnarld_ is now known as nug
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<RickHull>
but it's at /home/rwh/.gem/ruby/2.4.0/bin/devsniff
<RickHull>
the problem is that when sudo tries to execute this file, the bin activation breaks
sebastiansier has quit [Read error: Connection reset by peer]
davezd has joined #ruby
saneax-_-|AFK is now known as saneax
frozengeek__ has quit [Quit: frozengeek__]
govg has quit [Ping timeout: 260 seconds]
nowz has joined #ruby
nowz has quit [Remote host closed the connection]
montanonic has quit [Ping timeout: 240 seconds]
nowz has joined #ruby
TomyLobo has joined #ruby
dhollinger has quit [Ping timeout: 245 seconds]
James123 has joined #ruby
SesMan has joined #ruby
nowhere_man has joined #ruby
blaxter has quit [Quit: foo]
dhollinger has joined #ruby
minimalism has joined #ruby
dionysus69 has quit [Remote host closed the connection]
teclator has quit [Ping timeout: 252 seconds]
govg has joined #ruby
McSoFake has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
agit0 has joined #ruby
electrostat has quit [Quit: uwotm8]
antgel has joined #ruby
Burgestrand has joined #ruby
Cohedrin_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
BTRE has quit [Ping timeout: 240 seconds]
nankyokusei has joined #ruby
BTRE has joined #ruby
frozengeek__ has joined #ruby
electrostat has joined #ruby
nankyokusei has quit [Ping timeout: 240 seconds]
tvw has joined #ruby
minimalism has quit [Quit: minimalism]
BTRE has quit [Ping timeout: 260 seconds]
zacts has quit [Quit: WeeChat 1.7]
coffeecupp has joined #ruby
flying has joined #ruby
mikecmpbll has joined #ruby
agit0 has quit [Read error: No route to host]
BTRE has joined #ruby
ta has joined #ruby
nvms has quit [Quit: This computer has gone to sleep]
hutch34 has joined #ruby
al2o3-cr has quit [Quit: WeeChat 1.7]
Guest43060 is now known as ged
Rodya_ has joined #ruby
ged is now known as Guest21103
blackmes1 has joined #ruby
vuoto has joined #ruby
Cohedrin_ has joined #ruby
rajat has joined #ruby
Rodya_ has quit [Ping timeout: 252 seconds]
al2o3-cr has joined #ruby
jeffmess has joined #ruby
<jeffmess>
Hey guys, I’m about to begin integrating our product with a 3rd party service, they seem to require us sending tcp packets over ipsec. Sys admin and networking is not my strong suit, should I be setting up port forwarding so that when my app makes calls via tcp it forwards those connections through the ipsec connection? I would also like to have this setup inside a docker container so I can easily move from our test server to our productio
<jeffmess>
n machines. Aside from the port forwarding has anyone dealt with anything like this before?
<RickHull>
not really a #ruby question...
hutch34 has quit [Ping timeout: 252 seconds]
astrobunny has quit [Remote host closed the connection]
Mia has joined #ruby
teclator has joined #ruby
<RickHull>
but it sounds fairly reasonable on its face, though I don't know about the ipsec stuff.
Axy has quit [Ping timeout: 248 seconds]
Moosashi has quit [Quit: Moosashi]
smswmedia has joined #ruby
rkazak has joined #ruby
P_R_Deltoid has quit [Quit: Leaving]
charliesome has joined #ruby
zacts has joined #ruby
xall_ has quit [Read error: Connection reset by peer]
meshsmith has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
xall_ has joined #ruby
coffeecupp has quit [Quit: leaving]
JeanCarloMachado has joined #ruby
coffeecu1p has joined #ruby
nettoweb has joined #ruby
coffeecu1p has quit [Client Quit]
charliesome has joined #ruby
<jeffmess>
thx RickHull, I know it's not a ruby question but when I ask sysadmins they start asking what firewalls and stuff I have running.
<bartzy>
Can anyone explain a few basic concepts? For example, what `rgba = color1.rgb.zip(color2.rgb).map {|v1, v2| v1 * w1 + v2 * w2}` means, and what `<<` means in this context: `rgba << color1.alpha * p + color2.alpha * (1 - p)`
Guest21103 is now known as ged
ged is now known as Guest82778
pandaant has joined #ruby
JeanCarloMachado has joined #ruby
jameser has quit [Ping timeout: 276 seconds]
<RickHull>
zip means to take two arrays and interleave them into one array
<RickHull>
(kind of like the two halves of a zipper coming together)
<RickHull>
so we're making rgba by zipping up color1 and color2
<RickHull>
then map means to consider each item of the array (or collection)
<bartzy>
why does it make rgba, if you took color1.rgb and color2.rgb
<bartzy>
ok, so what is v1,v2? I thought it should only have a single element?
<bartzy>
ok so now we have a flat array of floats in rgba
<bartzy>
what << means when the left operand is an array?
<tobiasvl>
for each element in color1.rgb and color2.rgb, combine those two elements together in a tuple, and then make an array of all the tuples. then for each of those tuples/pairs, do some arithmetic on them
<RickHull>
append to the array
<RickHull>
mutate it
<bartzy>
ok so they append the alpha component to the rgb they calculated
<bartzy>
awesome! Thanks :)
<tobiasvl>
yep, << is append for arrays
<bartzy>
Now let’s see how writing this in Swift works out ;)
<tobiasvl>
godspeed
<bartzy>
thanks
jsrn_ has joined #ruby
UnknownSoldier has joined #ruby
mim1k|work has quit [Ping timeout: 252 seconds]
<jokke>
hi
ur5us has quit [Remote host closed the connection]
mim1k|work has joined #ruby
unshadow has joined #ruby
biberu has joined #ruby
<jokke>
i've never done anything with jruby so i thought i'd just give it a try and bundled my project with jruby. i needed to add platforms: :ruby to some gems with native extensions but so far so good. However when i ran my specs i was surprised to see jruby performing _way_ worse than native ruby
<jokke>
the specs ran in 30secs as opposed to 5 secs in native ruby
<maleghast>
@jokke - You are probably paying for the JVM startup cost there... If you use one of the ways of keeping a JVM warm you should see comparable performance to MRI or perhaps better.
<RickHull>
ah cool, I thought I heard something like that, but I haven't been paying attention. just got back into a bit of ruby after a long layoff :)
nankyokusei has quit [Ping timeout: 256 seconds]
blackmes1 has joined #ruby
djbkd_ has joined #ruby
<jokke>
hmm i tried nailgun server
<jokke>
but it doesn't seem to run in the bundle
<jokke>
i get errors like LoadError: no such file to load -- rspec/core/rake_task
jenrzzz has quit [Ping timeout: 258 seconds]
<jokke>
and jruby -G --ng-server doesn't work either
<jokke>
Exception in thread "main" java.lang.RuntimeException: JRuby's Nailgun server can only receive arguments via -X or -J-D properties.
stan has quit [Read error: Connection reset by peer]
nowz has quit [Remote host closed the connection]
xall_ has quit [Ping timeout: 240 seconds]
rkazak has quit [Quit: Sleep.....ing....]
TheWhip has quit [Read error: Connection reset by peer]
TheWhip_ has joined #ruby
stan has joined #ruby
<chrisseaton>
jokke: ask in #jruby (but a bit later in the day) and they'll help you with this
<jokke>
alright
<jokke>
thanks
<chrisseaton>
They're in US Eastern time zones
xen0fon has joined #ruby
Rodya_ has joined #ruby
aswen has joined #ruby
mim1k|work has quit [Ping timeout: 255 seconds]
hutch34 has joined #ruby
jshjsh has joined #ruby
mim1k|work has joined #ruby
Rodya_ has quit [Ping timeout: 255 seconds]
JoshS has quit [Ping timeout: 240 seconds]
Silthias has quit [Ping timeout: 240 seconds]
Silthias has joined #ruby
hutch34 has quit [Ping timeout: 276 seconds]
SesMan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Moosashi has joined #ruby
djbkd_ has quit [Ping timeout: 256 seconds]
xall_ has joined #ruby
Guest82778 is now known as ged
BackEndCoder has quit [Excess Flood]
ged is now known as Guest16813
vuoto has quit [Remote host closed the connection]
BackEndCoder has joined #ruby
StoneCypher has joined #ruby
StoneCypher has quit [Ping timeout: 252 seconds]
vuoto has joined #ruby
nahra has quit [Read error: Connection reset by peer]
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bigkevmcd has joined #ruby
hightower3 has quit [Ping timeout: 276 seconds]
polysics has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jhack has joined #ruby
jhack has quit [Client Quit]
nettoweb has joined #ruby
Ruby_Rocks_007 has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
djuber has quit [Ping timeout: 256 seconds]
jhack has joined #ruby
djbkd_ has joined #ruby
nofxxx has quit []
Ruby_Rocks_007 has quit [Ping timeout: 240 seconds]
Rodya_ has joined #ruby
frozengeek__ has quit [Quit: frozengeek__]
harfangk has joined #ruby
frozengeek__ has joined #ruby
SesMan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rodya_ has quit [Ping timeout: 240 seconds]
whiteline has quit [Remote host closed the connection]
whiteline has joined #ruby
ruby-lang664 has joined #ruby
polishdub has joined #ruby
patarr has joined #ruby
workmad3 has joined #ruby
rfoust has joined #ruby
whiteline has quit [Remote host closed the connection]
whiteline has joined #ruby
djbkd_ has quit [Ping timeout: 240 seconds]
malconis has joined #ruby
lmc has joined #ruby
ferr1 has quit [Quit: WeeChat 1.6]
<al2o3-cr>
chow for now
a1fa has quit [Remote host closed the connection]
al2o3-cr has quit [Quit: WeeChat 1.7]
a1fa has joined #ruby
<apeiros>
zombie chow? good card. good card. sad it's gone.
mostlybadfly has quit [Quit: Connection closed for inactivity]
DLSteve has joined #ruby
`tim` has joined #ruby
saslam has joined #ruby
__Yiota has joined #ruby
ben_____ has quit []
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Lord_of_Life has quit [Excess Flood]
gnufied has joined #ruby
ja_ has joined #ruby
maleghast has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cibs has quit [Ping timeout: 240 seconds]
<ja_>
Hi, Is there a way to call a Proc using a string or symbol?
malconis_ has joined #ruby
<herwin>
is there any connection between the proc and the string/symbol?
tomphp has quit [Read error: Connection reset by peer]
tomphp_ has joined #ruby
<ja_>
herwin: yep. the string is the name of an already defined Proc
bmurt has joined #ruby
<ja_>
I know I can use eval, by I try to avoid it
Lord_of_Life has joined #ruby
saslam has quit [Ping timeout: 255 seconds]
cibs has joined #ruby
patarr has quit [Ping timeout: 256 seconds]
jameser has joined #ruby
patarr has joined #ruby
malconis has quit [Ping timeout: 260 seconds]
`tim` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
andikr has joined #ruby
<apeiros>
ja_: procs don't have names
<apeiros>
ja_: you're probably referring to the variable name
<apeiros>
and if so, then you're trying to abuse the variable system as a hash. don't.
<apeiros>
the outside of a scope has zero business knowing the internals of your scope.
workmad3 has quit [Ping timeout: 240 seconds]
J_Darnley has joined #ruby
hutch34 has joined #ruby
<J_Darnley>
Where can I get help with this ruby bundle POS?
rippa has joined #ruby
<apeiros>
POS?
<J_Darnley>
piece of shit
nankyokusei has joined #ruby
`tim` has joined #ruby
<RickHull>
wow. rude
SesMan has joined #ruby
<apeiros>
oh. J_Darnley, a well meant tip: fix your attitude before seeking help. it doesn't do any good. you may well be pissed, maybe even for a good reason. but just don't.
<ja_>
apeiros: you are right
<apeiros>
J_Darnley: you can ask here, and I think bundler has its own channel too
Guest93415 is now known as ged
ged is now known as Guest61784
benlieb has joined #ruby
<apeiros>
ja_: maybe gist your code, so we can give you advice on how to restructure your problem?
<J_Darnley>
Then... I need to fix some problem with a "gem" that doesn't compile. How can I make bundle not overwrite the changes I make to the source when I execute `bundle install`
ciao has joined #ruby
ciao has left #ruby [#ruby]
<apeiros>
J_Darnley: you'll have to tell it in the Gemfile that it should use your local path instead of the global
<apeiros>
I assume you cloned the repository of the gem?
<J_Darnley>
No. I got it by runnig `bundle install`
Rodya_ has joined #ruby
<apeiros>
oh, you modified it in place? that's not supported.
workmad3 has joined #ruby
nankyokusei has quit [Ping timeout: 248 seconds]
<J_Darnley>
WTF
<apeiros>
either download the gem and unpack it into a directory, or clone the repo. fix it there. then tell bundler to use that directory via path/git option
<apeiros>
J_Darnley: I don't know of any package manager which will keep your modifications you made in place.
jrafanie has joined #ruby
<apeiros>
not really a WTF. you don't go manipulating packages which are under a package managers control.
<J_Darnley>
The OS's package manager would. Why the heck does this rubbish have its own?
<apeiros>
no, it won't. if you install a package, modify it, and reinstall the package, your changes are gone. if not, please tell me of that special package manager which handles things differently.
<J_Darnley>
Bollocks. I'll just roll back instead of trying to understand this insanity.
J_Darnley has left #ruby [#ruby]
* apeiros
should pay heed to the red flag that is bad attitude…
patarr has quit [Ping timeout: 256 seconds]
ReK2GnULinuX has quit [Ping timeout: 248 seconds]
<Papierkorb>
Looks like he's confusing ruby (C?) source code with config files (as in, they're usually not overwritten by packet managers) with the binaries (which are)
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
tomphp_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
`tim` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<apeiros>
Papierkorb: as I understood it, they patched the downloaded source
<Papierkorb>
That's what I got from it too
sdothum has joined #ruby
<apeiros>
anyway, I should stop trying to deal with people who behave like angry bulls.
<Papierkorb>
apeiros: You tried to help, there's nothing to be feel bad about from your end
patarr has joined #ruby
statelesscode has quit [Ping timeout: 240 seconds]
mikecmpbll has quit [Read error: Connection reset by peer]
frozengeek__ has quit [Quit: frozengeek__]
frozengeek__ has joined #ruby
tomphp has joined #ruby
statelesscode has joined #ruby
douglascorrea has quit [Ping timeout: 245 seconds]
ta has quit [Remote host closed the connection]
mikecmpbll has joined #ruby
<apeiros>
Papierkorb: thank you
sid_fules has joined #ruby
bkxd has joined #ruby
hs366 has joined #ruby
walterheck has quit [Ping timeout: 248 seconds]
`tim` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ecuanaso has joined #ruby
UserJosh has joined #ruby
patarr has quit [Ping timeout: 245 seconds]
ifctj has quit [Ping timeout: 240 seconds]
Xentil has joined #ruby
jshjsh has quit [Ping timeout: 245 seconds]
ifctj has joined #ruby
anisha has quit [Quit: Leaving]
blackbombay has quit [Ping timeout: 276 seconds]
xen0fon has quit [Quit: xen0fon]
tvw has quit [Remote host closed the connection]
cdg has joined #ruby
RickHull has quit [Ping timeout: 255 seconds]
djbkd_ has joined #ruby
bkxd has quit [Ping timeout: 276 seconds]
hs366 has quit [Quit: Leaving]
tercenya has quit [Remote host closed the connection]
tercenya has joined #ruby
xangria has joined #ruby
xangria has quit [Read error: Connection reset by peer]
djbkd_ has quit [Ping timeout: 255 seconds]
gnufied has quit [Remote host closed the connection]
ifctj has quit [Ping timeout: 255 seconds]
xangria has joined #ruby
unshadow has quit [Quit: leaving]
xen0fon has joined #ruby
xen0fon has quit [Client Quit]
gnufied has joined #ruby
hightower3 has joined #ruby
`tim` has joined #ruby
malconis_ has quit [Read error: Connection reset by peer]
malconis has joined #ruby
UnknownSoldier has joined #ruby
UnknownSoldier has quit [Remote host closed the connection]
cdg has quit [Remote host closed the connection]
statelesscode has quit [Ping timeout: 248 seconds]
cdg has joined #ruby
UnknownSoldier has joined #ruby
mikecmpb_ has joined #ruby
patarr has joined #ruby
workmad3 has quit [Ping timeout: 248 seconds]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
poolside has joined #ruby
chouhoulis has quit [Remote host closed the connection]
mikecmpbll has quit [Ping timeout: 260 seconds]
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jameser has joined #ruby
chouhoulis has joined #ruby
antoniobeyah has joined #ruby
statelesscode has joined #ruby
jhack has quit [Quit: jhack]
patarr has quit [Ping timeout: 258 seconds]
blackmes1 has joined #ruby
nowz has joined #ruby
ecuanaso has joined #ruby
jhack has joined #ruby
workmad3 has joined #ruby
negatifze has joined #ruby
walterheck has joined #ruby
GooseYArd has quit [Remote host closed the connection]
aufi has quit [Ping timeout: 260 seconds]
<Fernando-Basso>
We say "use while as a modifier". What if it is not as a modifier, then it is a "normal value" or "the while loop" or "the while construct"?
xangria has quit [Read error: Connection reset by peer]
<Fernando-Basso>
s/normal value/normal while/
xangria has joined #ruby
sid_fule_ has joined #ruby
blackbombay has joined #ruby
douglascorrea has joined #ruby
workmad3 has quit [Ping timeout: 256 seconds]
Gayathri_ has quit [Quit: Connection closed for inactivity]
TvL2386 has quit [Remote host closed the connection]
lele has quit [Quit: Coyote finally caught me]
ironcame1 is now known as ironcamel
ori has left #ruby ["Leaving..."]
patarr has quit [Ping timeout: 240 seconds]
workmad3 has joined #ruby
skweek has joined #ruby
Definity has joined #ruby
tinti has joined #ruby
cpruitt has joined #ruby
poolside has quit [Remote host closed the connection]
lele has joined #ruby
<Definity>
Hi, If i am making a REST call and getting JSON back whats the best way to populate the models with the results from the model itself or from a controller?
<toretore>
Definity: is this a rails question?
hightower3 has quit [Ping timeout: 258 seconds]
<Definity>
Ah sorry wrong question, I thought I was in #rails
UnknownSoldier has quit [Remote host closed the connection]
xangria has quit [Read error: Connection reset by peer]
blackbom1 has joined #ruby
blackbombay has quit [Ping timeout: 258 seconds]
conta has quit [Ping timeout: 240 seconds]
Burgestrand has quit [Quit: Closing time!]
Rodya_ has quit [Remote host closed the connection]
negatifze has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sid_fule_ has quit [Remote host closed the connection]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bkxd has joined #ruby
<Fernando-Basso>
Then it was the wrong channel, not the wrong question. Poor question....
<Fernando-Basso>
It took all the blame.
workmad3 has quit [Ping timeout: 256 seconds]
brent__ has joined #ruby
nowz has quit [Quit: Leaving]
aganov has quit [Remote host closed the connection]
jhack has quit [Ping timeout: 252 seconds]
xangria has joined #ruby
teclator has quit [Ping timeout: 264 seconds]
workmad3 has joined #ruby
sid_fules has joined #ruby
UserJosh is now known as JoshS
vasilakisfil has quit [Quit: Konversation terminated!]
xangria has quit [Read error: Connection reset by peer]
xangria has joined #ruby
sebastia_ has quit [Remote host closed the connection]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sebastiansier has joined #ruby
mikecmpb_ has quit [Quit: inabit. zz.]
hobodave has joined #ruby
jameser has joined #ruby
ReK2 has joined #ruby
ReK2 has joined #ruby
ReK2 has quit [Changing host]
mikecmpbll has joined #ruby
xangria has quit [Read error: Connection reset by peer]
jhack has joined #ruby
danielpclark has joined #ruby
Rodya_ has joined #ruby
stamina has joined #ruby
sebastiansier has quit [Ping timeout: 255 seconds]
Rodya_ has quit [Remote host closed the connection]
Renich has joined #ruby
jhack has quit [Ping timeout: 256 seconds]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jameser has joined #ruby
username_ has joined #ruby
sonOfRa has quit [Quit: Bye!]
senayar has joined #ruby
senayar has joined #ruby
senayar has quit [Changing host]
last_staff has quit [Quit: last_staff]
saneax is now known as saneax-_-|AFK
Evesy has joined #ruby
saneax-_-|AFK is now known as saneax
mwlang has quit [Quit: mwlang]
ReK2 has quit [Ping timeout: 264 seconds]
hahuang65 has quit [Ping timeout: 276 seconds]
sonOfRa has joined #ruby
StoneCypher has joined #ruby
nowhere_man has quit [Ping timeout: 240 seconds]
blackmes1 has quit [Ping timeout: 258 seconds]
xangria has joined #ruby
blackmes1 has joined #ruby
nankyokusei has joined #ruby
choke has joined #ruby
negatifze has joined #ruby
workmad3 has quit [Ping timeout: 276 seconds]
montanonic has joined #ruby
<Evesy>
Hi, I'm trying take a copy of an immutable object in Ruby (specifically an array of chef attributes) so that I can then edit this array separately inside of a module, however I keep getting "Chef::Exceptions::ImmutableAttributeModification", even if I'm doing something like new_object = chef_object.clone -- Is there no way to create a copy of an immutable object?
amclain has joined #ruby
nankyokusei has quit [Ping timeout: 240 seconds]
<apeiros>
Evesy: clone clones the frozen status. try dup. though, frozen would actually cause another exception… so not sure that comes from ruby, might be some custom thing chef does.
* apeiros
afk, back in ~30
workerbeetwo has joined #ruby
marxarelli has joined #ruby
ja_ has quit [Quit: Page closed]
maddmaxx has joined #ruby
<Evesy>
apeiros: Unfortunately I had the same such luck with .dup -- It does seem to be a custom chef exception
xangria has quit [Read error: Connection reset by peer]
xangria has joined #ruby
alexar has joined #ruby
sebastiansier has joined #ruby
workmad3 has joined #ruby
[Butch] has joined #ruby
dgarstang has joined #ruby
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dgarstang>
Does rake or ruby support some sort of import from URL?
SesMan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Couch has quit [Ping timeout: 245 seconds]
alexar_ has joined #ruby
xangria has quit [Read error: Connection reset by peer]
ecuanaso has joined #ruby
xangria has joined #ruby
tolerablyjake has joined #ruby
tolerablyjake has quit [Client Quit]
alexar has quit [Read error: Connection reset by peer]
tolerablyjake has joined #ruby
agent_white has joined #ruby
agent_white has quit [Changing host]
agent_white has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Guest2994 is now known as ged
ged is now known as Guest29905
<agent_white>
Mornin folks
jameser has joined #ruby
atmosx has quit [Quit: WeeChat 1.4]
Ruby_Rocks_007 has joined #ruby
workmad3 has quit [Ping timeout: 264 seconds]
skweek has quit [Ping timeout: 245 seconds]
dc4 has joined #ruby
jackjackdripper has quit [Quit: Leaving.]
jackjackdripper has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bkxd has quit [Ping timeout: 255 seconds]
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dgarstang>
so, I guess it's not possible to provide a Rakefile from a common library then?
senayar has quit []
bmurt has joined #ruby
Rodya_ has joined #ruby
<apeiros>
dgarstang: it's possible to provide rake tasks from a library
<apeiros>
dgarstang: regarding a Rakefile however - tell me again, how does rake figure which Rakefile to use?
tvw has quit []
__Yiota has joined #ruby
<dgarstang>
apeiros: It would always use a local Rakefile, which would be a short stub and import the Rakefile library. Or, if it was a gem, the local stub would import the Rakefile library
ta has joined #ruby
<apeiros>
dgarstang: it's plain ruby code. how do you load another ruby code file in ruby?
Rodya__ has joined #ruby
<dgarstang>
apeiros: import/require.. still don't understand the differnence there but that's another story
tinti has quit [Remote host closed the connection]
<apeiros>
do I have to read the docs to you?
<dgarstang>
apeiros: no, i said ok
<apeiros>
you also said "and?" :)
<dgarstang>
apeiros: Yes, and? The local Rakefile has an import, I presume of a common Rakefile...?
tolerablyjake has quit [Remote host closed the connection]
<apeiros>
you put your rake tasks into a file in your gem. you require that file in your Rakefile.
Ruby_Rocks_007 has quit [Quit: Ruby_Rocks_007]
<apeiros>
or use rake's import if you need its specific way of working.
<apeiros>
though not sure whether rake's import works across gems.
<dgarstang>
apeiros: So a rakefile in a locally installed gem is loaded with a simple 'import some_rakefile' then?
smswmedia has quit [Ping timeout: 248 seconds]
<apeiros>
no. there's exactly one Rakefile.
<apeiros>
everything else is just files with code.
<dgarstang>
apeiros: ok, I'm confused then.
<apeiros>
and that code can be code which defines rake tasks.
<apeiros>
and like all other files containing code, you can require it.
<dgarstang>
apeiros: some local git repo which needs the tasks...
<dgarstang>
apeiros: has to import the common rakefile somehow
<apeiros>
dgarstang: when you have a gem which contains a file foo/bar.rb which contains the class Foo::Bar - what do you do in your local git repo which somehow needs that Foo::Bar?
<dgarstang>
apeiros: I don't know. I'm not a ruby programmer. I'm using rake because it's relatively simple
<jokke>
anyone?
<apeiros>
maybe that's the problem then. rake is ruby code. I'd suggest you learn ruby.
<dgarstang>
apeiros: Not really an option I'm afraid.
<jokke>
sudo -Eu deploy /usr/local/rbenv/bin/rbenv exec bundle exec puma -C config/puma.rb <- this is the command i'm running
bkxd has quit [Ping timeout: 240 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hahuang65 has joined #ruby
bkxd has joined #ruby
sparch has quit [Quit: Leaving]
gusrub has quit [Remote host closed the connection]
patarr has joined #ruby
nanoz has joined #ruby
gusrub has joined #ruby
Renich has quit [Quit: leaving]
workmad3 has joined #ruby
bmurt has joined #ruby
Devalo has joined #ruby
<dgarstang>
So, I made a simle gem, and stuck a rakfile in it. Installed the gem, but when I do 'import foo' it fails. It's looking in PWD
hightower3 has joined #ruby
ta has quit [Ping timeout: 252 seconds]
gusrub has quit [Ping timeout: 255 seconds]
frozengeek__ has joined #ruby
patarr has quit [Ping timeout: 240 seconds]
sid_fules has quit [Remote host closed the connection]
hotpancakes has joined #ruby
tyang_ has joined #ruby
davezd has joined #ruby
Devalo has quit [Remote host closed the connection]
choke has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ruby-lang664 has quit [Ping timeout: 260 seconds]
<dgarstang>
Why would rake import always try and import from my local dir, and not use an installed gem?
tyang has quit [Ping timeout: 256 seconds]
Devalo has joined #ruby
<apeiros>
because that's how it works
<dgarstang>
apeiros: Well...
<dgarstang>
apeiros: I must have misunderstood you earlier then
<apeiros>
18:50 apeiros: though not sure whether rake's import works across gems.
<dgarstang>
Well there you go. :(
<dgarstang>
apeiros: One rakefile import from another. Crazy idea I guess
<apeiros>
*shrug* I gave you an alternative, you chose to ignore it.
<dgarstang>
apeiros: Not sure how you can understand my intent on a terminal. I never chose to ignore it
Devalo has quit [Ping timeout: 240 seconds]
<djellemah>
jokke: hum, could be puma is expecting a fifo to exist on the filesystem somewhere?
<jokke>
hm
<jokke>
i "fixed" it by disabling puma output redirection
synthroid has quit [Remote host closed the connection]
Ruby_Rocks_007 has joined #ruby
splud has joined #ruby
ianmethyst has joined #ruby
Guest29905 is now known as ged
hotpanca_ has joined #ruby
ged is now known as Guest16296
<dgarstang>
still no luck
xen0fon has joined #ruby
antgel has quit [Ping timeout: 240 seconds]
unshadow has joined #ruby
xall_ has joined #ruby
hotpancakes has quit [Ping timeout: 276 seconds]
hotpanca_ has quit [Remote host closed the connection]
Emmanuel_Chanel has quit [Ping timeout: 240 seconds]
_djbkd has joined #ruby
Rodya__ has quit [Remote host closed the connection]
nofxx has joined #ruby
choke has joined #ruby
hotpancakes has joined #ruby
douglascorrea has quit [Remote host closed the connection]
rfoust has quit [Read error: Connection reset by peer]
douglascorrea has joined #ruby
alexar_ has quit []
Rodya_ has joined #ruby
blackmesa has joined #ruby
xall_ has quit [Ping timeout: 260 seconds]
blackmes1 has quit [Read error: Connection reset by peer]
workmad3 has quit [Ping timeout: 240 seconds]
hotpancakes has quit [Ping timeout: 255 seconds]
nowhere_man has joined #ruby
TheHodge has quit [Quit: Connection closed for inactivity]
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
Emmanuel_Chanel has joined #ruby
ixti has joined #ruby
douglascorrea has quit [Ping timeout: 276 seconds]
ur5us has joined #ruby
workmad3 has joined #ruby
douglascorrea has joined #ruby
blackmesa has quit [Ping timeout: 260 seconds]
Snowy has quit [Remote host closed the connection]
renchan has quit [Quit: Leaving...]
<Yxhuvud>
well, it certainly is possible to inject tasks through gems. Rails certainly do that, but I'm not certain it has a readable example of how to accomplish it.
Devalo has joined #ruby
tlaxkit has quit [Quit: Leaving]
<Yxhuvud>
probably by simply requiring the tasks file when loading the rails env.
oryman has joined #ruby
ur5us has quit [Ping timeout: 264 seconds]
nowhere_man has quit [Ping timeout: 276 seconds]
nowhere_man has joined #ruby
<apeiros>
18:50 apeiros: you put your rake tasks into a file in your gem. you require that file in your Rakefile.
malconis has quit [Read error: Connection reset by peer]
oryman has quit [Client Quit]
oryman has joined #ruby
duderonomy has joined #ruby
workmad3 has quit [Ping timeout: 260 seconds]
Rodya_ has quit [Read error: No route to host]
bkxd has quit [Ping timeout: 260 seconds]
Rodya_ has joined #ruby
electrostat has quit [Quit: uwotm8]
synthroid has joined #ruby
electrostat has joined #ruby
ianmethyst has quit [Quit: WeeChat 1.7]
malconis has joined #ruby
oryman has quit [Quit: Leaving]
nankyokusei has joined #ruby
jaruga_____ has joined #ruby
jaruga______ has joined #ruby
jaruga____ has quit [Quit: jaruga____]
patarr has joined #ruby
andikr has quit [Ping timeout: 264 seconds]
cdg_ has joined #ruby
nankyokusei has quit [Ping timeout: 260 seconds]
jaruga_____ has quit [Ping timeout: 240 seconds]
cdg has quit [Ping timeout: 255 seconds]
workmad3 has joined #ruby
ldnunes has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
tpendragon has quit [Ping timeout: 255 seconds]
BackEndCoder has quit [Excess Flood]
andikr has joined #ruby
electrostat has quit [Quit: uwotm8]
electrostat has joined #ruby
gusrub has joined #ruby
hotpancakes has joined #ruby
BackEndCoder has joined #ruby
prawnzy has joined #ruby
patarr has quit [Ping timeout: 258 seconds]
Cohedrin_ has joined #ruby
gusrub has quit [Ping timeout: 240 seconds]
ta has joined #ruby
prawnzy has quit [Ping timeout: 255 seconds]
Snowy has joined #ruby
gusrub has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
whathappens has quit [Remote host closed the connection]
prawnzy has joined #ruby
moei has quit [Quit: Leaving...]
whathappens has joined #ruby
ta has quit [Ping timeout: 245 seconds]
cdg has joined #ruby
bkxd has joined #ruby
hotpancakes has quit [Read error: Connection reset by peer]
polyidus has joined #ruby
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<lucz>
I'm currently installing chruby https://github.com/postmodern/chruby and when I run sudo ./scripts/setup.sh, I get a message saying: >>> Setup complete! Please restart the shell
mwlang has joined #ruby
bmurt has joined #ruby
<lucz>
Do I just run something like exec bash -l ?
<mwlang>
for developing a gem, what’s the finer point of including gem dependencies in the Gemfile vs. gem’s *.gemspec file?
<apeiros>
mwlang: Gemfile is a bundler thing, not a gem thing
sepp2k has quit [Ping timeout: 255 seconds]
cdg_ has quit [Ping timeout: 248 seconds]
<apeiros>
so all non-development dependencies should always go into the gemspec
<mwlang>
apeiros: ok, I do see that. So what I place in the gemspec should solely be concerned with deploying the gem (i.e. what’s needed for the gem to work in production apps) and everything else in the Gemfile?
<mwlang>
I know about add_dependency and add_development_dependency…it’s just unclear as a gem author why I would choose one over the other (or both as you suggested)
<apeiros>
the only exception I see is when your dependencies are either local or a repository (path:/git: ones in the gemfile)
tyang__ has joined #ruby
<apeiros>
development dependencies are dependencies needed to work on the gem itself
<apeiros>
such as running its tests f.ex.
ecuanaso has joined #ruby
<apeiros>
so rspec might be a dev dep, it's not needed to use your gem, but needed if you work on it.
<mwlang>
Katz clarifies another question I had about Gemfile.lock: “Do not check your Gemfile.lock into version control”
cdg has quit [Ping timeout: 255 seconds]
<apeiros>
important to keep the context
<apeiros>
"when developing a gem"
whathappens has quit [Remote host closed the connection]
<apeiros>
he says the exact opposite in "when developing an app"
<apeiros>
so please refrain from using this without the proper context. it gives a wrong picture.
<mwlang>
hmmm…”add_dependency” is not mentioned in the guide…just add_runtime_dependency and add_development_dependency
ur5us has joined #ruby
tyang_ has quit [Ping timeout: 256 seconds]
<apeiros>
this is from 2010, might well be that dev deps appeared later in gemspec.
bocaneri has quit [Read error: Connection reset by peer]
<apeiros>
because I remember that they haven't always been around, but I don't remember when it was added.
<mwlang>
apeiros: right on the Gemfile.lock. I’m mentally in the “gem development” frame of mind so didn’t realize the door I opened there.
whathappens has joined #ruby
nvms has joined #ruby
marxarelli is now known as marxarelli|afk
jackjackdripper has quit [Quit: Leaving.]
<mwlang>
ok, so from this, I gather I should strive to put as little as possible in the Gemfile, relying on the gem declarations in the gemspec as much as possible. If I need to reference a local gem for development purposes, then I should add it to the Gemfile where I can tightly control source, paths, etc.
Snowy has quit [Remote host closed the connection]
minimalism has joined #ruby
tyang__ has quit [Quit: Leaving]
tyang has joined #ruby
hotpancakes has joined #ruby
<mwlang>
if I have a gem name “foo-bar” (hyphenated), must the gemspec file also be hyphenated “foo-bar.gemspec” and the lib/ subfolder “lib/foo-bar” or can it be named “foo_bar.gemspec” and “lib/foo_bar” (as is my normal inclination…)
synthroid has quit []
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RickHull>
there is nothing "magic" about lib being in a path -- it's just that the topmost lib folder inside a rubygem project is what gets loaded into the global namespace
<dgarstang>
So, a 'require 'tasks' in the root of the gem works, but a 'require <gem_name>/tasks' from elsewhere (after gem is installed locally) doesn't work
<RickHull>
the name of your $project_dir is irrelevant. only what it contains. when it contains lib/, then the next thing under lib should match the gem name
<dgarstang>
weird, but ok
<RickHull>
it's how rubygems does namespacing in the global namespace under lib/ in the $LOAD_PATH
whathappens has quit [Remote host closed the connection]
<dgarstang>
RickHull: So the require 'gem-name' is ... pointless
<RickHull>
in the make-your-own-gem
<RickHull>
notice the gem is named hola
<dgarstang>
sure
<RickHull>
so the first thing under lib/ matches
whathappens has joined #ruby
<RickHull>
lib/hola.rb
<lucz>
havenwood: ruby-2.4.0. :D
<RickHull>
it's completely in accordance with what I've been saying
<havenwood>
lucz: \o/
<RickHull>
lucz, not too tough, eg? the next one will go quicker. you'll have all the rubies
<lucz>
RickHull: thank you :)
<dgarstang>
So, with lib/chef-rakelib.rb ... what's the require going to be? require 'chef-rakelib/chef-rakelib' ?!
<RickHull>
what you require is whatever is under lib/
<RickHull>
remember lib/ is a global namespace
<RickHull>
so if you have the hola gem, require 'hola'
<dgarstang>
RickHull: So, it looks like JUST require 'chef-rakelib' is all I need
<RickHull>
for yours, require 'chef-rakelib' or possibly require 'chef-rakelib/tasks'
<RickHull>
yep
<dgarstang>
well, there's no tasks/
<RickHull>
i just saw you wanted to name something tasks.rb ;)
<dgarstang>
RickHull: i got no idea, looks to be basically working. Thanks
<RickHull>
take a close look at my buildar gem for reference too
<RickHull>
great
<RickHull>
also, you don't have to install the gem to test it
<RickHull>
go to $project_dir (where lib is in `ls`)
<RickHull>
ruby -Ilib $ARGS
<RickHull>
that will add the local lib to the LOAD_PATH
<RickHull>
so that you can still do: require 'chef-rakelib'
<RickHull>
or e.g. irb -Ilib -rchef-rakelib
Rodya_ has quit [Remote host closed the connection]
<RickHull>
you will be in an irb session with your gem already required
<RickHull>
without having had to build and install the latest
whathappens has quit [Ping timeout: 276 seconds]
agent_white has quit [Ping timeout: 264 seconds]
prawnzy has quit [Remote host closed the connection]
agent_white has joined #ruby
<RickHull>
basically, finding what is "installed" or "available" for a standard looking require -- it's all about manipulating LOAD_PATH
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
ta has quit [Ping timeout: 276 seconds]
rwb has joined #ruby
hotpancakes has quit [Remote host closed the connection]
sebastia_ has quit []
ifctj has quit [Ping timeout: 276 seconds]
prawnzy has joined #ruby
<RickHull>
dgarstang, final thought: require 'foo' -- this not look for a gem named foo. this looks for a file or dir named foo in the LOAD_PATH
skweek has quit [Ping timeout: 260 seconds]
<RickHull>
what rubygems (install) does is put a file or dir named foo in the LOAD_PATH, if you've specified the foo gem correctly
<RickHull>
your gem's name is not relevant to this nor is the name of $project_dir
<RickHull>
if the LOAD_PATH thingie is going to be named foo, then it just makes more sense to name the gem foo
<RickHull>
it's more of a UX convention that these match. the gem name does not determine how to correctly perform the requires
<dgarstang>
RickHull: Not following you on the testing bit...
<dgarstang>
can't I just set LOAD_PATH to where the repo for it is?
<RickHull>
though i'm not sure if rake follows the same arg conventions
marxarelli is now known as marxarelli|afk
<RickHull>
if it does, then rake -Ipath/to/lib -rchef-rakelibs should work too
<RickHull>
and you won't need to build or install to test
<RickHull>
or futz with require_relative
<RickHull>
just to be clear, you should have 2 projects: chef-rakelib and the project that needs rake tasks
nofxx has quit [Remote host closed the connection]
<RickHull>
so go to $project_2; rake -Ipath/to/chef-rakefile/lib
nofxx has joined #ruby
nvms has quit [Quit: This computer has gone to sleep]
flying has quit []
<RickHull>
or just add path/to/chef-rakefile/lib to your LOAD_PATH manually. there's nothing wrong with that, though it will become tedious
nvms has joined #ruby
username_ has quit [Ping timeout: 276 seconds]
psychicist__ has quit [Ping timeout: 276 seconds]
polyidus has quit [Quit: ZZZzzz…]
Guest10753 is now known as ged
matp has quit [Remote host closed the connection]
ged is now known as Guest37373
patarr has quit [Ping timeout: 264 seconds]
jaffejoe has joined #ruby
matp has joined #ruby
agent_white has quit [Quit: brb]
<dgarstang>
RickHull: I set LOAD_PATH to ~/.chefdk/gem/ruby/2.3.0/gems/chef-rakelib-0.0.0/lib/ ... put an error in chef_rakelib.rb on purpose... ran rake, no error. it's still using the gem it seems
duckpupp1 has quit [Ping timeout: 276 seconds]
conta has joined #ruby
marxarelli|afk is now known as marxarelli
<RickHull>
oh, right. the installed version is probably first in LOAD_PATH
<RickHull>
you can just uninstall it
<dgarstang>
oops scrapt that.
malconis has quit [Read error: Connection reset by peer]
<dgarstang>
my bad. I was pointing at the gem. Duh
malconis has joined #ruby
<jaffejoe>
does class level methods only work for objects that are not instantiated?
<dgarstang>
ok, still doesn't work with export LOAD_PATH=~/git/chef-rakelib/lib/
<RickHull>
you want to append, not overwrite
<RickHull>
you probably blasted some important stuff
nvms has quit [Quit: This computer has gone to sleep]
malconis has quit [Read error: Connection reset by peer]
<dgarstang>
RickHull: Well LOAD_PATH isn't set..
<dgarstang>
RickHull: something has to set it. It wasn't me.
malconis has joined #ruby
<dgarstang>
RickHull: Open a new terminal. echo $LOAD_PATH ... empty
<RickHull>
hm, it's not an env var, i forget quite how it works
<dgarstang>
rake -I ~/git/chef-rakelib/lib/ seems to work. That will do for now
conta has quit [Ping timeout: 264 seconds]
<RickHull>
yep, path/to/chef-rakelib/lib
nankyokusei has joined #ruby
AndrewIsHere has quit [Remote host closed the connection]
teclator has quit [Quit: No Ping reply in 180 seconds.]
AndrewIsHere has joined #ruby
teclator has joined #ruby
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
d5sx43 has joined #ruby
koldbrutality has quit [Remote host closed the connection]
saslam has joined #ruby
j416 has quit [Ping timeout: 240 seconds]
nankyokusei has quit [Ping timeout: 255 seconds]
tercenya has quit [Remote host closed the connection]
tercenya has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Lord_of_Life has quit [Excess Flood]
teclator has quit [Client Quit]
j416 has joined #ruby
ecuanaso has joined #ruby
lmc has quit [Remote host closed the connection]
Lord_of_Life has joined #ruby
teclator has joined #ruby
saslam has quit [Ping timeout: 255 seconds]
jenrzzz_ has joined #ruby
teclator_ has joined #ruby
Derperperd has joined #ruby
lmc has joined #ruby
mikolaj9 has joined #ruby
teclator has quit [Ping timeout: 255 seconds]
d5sx43 has quit [Quit: Leaving...]
skweek has joined #ruby
jenrzzz has quit [Ping timeout: 264 seconds]
Ruby_Rocks_007 has quit [Quit: Ruby_Rocks_007]
j416 has quit [Ping timeout: 264 seconds]
patarr has joined #ruby
Derperperd has quit [Ping timeout: 260 seconds]
unshadow has quit [Read error: Connection reset by peer]
nowhereman has quit [Ping timeout: 276 seconds]
j416 has joined #ruby
unshadow has joined #ruby
lmc has quit [Ping timeout: 245 seconds]
Moosashi has joined #ruby
<RickHull>
dgarstang, ah, i think the env var is RUBYLIB
blackmesa has joined #ruby
<RickHull>
and LOAD_PATH is a ruby internal "constant"
rfoust has joined #ruby
<RickHull>
also, congrats for diving in building and installing a gem, you hacker :)
renchan has quit [Remote host closed the connection]
meshsmith has quit [Remote host closed the connection]
lmc has joined #ruby
username_ has joined #ruby
Derperperd has joined #ruby
patarr has quit [Ping timeout: 255 seconds]
ta has joined #ruby
<mikolaj9>
anybody using mrubyc ?
andikr has quit [Read error: Connection reset by peer]
AckZ has quit []
patarr has joined #ruby
<dgarstang>
thanks Rick
ruby-lang876 has joined #ruby
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ruby-lang800 has joined #ruby
jaruga______ has quit [Quit: jaruga______]
Moosashi has quit [Quit: Moosashi]
Fernando-Basso has joined #ruby
gizmore has joined #ruby
enterprisey has joined #ruby
jenrzzz_ has quit [Ping timeout: 252 seconds]
marxarel_ has joined #ruby
ecuanaso has joined #ruby
marxarelli has quit [Ping timeout: 276 seconds]
teclator_ has quit [Ping timeout: 252 seconds]
teclator has joined #ruby
marxarel_ is now known as marxarelli
<RickHull>
mikolaj9, I've been thinking about it, does that count?
lmc has quit [Remote host closed the connection]
rwb has quit [Ping timeout: 240 seconds]
ruby-lang800 has quit [Ping timeout: 260 seconds]
ruby-lang876 has quit [Ping timeout: 260 seconds]
tyang has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
rails364 has joined #ruby
aryaching_ has quit [Read error: Connection reset by peer]
aryaching has joined #ruby
tercenya has quit [Remote host closed the connection]
Ruby_Rocks_007 has joined #ruby
tercenya has joined #ruby
ReK2 has joined #ruby
ReK2 has joined #ruby
ReK2 has quit [Changing host]
jackjackdripper has joined #ruby
ReK2 has quit [Client Quit]
Moosashi has joined #ruby
lmc has joined #ruby
benlieb has joined #ruby
Rodya_ has joined #ruby
gusrub has quit [Remote host closed the connection]
patarr has quit [Ping timeout: 248 seconds]
patarr has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
rails364 has quit [Ping timeout: 260 seconds]
rfoust has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nanoz has quit [Read error: Connection reset by peer]
ta has quit [Ping timeout: 255 seconds]
unshadow_ has joined #ruby
`tim` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
patarr has quit [Ping timeout: 260 seconds]
dc4 has quit [Ping timeout: 240 seconds]
unshadow has quit [Ping timeout: 240 seconds]
whathappens has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
A124 has quit [Quit: '']
hightower3 has joined #ruby
mikolaj9 has left #ruby [#ruby]
A124 has joined #ruby
Guest37373 is now known as ged
ged is now known as Guest32654
xen0fon has quit [Quit: xen0fon]
Ishido has joined #ruby
<dgarstang>
How do I expand variables inside """ ... """ ?
<sonOfRa>
What is even the point of """-quoted strings?
ta has joined #ruby
jenrzzz_ has joined #ruby
<RickHull>
I've never been tempted to use them
<Papierkorb>
sonOfRa: """ doesn't really exist in Ruby, or rather, it's parsed as "" "..." ""
blackwind_123 has quit [Ping timeout: 240 seconds]
<Papierkorb>
sonOfRa: So empty-string, double-quoted string, empty-string. In ruby, string literals follwoing after another without operators are concatenated, like in C: "foo" "bar" == "foobar"
cdg has joined #ruby
cdg has quit [Remote host closed the connection]
<RickHull>
that would only work for #puts and friends, right?
gusrub has joined #ruby
<Papierkorb>
it works everywhere you can put a string literal
<ruby[bot]>
havenwood: # => [:on_tstring_beg, :on_tstring_end, :on_tstring_beg, :on_tstring_end, :on_tstring_beg, :on_tstring_en ...check link for more (https://eval.in/723347)
jenrzzz has quit [Ping timeout: 252 seconds]
<Papierkorb>
I must admit I used the `parser` gem to verify it here, didn't think about using ripper
blackwind_123 has joined #ruby
douglascorrea has quit [Remote host closed the connection]
douglascorrea has joined #ruby
<RickHull>
so why would anyone use triple quotes in source code? decoration?
jshjsh has quit [Ping timeout: 240 seconds]
gusrub has quit [Ping timeout: 255 seconds]
hightower3 has quit [Ping timeout: 264 seconds]
<dgarstang>
I have a gemspec file with s.version = "#{IO.read(File.join(File.dirname(__FILE__), 'VERSION'))}.#{ENV['BUILD_NUMBER']}" ... it doesn't seem to like the VERSION bit
Rodya_ has quit [Remote host closed the connection]
<RickHull>
if you're using ruby >= 2, you can use __dir__
<RickHull>
but probably just put a string in your gemspec
<RickHull>
rather than trying to read a file
<dgarstang>
ah there's a \n in there which might be an issue
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dgarstang>
or that
jackjackdripper has quit [Quit: Leaving.]
jackjackdripper has joined #ruby
<dgarstang>
Doesn't seem to work. When I run it throo irb, no output
cdg_ has joined #ruby
cdg has quit [Ping timeout: 276 seconds]
hahuang65 has quit [Ping timeout: 245 seconds]
<RickHull>
__FILE__ doesn't work in irb
<RickHull>
last I checked
<RickHull>
__dir__ might
<dgarstang>
sigh. ruby makes no sense to me. In irb, run IO.read('VERSION') and I get a result. Ok, so then I run [IO.read('VERSION'), ENV['BUILD_NUMBER'].join('.') and don't get a result. I got back and run IO.read('VERSION') again, and now I dont get a result for that either
ohnowendigo has joined #ruby
<dgarstang>
__FILE__ doesn't work. Oh of course.
<dgarstang>
Then, when I press ctrl-d, I see all the errors that weren't displayed
<RickHull>
this stuff is kind of gross, working out relative paths at gem build time
<RickHull>
but the link i pasted should suffice, along with the join trick
<RickHull>
always prefer joins to interpolation for string building, when possible
saslam has joined #ruby
<RickHull>
it's like structured programming vs GOTO
<dgarstang>
RickHull: To me it's like most of ruby, reading right to left.
DLSteve has quit [Quit: All rise, the honorable DLSteve has left the channel.]
<RickHull>
not sure about perf, but when you're joining strings, particularly in structured output it makes sense to use join
<dgarstang>
Maybe if I learned chinese, then ruby would be easier
teclator has quit [Ping timeout: 240 seconds]
<RickHull>
that's the functional style
<dgarstang>
Doesn't explain why the irb thing went wacky
<RickHull>
it's like a pipeline
d5sx43 has joined #ruby
<RickHull>
__FILE__ doesn't work in irb
<RickHull>
you are workign with gross hacks and irb is not a faithful environment
<dgarstang>
You mean it makes irb go completely bonkers
<RickHull>
but join is a functional style of method
<RickHull>
we start with some strings, and then we put them into the pipeline
<RickHull>
the pipeline joins them and spits out a new string
<RickHull>
left to right
<dgarstang>
It's the same as array.each do. *shudder*
StoneCyp1er has joined #ruby
<RickHull>
you will learn to love it. or not
<dgarstang>
Not. It's been several years. Tried many times. I can't get past chapter one because of stuff like array.each do
<RickHull>
that's seriously one of my favorite features
<RickHull>
so maybe it's just not a good match
<dgarstang>
how about for var in something do? That's readable
James123 has quit [Quit: Lost terminal]
<RickHull>
you can write it that way. but that's one specific form
toretore has quit [Remote host closed the connection]
<RickHull>
ruby's blocks are a different way of thinking about this stuff, and for loops are just scratching the surface
<dgarstang>
That's the other thing that makes ruby hard to read. There is no standard. Gotta translate every time you read it
<RickHull>
instead of for loop being a special form, it's just a trivial type of block
Asher has joined #ruby
cdg has joined #ruby
<RickHull>
we're moving up the stack to better in built abstractions that work predictably in tons more useful scenarios
StoneCypher has quit [Ping timeout: 260 seconds]
<Papierkorb>
dgarstang: ruby is quite readable unless you aren't reading it as english text ;)
<RickHull>
going from #each to #map in ruby is a conceptual breeze
<RickHull>
unlike say Perl
<dgarstang>
Papierkorb: Your kidding right?
<Papierkorb>
dgarstang: I think it's easy to read. But I also think of Python as being completely unreadable.
<dgarstang>
Papierkorb: rather than say array.append, what is it array << foo? or is it array < foo? I can't remember squiggle very well
d5sx43 has quit [Remote host closed the connection]
<RickHull>
aliases exist. they can be annoying at first but this goes away quickly
<dgarstang>
or pipes for for loops... I can't even remembre the syntax without looking it up
<RickHull>
again, blocks are the shit. once you grok blocks, you won't look back
<Papierkorb>
dgarstang: Give it a try. Thinking of operations on collections as piping stuff from one algorithm into the next one is a really powerful mechanism
cdg_ has quit [Ping timeout: 255 seconds]
<RickHull>
don't tell him about elixir
<dgarstang>
i may be able to write it once, but a week later I won't remember what all the sqiggles and symbols mean
d5sx43 has joined #ruby
<RickHull>
step 1. achieve familiarity
<RickHull>
these are trivial complaints
<dgarstang>
maybe that's why ruby code never catches errors, because they are one giant pipeline
saslam has quit [Ping timeout: 255 seconds]
Ishido has quit [Remote host closed the connection]
<dgarstang>
Rick: not if you can't read what you wrote
rwb has joined #ruby
<Papierkorb>
dgarstang: Huh? You can catch errors just fine
<RickHull>
because you're not familiar yet
ohnowendigo has left #ruby [#ruby]
<RickHull>
it's a hurdle, for sure
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dgarstang>
Papierkorb: I can honestly say that most of the time, ruby code doesn't catch errors. It just throws a backtrace in a line that's really several operations pipelined together
skweek has quit [Ping timeout: 255 seconds]
<Papierkorb>
dgarstang: And no matter your programming background, the other language(s) you use are bound to have operators too
<RickHull>
yes there can be several methods per line
Asher has quit [Quit: Leaving.]
<dgarstang>
Rick: yeah I can't get familar because of the symbols and squiggles and reading from right to left
<RickHull>
you do find out which method raises the error
<RickHull>
and ruby does catch it and tell you about it
<dgarstang>
So, no catching of errors then. Leave it up to the user to dig through the code?
<baweaver>
begin, rescue, try, catch
<RickHull>
what do you mean by catch errors?
nettoweb has joined #ruby
<Papierkorb>
dgarstang: Don't catch what you can't handle, this is a common paradigm in other languages too. And if you don't like the backtrace, just move the code to the next line.
d5sx43 has quit [Client Quit]
<dgarstang>
Papierkorb: Code should never fail with a backtrace
<RickHull>
swallowing errors is dumb
Asher has joined #ruby
Asher has quit [Client Quit]
<Radar>
popcorn
Asher has joined #ruby
<RickHull>
your own code should rescue what it can handle
<Papierkorb>
dgarstang: Then catch the error and print a user friendly error message?
<dgarstang>
How are you supposed to know where the error happened when the line contains several operations pipelined together?
<RickHull>
the trace tells you
<RickHull>
this is not rocket science
<dgarstang>
There should not be a trace
<baweaver>
why not?
<RickHull>
you can swallow unhandle-able errors
<RickHull>
but that's dumb
<dgarstang>
Because a trace means the programmer didn't write good code
<RickHull>
no it doesn't
<baweaver>
nope
<baweaver>
that's kinda screwy
<dgarstang>
so, if code fails, it's up to the user to dig through the code?
<Radar>
Yo does anyone have opinions about code in here
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<baweaver>
so all code should run perfectly the first time
<baweaver>
that doesn't happen in production
nettoweb has quit [Client Quit]
<Radar>
Code can fail in _exceptional_ ways that you didn't realise when you first wrote it. Those _exceptional_ ways will raise _exceptions_ which DO have stacktraces.
<RickHull>
dgarstang, it's up to your code whether to swallow unhandle-able errors. ruby does not do that by default
<RickHull>
for example, when your disk fills
<RickHull>
you will get some Errno
<Radar>
Code which fails in _known_ ways will not have stacktraces and if your code encounters such an error it will know what to do with it... and there won't be a trace.
<RickHull>
do you swallow it or handle it?
<dgarstang>
RickHull: Well then wrap the operation which writes to the disk in a catch, try
<RickHull>
and then when it fails?
benlieb has quit [Quit: benlieb]
ddffg has quit [Ping timeout: 255 seconds]
<dgarstang>
RickHull: print an error saying it failed due to an IO failure
<RickHull>
you can do that in ruby \o/
<dgarstang>
RickHull: yes, but most dont
<Radar>
dgarstang: Because disk filling up isn't what many people would consider to be a problem.
<Radar>
It's not like in my day to day work I'm going "but what if my 600GB hdd fills up?"
<dgarstang>
Radar; it is if it causes the app to fail to work as expected
Lord_of_Life has quit [Excess Flood]
<baweaver>
you cannot possibly cover every exception case, that's incredibly naive.
<Radar>
dgarstang: I can't think of an application which I've worked on recently which _wouldn't_ fail if the disk was full.
<RickHull>
dgarstang, rails has an exception handler that reports this stuff to the user without a trace
<dgarstang>
Radar: maybe i think differently because my background is ops. Developers need to be aware of the system they run on
<RickHull>
any command line executable will do this if it wants to
<baweaver>
I run ops at a very large org and what you're describing is insane
<dgarstang>
baweaver: No, but you do your best to catch as many as possible
<RickHull>
don't use software that doesn't do this. it's not inherent to ruby
Moosashi has quit [Quit: Moosashi]
<Radar>
dgarstang: Wouldn't the ops people get an alert when the disk usage is high and then handle that before the disk usage got to 100%? If they didn't handle that, then they wouldn't be doing their job.
<zenspider>
"Code should never fail with a backtrace" ?!?!?! what crazy BS is that?
<baweaver>
We have Sensu or Nagios or Zabbix for that
<Radar>
It's not up to the program to ensure that the disk is still writeable. A non-writeable disk is catastrophic.
Lord_of_Life has joined #ruby
<dgarstang>
Radar: and when the app fails with a backtrace and nothing else, wat is the ops person supposed to do?
<baweaver>
learn how to read a backtrace
<Radar>
dgarstang: "hey dev person, can you take a look at this?"
gusrub has joined #ruby
<Radar>
^
hahuang65 has joined #ruby
<Radar>
You know, stop and collaborate. Just as the song goes.
<Papierkorb>
dgarstang: Forward it to the dev, as without the trace, they cannot easily know where exactly it happened
<dgarstang>
Radar: How about a useful error message that saved the developer having to be involved? it might be user error
<RickHull>
the backtrace tells you that the disk is full. there is no information an exception handler has that the backtrace doesn't
negatifze has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Radar>
dgarstang: You're shifting the goal posts to suit your argument, and that is frustrating.
<baweaver>
An exception tells you something exceptional happened beyond what they designed for
<Radar>
dgarstang: The example you used is the disk was full. That is not something that as a developer I would ever consider accounting for when I'm writing a program.
<baweaver>
and you are in fact shifting the goal a lot
<RickHull>
the question of whether to write a trivial exception handler as the outer loop of your program -- it's not inherent to ruby
Moosashi has joined #ruby
<dgarstang>
Well, i guess the next time I use wellsfargo.com and they have an error they should just dump a backtrace to the browser
<Radar>
dgarstang: No. They would log an exception through an exception logging service, like Bugsnag, and then report to the user that the application was unable to serve the request.
<Radar>
dgarstang: Rails apps do this with a 500.html page by default.
<Radar>
The "We're sorry but something went wrong" page.
<RickHull>
dgarstang, what code is it you are complaining about it? or are you just talking about stackoverflow snippets?
<RickHull>
again, it's not inherent to ruby. it's up to app how it handles exceptions
LoneHerm_ has joined #ruby
biberu has quit []
<zenspider>
wellsfargo? OK. Now I call trolling... rein it in and discuss ruby
<zenspider>
ah. he quit. good.
xpt is now known as lpt
Guest43 has joined #ruby
<Radar>
I love the smell of a good rant early in the morning.
hinbody has quit [Quit: leaving]
<baweaver>
A strong opinion is toxic to further growth as a programmer
Snowy has joined #ruby
<zenspider>
baweaver: not sure I agree... it might get you stuck in the short/medium term... but I think that can be a good thing... a sign that they're actually thinking about development as a practice. lord knows I've had my opinions over the years. you too, probably
<baweaver>
Oh I have
<baweaver>
getting over them is what allowed me to move on though
<zenspider>
hopefully you're open to being challenged (by others or by your own further study) and can change your mind
<baweaver>
If you hold onto them (strong opinions) then you're hosed
LoneHerm_ has quit [Remote host closed the connection]
<baweaver>
that's more of what I was getting at.
<mwlang>
strong opinion, open mind.
<RickHull>
dude was just frustrated. he was following tutorials trying to GET SHIT DONE and tripped a few too many times and got bloodied up
<baweaver>
It happens
Asher has quit [Quit: Leaving.]
Asher has joined #ruby
LoneHermit has joined #ruby
<baweaver>
zenspider: the ability to get to some strong opinions shows progress, the ability to move beyond them is what gets you the rest of the way
<baweaver>
There are just some really deeply held almost religious level convictions about some things which I tend to call toxic
douglascorrea has joined #ruby
nankyokusei has joined #ruby
Guest43 is now known as Rufus
benlieb has joined #ruby
tercenya has quit [Remote host closed the connection]
tercenya has joined #ruby
hinbody has joined #ruby
hobodave_ has quit [Quit: Computer has gone to sleep.]
<dgarstang>
I'm confused about require '...'. I had assumed the first part was the gem name, but it's not. it appears to be a path inside the gem. Is that correct?
sepp2k has quit [Read error: Connection reset by peer]
cdg has quit [Remote host closed the connection]
<zenspider>
that is correct
<zenspider>
most/many gems have a requireable file that is the same name as the gem, but not all
kht has quit [Ping timeout: 240 seconds]
<dgarstang>
zenspider: so... jeez that blows my mind. What about scoping ?
<zenspider>
dgarstang: what about it?
<dgarstang>
zenspider: what if two gems have the same files?
<zenspider>
I'm happy to answer your questions... but not if you're going to be a dick. I DO have better shit to do than that
<dgarstang>
zenspider: how do you even know what gem your loading from?
cdg has joined #ruby
workmad3 has joined #ruby
<dgarstang>
zenspider: not sure if that dick comment was directed torwards me.
<zenspider>
it very much was
<zenspider>
dgarstang: you can use bundler + a gemfile that fully resolves all the things you're using and limits the load paths
FMan has joined #ruby
<dgarstang>
zenspider: Don't see why. Fair questions
Moosashi has joined #ruby
<zenspider>
1) I saw all your previous dialog. 2) determined that you're basically trolling at this point. 3) your "blows my mind" comment is superfluous
nebben has quit [Ping timeout: 255 seconds]
<zenspider>
or, in your code you can "activate" a gem with the gem method: gem "minitest", "~> 4.0"
rkazak has joined #ruby
<zenspider>
but name collisions on the file system are entirely possible... not sure how that's a scoping issue so much as a packaging issue
jameser has joined #ruby
<dgarstang>
zenspider: it's not trolling to be surprised that a require statement doesn't use any sort of qualification
<zenspider>
not sure if rubygems warns against that. Back when I looked at the issue there were so few collisions that it didn't warrant it
<dgarstang>
zenspider: Well it would mean that every gem developer in the world would have to know the file names of every other gem developer in the world
Hobbyboy has quit [Ping timeout: 252 seconds]
<zenspider>
if you want to argue ad absurdum / slippery slope, sure... but I'm not interested
pingpong has left #ruby [#ruby]
<dgarstang>
require 'some_file' ... not even sure how I'd interpret that months later when I looked at the code. Require from where?
<zenspider>
dunno if you've noticed, but we're doing fine as an ecosystem
<dgarstang>
zenspider: So my concern isn't valid your saying?
<zenspider>
you can do `gem which some_file` on the cmdline to look at it
<lucz>
RickHull: you about?
<dgarstang>
ok, that's one workaround
<zenspider>
dgarstang: "you're"
OTORelic has quit [Ping timeout: 252 seconds]
workmad3 has quit [Ping timeout: 240 seconds]
<zenspider>
I'm saying you're making a mountain out of a molehill. in my practice, this stuff works fine
<RickHull>
lucz, what's up
<zenspider>
and I've had a lot of practice. way more than you (at ruby, at least)
<dgarstang>
zenspider: Maybe I'll just put comments on every require line so I know where they come from
<matthewd>
dgarstang: It works because a well-behaved gem *makes* the first part (which is a subdirectory) match the gem name
<lucz>
RickHull: I'm still going at it with this chruby thing, I had to run bundle install earlier and came up against this: byebug-9.0.6 requires ruby version >= 2.0.0, which is incompatible with the current version, ruby 1.9.3p484
<zenspider>
you certainly can... seems like overkill to me
<zenspider>
matthewd: doesn't mean I can't do the same in my poorly-behaved gem. :)
<matthewd>
dgarstang: .. but it leaves the ability for a gem to do something more creative if that is more appropriate in a given situation
<zenspider>
I could totally add rspec.rb in minitest :)
<lucz>
RickHull: I also had to run bundler as root, but that shouldn't matter since I'm only using ruby for this one script, and it's a test server
jameser has quit [Client Quit]
rkazak has quit [Client Quit]
marxarelli is now known as marxarelli|afk
<RickHull>
lucz, ok, take a step back
<zenspider>
I would be eviscerated for it... but I COULD
<RickHull>
you don't need root for any of this, so you're off the happy path
<matthewd>
zenspider: "the gem name", not "a gem name" ;)
<Zarthus>
zenspider, you could also make minitest fail a test at a random chance
<RickHull>
lucz, what does `which ruby` give you?
<Zarthus>
based from experience, nobody actually inspects the souece of the gems they downloaded :P
<zenspider>
yes, but the ordering of discovery isn't defined... maybe it is alphabetical order... so minitest would win :)
<lucz>
RickHull: /usr/bin/ruby
<RickHull>
lucz, remember when I said there is a trivial but easy to miss step
<zenspider>
Zarthus: I've thought about it... well... thought about making it so that stubs randomly don't stub. (can't figure out equivalent for mocks, so it doesn't seem terribly valuable)
<lucz>
RickHull: somewhat
<RickHull>
about loading chruby in your env
<RickHull>
try: chruby ruby, and then: which ruby
jameser has joined #ruby
malconis has quit [Read error: Connection reset by peer]
xen0fon has joined #ruby
<zenspider>
lucz: if it is /usr/bin/ruby (and that version of ruby is acceptable) then needing sudo for your bundle is probably correct
<RickHull>
there are two steps to making sure your user session uses chruby: 1. source the chruby script 2. tell chruby which ruby to use
<zenspider>
oh... if they're TRYING to use chruby, then there's definitely an env problem
<RickHull>
generally #1 goes in .bashrc and #2 can optionally, or there is a trick using a .ruby-version file
JeanCarloMachado has quit [Ping timeout: 258 seconds]
<lucz>
RickHull: I did edit my .bashrc file
hightower3 has quit [Read error: Connection reset by peer]
<lucz>
RickHull: to add source.. etc
jameser has quit [Client Quit]
<RickHull>
you can add another line for #2, below the `source` or `.` line:
<RickHull>
chruby ruby
hightower3 has joined #ruby
<lucz>
RickHull: sorry I don't understand what you mean with that last message
blackmesa has joined #ruby
<RickHull>
later if you have multiple rubies, you can specify which one
<zenspider>
lucz: did you start a new shell tho?
<lucz>
zenspider: yup
<havenwood>
lucz: Did you also?: source /usr/local/share/chruby/auto.sh
<lucz>
havenwood: yup
<zenspider>
something's wrong with your PATH (or whatever mechanism chruby uses)
moei has joined #ruby
<RickHull>
see my "two steps" comment above. until you do `chruby ruby`, then you are still using the "system" ruby, which you don't want for this purpose
<lucz>
RickHull: oh I seeeee
<RickHull>
i think everything is ok
<RickHull>
it's a bit tricky
<lucz>
ok so if I run bundle install as the ubuntu user, I get "Could not locate gemfile"
kht has joined #ruby
<RickHull>
let's start a new login session
<lucz>
cd /home/ubuntu
<lucz>
okidoke, new one started
<RickHull>
and if you don't have chruby ruby in your .bashrc, then execute it by hand
pingpong has joined #ruby
<RickHull>
confirm with: which ruby
<lucz>
RickHull: literally just 'chruby ruby'
<lucz>
?
<RickHull>
yeah, we're telling chruby to activate and which ruby to use
JeanCarloMachado has joined #ruby
strongcode has quit [Quit: Lost terminal]
<lucz>
RickHull: ah okay. I added it to my bashrc file, now when I run which ruby I get /home/ubuntu/.rubies/ruby-2.4.0/bin/ruby
<lucz>
new sesh
<RickHull>
ok, now all that crap with bundler you did
<RickHull>
none of that affects this. you're in a brand new environment
<lucz>
RickHull: okay
<RickHull>
probably: gem install bundler
<RickHull>
see what happens
<RickHull>
anyone else feel free to chime in
<lucz>
1 gem installed
Fernando-Basso has quit [Quit: WeeChat 1.7]
<RickHull>
ok, now you can proceed with the migration stuff
<lucz>
what does it mean 1 gem? what's a gem?
<lucz>
thats a very noob question I realise
<RickHull>
it's like an app. a useful chunk of code
<lucz>
ah like a module?
<RickHull>
sometimes they give you new commands in the shell
<RickHull>
yeah
<lucz>
I'm learning python at the moment so I know a bit