<stemid>
hey forgive me but I have no desire to learn ruby I just want to run a small piece of code and I can't figure out how to import Sidekiq::ScheduledSet because I keep getting the error "uninitialized constant Sidekiq::ScheduledSet (NameError)" from this code https://bpaste.net/show/2ce55dbea5a1
tdy has quit [Ping timeout: 240 seconds]
cloaked1 has quit [Ping timeout: 244 seconds]
<stemid>
think I figured it out require 'sidekiq/api'
lxsameer has joined #ruby
mikecmpbll has joined #ruby
<z4phod>
dd
jp has joined #ruby
venmx has joined #ruby
<Bish>
WHATS UP RUBYFOOOLKS
<Bish>
to the windoow \o\
<Bish>
stemid: what's wrong with ruby >:|
status402 has joined #ruby
tdy has joined #ruby
<stemid>
the name is too feminine
stemid has left #ruby [#ruby]
ansraliant has quit [Quit: My planet needs me]
Snowy has joined #ruby
ponga has quit [Quit: Connection closed for inactivity]
tdy has quit [Ping timeout: 240 seconds]
phaul has joined #ruby
<al2o3-cr>
dr = -> n { 1 + (n - 1) % 9 }; 0.step(50).map { |x| y = 1 << x; dr.(y) } # physical
<al2o3-cr>
dr = -> n { 1 + (n - 1) % 9 }; 0.step(50).map { |x| y = 1 << x; dr.(y) }.each_cons(2).map { |n| dr.(n.sum) } # non-physical
<al2o3-cr>
dr = -> n { 1 + (n - 1) % 9 }; 0.step(50).map { |x| y = 1 << x; dr.(y) }.each_cons(2).map { |n| dr.(n.sum) }.each_cons(2).map(&:sum) # unknown-entity
kapil____ has quit [Quit: Connection closed for inactivity]
vondruch has quit [Ping timeout: 252 seconds]
anubhav996 has quit [Quit: Connection closed for inactivity]
vondruch has joined #ruby
al2o3-cr has quit [Quit: WeeChat 2.3]
status402 has quit [Quit: status402]
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
al2o3-cr has joined #ruby
xfbs has joined #ruby
esrse has quit [Ping timeout: 244 seconds]
al2o3-cr has quit [Quit: WeeChat 2.3]
al2o3-cr has joined #ruby
whysthatso has joined #ruby
beefjoe has joined #ruby
drale2k_ has joined #ruby
troulouliou_div2 has joined #ruby
whysthatso has quit [Quit: whysthatso]
whysthatso has joined #ruby
vondruch_ has joined #ruby
AJA4350 has joined #ruby
vondruch has quit [Ping timeout: 272 seconds]
vondruch_ is now known as vondruch
tdy has joined #ruby
marmotini_ has joined #ruby
jsc has joined #ruby
jsc is now known as status402
tdy has quit [Ping timeout: 252 seconds]
marmotini_ has quit [Ping timeout: 240 seconds]
Nicmavr has quit [Write error: Connection reset by peer]
kurko_ has joined #ruby
Nicmavr has joined #ruby
apparition47 has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
surrounder has quit [Remote host closed the connection]
surrounder has joined #ruby
ldnunes has joined #ruby
psmolen has quit [Quit: bai]
status402 has quit [Quit: status402]
status402 has joined #ruby
xfbs has quit [Quit: afk]
discopatrick has joined #ruby
gr33n7007h has joined #ruby
al2o3-cr has quit [Read error: Connection reset by peer]
kapil____ has joined #ruby
Snowy has quit [Remote host closed the connection]
znz_jp has quit [Remote host closed the connection]
znz_jp has joined #ruby
status402 has quit [Ping timeout: 240 seconds]
status402 has joined #ruby
status402 has quit [Client Quit]
GodFather has quit [Ping timeout: 252 seconds]
Fusl has quit [Remote host closed the connection]
k0mpa has joined #ruby
status402 has joined #ruby
Fusl has joined #ruby
megabozz has joined #ruby
megabozz has quit [Max SendQ exceeded]
Puffball has quit [Read error: No route to host]
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Puffball has joined #ruby
nowhere_man has joined #ruby
bak1an has joined #ruby
thejamespinto has joined #ruby
ua has joined #ruby
ua_ has quit [Ping timeout: 252 seconds]
Snowy has joined #ruby
Snowy has quit [Ping timeout: 264 seconds]
mostlybadfly has joined #ruby
drale2k_ has joined #ruby
jottr has joined #ruby
jottr has quit [Client Quit]
apparition47 has quit [Quit: Bye]
tdy has joined #ruby
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
drale2k_ has joined #ruby
Snowy has joined #ruby
Puffball has quit [Remote host closed the connection]
Puffball has joined #ruby
troulouliou_div2 has quit [Remote host closed the connection]
tdy has quit [Ping timeout: 252 seconds]
status402 has quit [Ping timeout: 240 seconds]
rubydoc has quit [Remote host closed the connection]
darkxploit has joined #ruby
rubydoc has joined #ruby
<darkxploit>
hello, i want to install the latest development version of NET-SSH which is a ruby implementation of SSH from https://github.com/net-ssh/net-ssh. How do i make the installation from source ?
nchambers has quit [Ping timeout: 252 seconds]
<darkxploit>
there is both a gemfile and a rakefile inside the source code
status402 has joined #ruby
<phaul>
execute `bundle install` then execute `bundle exec rake build`
<darkxploit>
phaul: can you please tell me what will the command bundle install do
<phaul>
darkxploit: install the gem dependencies
<darkxploit>
ok
<darkxploit>
and bundle exec rake build
<darkxploit>
will it build it from source
<darkxploit>
?
<phaul>
build a .gem file that the gem utility can install
<darkxploit>
imagine i modify the source code
<phaul>
the compilation should be part of rake build
Rapture has joined #ruby
Rapture has quit [Client Quit]
<darkxploit>
ahh okay
<darkxploit>
thanks .. just did a snapshot of the machine.. and launched a bundle install..
<darkxploit>
phaul: ok bunlde exec rake build is succesful
cd has joined #ruby
<phaul>
gem install <yournewlybuilt.gem>
beefjoe has quit [Quit: <3]
<phaul>
is the last step to make it useable on the system
beefjoe has joined #ruby
Snowy has quit [Ping timeout: 276 seconds]
Bish has quit [Ping timeout: 272 seconds]
Tuor has quit [Quit: Konversation terminated!]
beefjoe has quit [Client Quit]
<darkxploit>
phaul: i dont find a new .gem file in the directory
ogres has joined #ruby
<darkxploit>
ahh ok
<darkxploit>
sorry
<darkxploit>
sorry its in pkg directory where it was built by bundle exec rake
<darkxploit>
phaul: now it says i gem installed
<darkxploit>
ls
<phaul>
darkxploit: so I expect the gem to be installed and functioning at this point
<darkxploit>
phaul: thank you sir
<phaul>
you are welcome
<darkxploit>
phaul: how do i uninstall everything
<phaul>
gem list --local lists what you have installed. gem uninstall gemname uninstalls it
<darkxploit>
hmm okay,,,, easy
LiftLeft has quit [Ping timeout: 264 seconds]
orbyt_ has joined #ruby
LiftLeft has joined #ruby
Puffball has quit [Remote host closed the connection]
aupadhye has quit [Remote host closed the connection]
Puffball has joined #ruby
marmotini_ has joined #ruby
Snowy has joined #ruby
nowhere_man has quit [Ping timeout: 240 seconds]
venmx has quit [Quit: leaving]
tdy has joined #ruby
aces1up has joined #ruby
<aces1up>
i know this isnt an active record channel but not getting a response on those chnnels for the issue im having maybe someone here can help https://paste.ofcode.org/XuBbAx3Jq2g6RQxCQkFY6E
<aces1up>
is my code.
<aces1up>
trying to get a has_many association to work
status402 has quit [Quit: status402]
bmurt has joined #ruby
darkxploit has quit [Ping timeout: 256 seconds]
conta1 has joined #ruby
gr33n7007h has quit [Quit: WeeChat 2.3]
al2o3-cr has joined #ruby
<phaul>
aces1up: is /ruby/bot_framework_gem/lib/util/utility.rb your file or one of your dependencies?
<aces1up>
hrmm yes could be let me check
<aces1up>
yes
<aces1up>
its there
<phaul>
did you write that source file or it's coming from a gem?
<aces1up>
hrmm didnt notice it was referencing my framework.. just assumed it was coming from AR
<aces1up>
thanks i will fix that up and see what happens.
<phaul>
ok np
<aces1up>
yep that fixed it man
<aces1up>
was looking at it so long didnt see that lol
venmx has joined #ruby
aces1up has quit []
xfbs has joined #ruby
tdy has quit [Ping timeout: 240 seconds]
mkroman has quit [Ping timeout: 252 seconds]
mkroman has joined #ruby
mostlybadfly has quit [Quit: Connection closed for inactivity]
kurko_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tdy has joined #ruby
Inline has joined #ruby
nowhere_man has joined #ruby
dbugger_ has joined #ruby
ivanskie has joined #ruby
Puffball has quit [Remote host closed the connection]
kurko_ has joined #ruby
MoritaShinobu has quit [Quit: Leaving]
conta1 has quit [Quit: conta1]
SteenJobs has joined #ruby
xfbs has quit [Ping timeout: 252 seconds]
xfbs has joined #ruby
kurko_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
GodFather has joined #ruby
<SteenJobs>
Hi all - been reading through the various different ways to execute system/shell commands, and I still can’t quite figure out which methods execute the given commands in a subshell vs as a subprocess (akin to python’s `shell=false`), so was hoping someone could help me clear things up
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ogres has quit [Quit: Connection closed for inactivity]
<al2o3-cr>
SteenJobs: Kernel#system executes in a subshell
<al2o3-cr>
spawn, exec etc.. subprocesses.
nowhere_man has quit [Remote host closed the connection]
nowhere_man has joined #ruby
kurko_ has joined #ruby
GodFather has quit [Ping timeout: 250 seconds]
Rapture has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
mangold has quit [Quit: This computer has gone to sleep]
c0ncealed3 has quit [Read error: Connection reset by peer]
c0ncealed3 has joined #ruby
<SteenJobs>
al2o3-cr: Great, thanks! - so in my script, i want to run a couple git commands, (1) `git fetch` and (2) `git pull`, and then (3) check `git status` - it seems like Open3#capture2 is a great candidate for (3), but for (1) and (2) I see no reason to execute in a subshell, but `exec` will replace the current process rather than creating a subprocess, so what would be a good option for (1) and (2)?
<SteenJobs>
(i
<SteenJobs>
ugh *i’m writing the script based on a python script from a coworker, where the (1) and (2) equivalent is called using `subprocess.call` to provide some context
kurko__ has joined #ruby
kurko_ has quit [Ping timeout: 272 seconds]
<al2o3-cr>
SteenJobs: then use Process.spawn for #1 and #2; Open3#* are just an easy to use wrapper around Process.spawn if that helps.
clemens3 has quit [Remote host closed the connection]
<al2o3-cr>
SteenJobs: do you want to capture stderr too?
<al2o3-cr>
SteenJobs: if so use Open3.capture2e/3
avelldiroll has quit [Quit: WeeChat 1.6]
<al2o3-cr>
you know what open3 was written by the man himself.
darkhanb has joined #ruby
GodFather has joined #ruby
avelldiroll has joined #ruby
<al2o3-cr>
SteenJobs: anything your not sure about just ask ;)
<SteenJobs>
haha typing rn, ironing out my thoughts/questions, very much appreciated :)
<al2o3-cr>
np =P
<SteenJobs>
al2o3-cr: my understanding is the parent process will inherit stderr when using Open3.capture2e/3, and i don’t really need to do anything with stderr other than display it and exit the script (which I understand I can do using the status object)
<SteenJobs>
as for Process.spawn, it looks like the execution is done asynchronously without explicitly calling Process.wait, is that correct?
<al2o3-cr>
correct.
GodFather has quit [Ping timeout: 264 seconds]
jp has joined #ruby
<SteenJobs>
is the same true for Open3?
<al2o3-cr>
no
<SteenJobs>
asking with regards to both Open3.capture* and Open3.popen*
<SteenJobs>
ah ok - what exactly is the `wait_thr` param that gets passed into the block for the popen* methods?
<al2o3-cr>
well, specifically not with caputre but popen you get a thread
rippa has joined #ruby
<al2o3-cr>
the process
zapata has quit [Read error: Connection reset by peer]
cloaked1 has joined #ruby
<al2o3-cr>
wht_thr is a Process::Status object with is just basically a thread.
zapata has joined #ruby
<al2o3-cr>
returns a p/s object when called
mfunkmann has joined #ruby
<SteenJobs>
ok got it, yea wasn’t sure what the object type was
<SteenJobs>
so out of curiosity, if Open3 is by default synchronous, how would one use Open3 methods asynchronously? (not applicable to my use case since i need synchronous execution)
<al2o3-cr>
sorry Process::Waiter my bad
<al2o3-cr>
fork/thead them.
zapata has quit [Read error: Connection reset by peer]
zapata has joined #ruby
<SteenJobs>
hmm just pulled up the Process::Waiter docs and looks like pid is its only instance method - but the docs for Open3 show `wait_thr.value` returning a Process::Status object
gigetoo has quit [Ping timeout: 272 seconds]
gigetoo has joined #ruby
GodFather has joined #ruby
zapata has quit [Read error: Connection reset by peer]
zapata has joined #ruby
onkelhotte has joined #ruby
<ivanskie>
I have a little bit of code that checks if an executable out of an array exists, then gives me version number. Just spent half an hour googling a way to regex out the version number to no avail.
<bougyman>
what's the version number?
<bougyman>
I mean, what's an example?
<ivanskie>
but then realized wait.. i can just do. string.split(' ')[1]
<bougyman>
hahah
<al2o3-cr>
SteenJobs: because inherits from Thread
dbugger__ has joined #ruby
<SteenJobs>
ah ok, missed that bit
<ivanskie>
pip --version, python --version, etc
<al2o3-cr>
Thread#value
<ivanskie>
so far the only edge case is gcc
<ivanskie>
good thing i don't care about gcc
<al2o3-cr>
SteenJobs: the # refers to instance methods btw
dbugger_ has quit [Ping timeout: 264 seconds]
jetchisel has joined #ruby
<SteenJobs>
right
<SteenJobs>
al2o3-cr: i’ll look thru the docs - it does seem that Kernel#system is probably the most straightforward way for (1) and (2) above, and since there’s no input, i guess there’s no potential issue with running a subshell
<al2o3-cr>
SteenJobs: for that, sure.
<al2o3-cr>
well, #1 and #2 anyway.
<al2o3-cr>
ivanskie: what does this string look like?
<ivanskie>
pip 18.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
<SteenJobs>
al2o3-cr: do any of the methods for executing commands bubble up exceptions such that the parent process will simply fail and terminate execution without explicitly checking the Process::Status object?
<ivanskie>
or Python 2.7.15
<al2o3-cr>
Open3 methods?
<ivanskie>
from open3 yes
<ivanskie>
nevermind
<al2o3-cr>
ivanskie: thats for SteenJobs
<SteenJobs>
haha
<al2o3-cr>
;)
* ivanskie
slowly turns around and walks away
bmurt has quit [Read error: Connection reset by peer]
bmurt has joined #ruby
<SteenJobs>
al2o3-cr: for either Open3 or Kernel (are Kernel#spawn and Process#spawn identical?)
<al2o3-cr>
yeah, identical.
venmx has quit [Ping timeout: 252 seconds]
<al2o3-cr>
oh, no.
<al2o3-cr>
obviously only if the command doesn't exist
<al2o3-cr>
and that'll be Error.
<al2o3-cr>
and that'll be Error::ENOENT
<al2o3-cr>
ivanskie: what string?
<SteenJobs>
i guess for example if the subprocess executes a `git fetch` and for whatever reason origin doesn’t exist or something occured that would cause `git fetch` to fail, would all the methods we discussed require explicitly checking the status object?
<al2o3-cr>
SteenJobs: yes.
<ivanskie>
"pip 18.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)" or "curl 7.54.0 (x86_64-apple-darwin18.0) libcurl/7.54.0 LibreSSL/2.6.4 zlib/1.2." etc...
<al2o3-cr>
but for 1 and 2 just use system. it will either return true or false.
<SteenJobs>
Ok cool - oneeee last q - with Open3.capture*, if stderr is inherited, what exactly does that mean? I assume it means that the subprocess shares the same stderr as the parent process, so in the `git fetch` case, if the child process has a non-zero exit status, would that cause the parent process (the containing script) to stop execution?
<SteenJobs>
but yea, in practice i’ll use system for 1 and 2
<al2o3-cr>
stderr will be captured in the same stream as stdout using c2/e, c3 will be two seperate streams.
ptx0 has quit [Read error: Connection reset by peer]
<al2o3-cr>
SteenJobs: oh yeah sorry. yes.
mikecmpbll has joined #ruby
<al2o3-cr>
you can check with t.value.exitstatus.
wojnar has joined #ruby
mangold has joined #ruby
<al2o3-cr>
what versoin you after?
<al2o3-cr>
how can you split(' ')[1]?
conta1 has joined #ruby
<al2o3-cr>
what's is everybodys thoughts on (-1..)? for infinte ragne?
siaw23 has joined #ruby
<al2o3-cr>
i think it's brilliant myself
<al2o3-cr>
oh and yield_self is alaised to then.]
<siaw23>
good eve everyone! what’s be the easiest way to grab the second string. eg: “some cat”
<siaw23>
i want to grab “cat” only
<siaw23>
currently i’m using
<siaw23>
string[] which i don’t want to
<siaw23>
will there be an easier way?
<siaw23>
so the way i’m doing it is like string[first_string.length + 1, string.length - first_string + 1]
<siaw23>
which is too long and i feel there’s an easier way
<al2o3-cr>
split.[]/first?
<woodruffw>
^
<al2o3-cr>
split.[]/last?
<al2o3-cr>
haha
<woodruffw>
if the string is exactly two words, String#split and Array#last are what you want
<woodruffw>
otherwise, String#split and then get the first element
<woodruffw>
err, second element, index 1
<mfunkmann>
Hey, which GUI Framework would you guys use for a ruby macOS Desktop App?
<al2o3-cr>
"some cat"[/\S+\z/]
<siaw23>
woodruffw: sounds like a good idea
<al2o3-cr>
shit i forget more ruby i used to nkow.
<al2o3-cr>
*know
ptx0 has joined #ruby
SteenJobs has quit [Quit: SteenJobs]
<al2o3-cr>
siaw23: ^^
<al2o3-cr>
other than that waht woodruffw said. ;)
* al2o3-cr
pissed up agian forgive me
SeepingN has joined #ruby
<siaw23>
yeah got it
<al2o3-cr>
how small this screen going be?
dellavg_ has joined #ruby
<al2o3-cr>
x270 thinkpad i ant see on this now
Snowy has quit [Remote host closed the connection]
<BlaDe^>
I don't have my 2FA right now to login to github to gist :X
<al2o3-cr>
that basically telling you there is no method at top level.
nicesignal has quit [Remote host closed the connection]
<al2o3-cr>
line 26
nicesignal has joined #ruby
<BlaDe^>
how should I go about that? the .erb is fine when I run via my chef cookbook
<BlaDe^>
I'm trying to share the .erb with a local setup and just run erb against a .env file
<al2o3-cr>
paste config.lua.erg
<al2o3-cr>
paste config.lua.er*b
<al2o3-cr>
redeacted
<al2o3-cr>
your namespacing is no good.
<BlaDe^>
it's a huge lua file with <%= node[:var] %> and <% unless node[:environment] == 'prod' %> blocks in it -- i don't _have_ any namespacing in the .erb file itself
<BlaDe^>
I didn't setup our chef stuff, so I don't really know how it works.. I'm just trying to make the .erb file render without a full chef run, locally
<al2o3-cr>
you sure that definitly name is right?
<al2o3-cr>
node?
<al2o3-cr>
just check please.
marmotini_ has quit [Ping timeout: 244 seconds]
<BlaDe^>
the .env.rb i pasted is raw from my text editor - not changed at all, and I apsted the 3 lines from .config.erb .. Let me play a little
<al2o3-cr>
BlaDe^: node doesn't exist.
im0nde has joined #ruby
<BlaDe^>
$ head -1 env.rb ---> node = {
<BlaDe^>
do i have to... export it or something?
<phaul>
use instance variables
<phaul>
@node = { ...
<phaul>
and @node in the erb file
<al2o3-cr>
phaul: they dont't have to, if it's in the namespace they're saying.....
eckhardt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<al2o3-cr>
braincrash: -O
<al2o3-cr>
braincrash: sorry, shit tab-comp
<al2o3-cr>
BlaDe^: that should see it.
<al2o3-cr>
are you a dir down?
<phaul>
can we try it though? I bet it will fix it
<al2o3-cr>
phaul: globals will fix it too.#
<al2o3-cr>
that's not the point.
<BlaDe^>
if I use @node I get config.lua.erb:26:in `<main>': undefined method `[]' for nil:NilClass (NoMethodError)
<BlaDe^>
al2o3-cr: actually I am a dir down.... that matters?!
SteenJobs has quit [Quit: SteenJobs]
<BlaDe^>
i have .env.rb and app/config.lua.erb ... expect that erb -r .env.rb app/config.lua.erb would work..
leitz has quit [Remote host closed the connection]
<al2o3-cr>
BlaDe^: that should work. really.
<BlaDe^>
pwd is /Users/admin/demo/ ... which houses .env.erb and app/config.lua.erb
<BlaDe^>
yeah, that's my thinking too?!
SeepingN has quit [Disconnected by services]
SeepingN_ has joined #ruby
<BlaDe^>
I just added .env.rb -- @test = 'foo' and <%= @test %> to the .erb and it passes fine, still barfs on the node line
<BlaDe^>
but test = 'foo and <%= test %> doesn't work for probably an unrelated reason config.lua.erb:7:in `test': wrong number of arguments (given 0, expected 2..3) (ArgumentError)
<al2o3-cr>
i'll have to see config
<BlaDe^>
al2o3-cr: this is actually SUPER easy to repro
hitchhikingcoder has quit [Remote host closed the connection]
eddof13 has quit [Client Quit]
<al2o3-cr>
that should work. wtf.
<BlaDe^>
but you provided emotional support in the form of making me feel like less of a dumbass
leitz has joined #ruby
eckhardt_ has joined #ruby
<phaul>
al2o3-cr: I see the code getting the top level binding being passed into erb. but how does it get the top level of the -r file? isn't thata separate lexical scope anyways?
<phaul>
so hard to beleive that it was ever working like that
<al2o3-cr>
too much drink tnight. i cee tmos.
<phaul>
take care mate
nexraf1 has joined #ruby
<al2o3-cr>
you too. ruby elite ;)
darthfork has quit [Quit: darthfork]
hitchhikingcoder has joined #ruby
hitchhikingcoder has quit [Remote host closed the connection]
darthfork has joined #ruby
Eiam has joined #ruby
wojnar has quit [Remote host closed the connection]
kapil____ has quit [Quit: Connection closed for inactivity]
leitz has quit [Quit: Leaving]
darthfork has quit [Remote host closed the connection]
dnewkerk has joined #ruby
ziggylazer has quit [Ping timeout: 264 seconds]
orbyt_ has joined #ruby
thejamespinto has quit [Ping timeout: 252 seconds]
ziggylazer has joined #ruby
<phaul>
fwiw this also works TOPLEVEL_BINDING.local_variable_set(:node, {... , the difference has to be that the required file does not run in TOPLEVEL. I am guessing though, can anyone confirm?