<tfreedman>
is there an easy way to not have repoA's environment variables initialized when using backticks?
ExoUNX has joined #ruby
greypack has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
roadie has joined #ruby
factormystic has joined #ruby
roadie has quit [Ping timeout: 246 seconds]
<kinduff>
whats the log on repoB when executing that runner?
<kinduff>
does it raise an exception because the environment is not fully loaded?
Tempesta has quit [Quit: See ya!]
<tfreedman>
so the log is from repoA
<tfreedman>
~/.rvm/gems/ruby-2.6.5@repoA/gems/bundler-2.1.4/lib/bundler/spec_set.rb:86:in `block in materialize': Could not find concurrent-ruby-1.1.5 in any of the sources (Bundler::GemNotFound)
<tfreedman>
with a complete backtrace
cschneid has joined #ruby
<tfreedman>
repoB isn't actually getting loaded, when this is run by cron
<tfreedman>
when it's run by me running ```rails c``` in bash, and then running do_the_thing_in_repo_b(), it works
cschneid_ has quit [Ping timeout: 250 seconds]
Tempesta has joined #ruby
ChmEarl has quit [Quit: Leaving]
<tfreedman>
alternatively, if anyone has a less ridiculous way of linking A to B, I'm all ears
<tfreedman>
though I'd prefer to avoid doing something like POSTing data to a route that repo B offers
<tfreedman>
or writing a file to disk and waiting for repoB to check it every so often
cisco has quit [Remote host closed the connection]
roadie has joined #ruby
roadie has quit [Ping timeout: 264 seconds]
kevinburke has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
drincruz has joined #ruby
d3bug has quit [Quit: Connection closed for inactivity]
drincruz_ has quit [Ping timeout: 264 seconds]
drincruz_ has joined #ruby
drincruz has quit [Ping timeout: 246 seconds]
drincruz_ has quit [Ping timeout: 246 seconds]
roadie has joined #ruby
kristian_on_linu has quit [Remote host closed the connection]
d3bug has joined #ruby
roadie has quit [Ping timeout: 246 seconds]
vondruch has quit [Quit: vondruch]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cschneid_ has joined #ruby
cschneid has quit [Ping timeout: 250 seconds]
roadie has joined #ruby
cd has joined #ruby
tsujp has joined #ruby
gix has quit [Disconnected by services]
braincrash has quit [Quit: bye bye]
tsujp has quit [Client Quit]
braincrash has joined #ruby
roadie has quit [Ping timeout: 256 seconds]
polishdub has joined #ruby
BTRE has quit [Quit: Leaving]
BTRE has joined #ruby
Swyper has joined #ruby
zlogan has quit [Ping timeout: 246 seconds]
roadie has joined #ruby
drincruz_ has joined #ruby
BTRE has quit [Quit: Leaving]
roadie has quit [Ping timeout: 264 seconds]
drincruz_ has quit [Ping timeout: 250 seconds]
polishdub has quit [Ping timeout: 256 seconds]
dviola has joined #ruby
ExoUNX has quit [Quit: I'm leaving these neckbeards]
BTRE has joined #ruby
ExoUNX has joined #ruby
davor has quit [Ping timeout: 256 seconds]
zlogan has joined #ruby
sergioro has quit [Quit: leaving]
Technodrome has joined #ruby
Swyper has quit [Remote host closed the connection]
roadie has joined #ruby
sergioro has joined #ruby
davor has joined #ruby
cschneid has joined #ruby
cschneid_ has quit [Ping timeout: 250 seconds]
polishdub has joined #ruby
roadie has quit [Ping timeout: 256 seconds]
fluxAeon has quit [Ping timeout: 240 seconds]
fluxAeon has joined #ruby
d3bug has quit [Quit: Connection closed for inactivity]
vondruch has joined #ruby
roadie has joined #ruby
chalkmonster has joined #ruby
polishdub has quit [Ping timeout: 264 seconds]
william1_ has quit [Ping timeout: 240 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
polishdub has joined #ruby
drincruz_ has joined #ruby
polishdub has quit [Remote host closed the connection]
drincruz_ has quit [Ping timeout: 256 seconds]
roadie has quit [Ping timeout: 250 seconds]
william1_ has joined #ruby
kevinburke has quit [Quit: Connection closed for inactivity]
<clemens3>
B is taking it out and doing something with it
<clemens3>
so just do that
<tfreedman>
each table updates individually at different points in time
<tfreedman>
the result of the cache update is a decision as to whether or not X being updated actually affects whether or not user A should be displayed differently
<jhass>
btw I wouldn't new up ApplicationController but extract that to a PORO in lib/ and invoke it through a rake task maybe
<clemens3>
I think you must get clear about the real problem, not some rails technicality, that likely is not needed at all
<tfreedman>
computing it in real time is way too slow
<tfreedman>
I can probably do it as a rake task, but I assume I'll have the same issue
<tfreedman>
the problem is with RVM failing to set up the environment, and not the script itself failing
<tfreedman>
I assume I'm doing something wrong, but it isn't working
<tfreedman>
since it still always has some env vars of railsA
<jhass>
is A even running as a website/server?
<tfreedman>
the command I have in repoA is ```"/bin/bash -l -c \"source ~/.rvm/environments/ruby-2.6.5@repoB && cd #{path} && ./bin/rails runner -e development \'x = ApplicationController.new ; x.update(#{uids.to_s.gsub('"', '\"')}, :#{service})\'\""```
<tfreedman>
jhass: uhhh, kinda
<tfreedman>
repoA is a very weird repository
<tfreedman>
I can elaborate more on it, but uhhh, it's not a typical repo
<tfreedman>
whereas repoB is a typical rails website
<jhass>
well if the answer was no I would have suggested to just merge them into one project and have the background update just be a rake task
<tfreedman>
so hilariously, this actually was one project at one point
<jhass>
because honestly, this ApplicationController.new and the whole setup smells to heaven :P
<tfreedman>
repoA is a runtime with certain proprietary bits
<tfreedman>
repoB is the open source spinoff I'm trying to release
<jhass>
maybe A should be a Rails engine that can plug into B? or even vice versa
<jhass>
yeah, actually vice versa
<clemens3>
tfreedman: what is the cache update output, also some data in a DB?
<clemens3>
you need a long running process in batch mode which sends a message or commit when done, so B can use the result
<tfreedman>
so repoA returns a list of which users had updates, and which specific tables to rescan for each user
<clemens3>
rails, repo, all this chargon is just to confuse yourself
<tfreedman>
so the console output isn't really useful
<tfreedman>
it's fine to use old data while something in the background is updating
<jhass>
does running the full /bin/bash command on its own outside cron work?
<clemens3>
so learn about commits or atomic actions, which will be done at the end of the long running batch job
<jhass>
does it work from a shell inside A?
<tfreedman>
jhass: that version doesn't, I get ~/repoA/vendor/cache/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/application/configuration.rb:118:in `load_defaults': Unknown version "6.0" (RuntimeError)
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
<tfreedman>
which suggests there's a bug in the script
<tfreedman>
namely, that RVM for repoA is still loaded when it tries to load repoB
<jhass>
okay so the source is not failing outright
<jhass>
try to cd first
<tfreedman>
yeah, same thing
<jhass>
what if you drop the -l ?
<tfreedman>
same thing
<jhass>
what if you prepend /usr/bin/env -i ?
<tfreedman>
as part of the command, or before /bin/bash
<jhass>
before /bin/bash
conta has joined #ruby
<jhass>
I would expect -l to do that already but...
<tfreedman>
# /usr/bin/env -i /bin/bash -c "source ~/.rvm/environments/ruby-2.6.5@repoB && cd ~/sites/repoB && ./bin/rails runner -e development... produces "Could not find concurrent-ruby-1.1.5 in any of the sources"
<jhass>
and with cd before source? are you sure you're sourcing the right environment? What's rvm current saying in sites/repoB?
rippa has joined #ruby
<tfreedman>
ruby-2.6.5@repoB
<jhass>
probably not literally
<jhass>
I wouldn't be too surprised all the secrecey hiding the bug :P
<tfreedman>
If you're interested in helping me further, I can PM you some details
jetchisel has joined #ruby
<jhass>
I prefer others being able to jump in, watch & learn, sorry :)
<tfreedman>
the only two changes I've made in any commands before copying/pasting are actual_name -> repoB, and the changed path (/home/username/sites -> ~/sites/repoB)
<tfreedman>
but otherwise everything is exactly as output
<jhass>
idk, how about we just sidestep RVM and do bundle --path vendor/bundle in B?
<jhass>
then as long as both projects use the same ruby minor version you should be able to just run commands in B from A's environment
<tfreedman>
okay, hmm
<tfreedman>
so I kept getting errors no matter what I did, even after reverting some stuff
<tfreedman>
I finally just killed SSH and re-opened it, and now it's back to working (from within repoA's rails c via "/bin/bash -l -c \"cd #{path} && ./bin/rails runner -e development \'x = ApplicationController.new ; x.update(#{uids.to_s.gsub('"', '\"')}, :#{service})\'\""
<jhass>
oh well, *shrugs*
<jhass>
if nothing else I hope you took away some hints to rethink the architecture :)
<tfreedman>
so it seems like whatever commands were being run were also breaking my actual SSH session
<tfreedman>
fun
<tfreedman>
unfortunately, I can't think of a good alternative
<tfreedman>
aside from just setting up a route in rails and having repoA hit it with HTTParty
<tfreedman>
which is getting very tempting right now
<tfreedman>
but since it might take up to a minute to run, I figured that was the last resort
<jhass>
well we still have no clue what any of this is really about, so it's hard to give specifics hints
<jhass>
but as I said from all I've gathered so far, B could be a rails engine mounted into A
<jhass>
and expose a library interface to do tasks such as the above
<tfreedman>
B used to be a rails engine for A
<tfreedman>
A is a closed source component, and B was a hobby thing written as a joke
<tfreedman>
they definitely worked while coupled
<tfreedman>
I don't want to maintain that component as part of A's development, so I'm trying to decouple them as much as possible
<jhass>
maybe too much. As long as B doesn't call any code from A and doesn't assume and paths/config files/database schema from A to be present, I see no reason why it wouldn't still be an engine
<jhass>
B can expose whatever interface there needs to be between them as any normal gem would and A could just call it. No need for internal endpoints or running tasks in a nother project
<tfreedman>
I opted to not keep B as a rails engine because it's a standalone thing, with a UI and everything
<tfreedman>
so it seemed better to just create a new site, move B into it as its own thing, and migrate all the code from A->B
<jhass>
wouldn't be the first thing to be standalone'ish but best shipped as a rails engine. think any generic admin panel rails engine for example
<jhass>
or sidekiq's admin dashboard
<tfreedman>
it's evolved into a reasonably complete app - you wouldn't exactly integrate this into another project
<tfreedman>
it started as a plugin for an existing project as a joke, not something you'd realistically want to do
shokohsc has joined #ruby
<tfreedman>
it started from a discussion somewhat akin to "can your project run Doom?"
<tfreedman>
to which the only response was to write it as a plugin, demo it, and then spin it off into a separate thing so that nobody ever asks me why this is part of our source code
MrCrackPot has joined #ruby
conta has quit [Quit: conta]
drincruz_ has joined #ruby
drincruz_ has quit [Ping timeout: 250 seconds]
ellcs has joined #ruby
ellcs has quit [Max SendQ exceeded]
cschneid_ has joined #ruby
ellcs has joined #ruby
ellcs has quit [Max SendQ exceeded]
schne1der has joined #ruby
ellcs has joined #ruby
cschneid has quit [Ping timeout: 240 seconds]
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
akem has joined #ruby
elcuervo has quit [Read error: Connection reset by peer]
drincruz_ has joined #ruby
Tempesta has quit [Quit: AdiIRC is updating to v3.8 Beta Build (2020/03/17 UTC) 64 Bit]
Tempesta has joined #ruby
chalkmonster has joined #ruby
ua has quit [Read error: Connection reset by peer]
ua has joined #ruby
troulouliou_dev has joined #ruby
TCZ has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
troulouliou_dev has quit [Read error: Connection reset by peer]
Translat-Embedde has joined #ruby
<phaul>
I think I understand the flaky test issues I have. The problem is the assumtion that faker + factorybot would generate different data on subsequent calls. Sometimes it does sometimes it doesn't. if it doesn't assertions like expect {}.to change {} might fail, as we might change from the same to the same
troulouliou_dev has joined #ruby
troulouliou_dev has quit [Ping timeout: 250 seconds]
cschneid has joined #ruby
cschneid_ has quit [Ping timeout: 250 seconds]
troulouliou_dev has joined #ruby
lucasb has joined #ruby
Swyper has joined #ruby
oneeggeach has joined #ruby
mheld has joined #ruby
oneeggeach has quit [Client Quit]
buzzkill has left #ruby ["seeyas!"]
conta has joined #ruby
GodFather has joined #ruby
william1_ has quit [Ping timeout: 240 seconds]
troulouliou_dev has quit [Ping timeout: 265 seconds]
conta has quit [Quit: conta]
fluxAeon has quit [Ping timeout: 240 seconds]
Swyper has quit [Remote host closed the connection]
troulouliou_dev has joined #ruby
Swyper has joined #ruby
<TCZ>
is it possible to have object that will respond to every message
<phaul>
yes, override method missing. when the method search fails in the inheritance chain, it starts invoking method missing. If that finds anything it's executed instead. (top level will implement it and that's what causes the method missing error)
<phaul>
by top leve I mean top of the inheritance chain
<phaul>
&ri method_missing
<rubydoc>
I found 13 entries matching method method_missing. Use &list method_missing if you would like to see a list
<TCZ>
phaul i mean something like nil but returning nil when method is called on it
<al2o3-cr>
&. returns nil if there is a nil in the chain.
<rubydoc>
parser error at position 0 around `.'
markopasha has joined #ruby
clemens3 has quit [Read error: Connection reset by peer]
rmnull has quit [Quit: WeeChat 2.7.1]
rmnull has joined #ruby
d3bug has quit [Quit: Connection closed for inactivity]
markopasha has quit [Remote host closed the connection]
_phaul has joined #ruby
markopasha has joined #ruby
drincruz_ has joined #ruby
<havenwood>
al2o3-cr: Yeah, not the same issue, just both become as expected by adding a `.itself`.
<havenwood>
al2o3-cr: And both are not as expected without it.
phaul has quit [Ping timeout: 264 seconds]
<havenwood>
al2o3-cr: That's an interesting class of bugs.
d3bug has joined #ruby
<leftylink>
unfair
<al2o3-cr>
why would that be expected?
<al2o3-cr>
i don't get it.
<havenwood>
"not as expected"
drincruz_ has quit [Ping timeout: 256 seconds]
<al2o3-cr>
nil&.itself is just nil
<leftylink>
unfair because the .itself was inserted between & and .
<leftylink>
you wouldn't say -2*.itself*2
<havenwood>
al2o3-cr: I mean that the `.nil?` check then returns `true`, as expected.
<havenwood>
al2o3-cr: I'm commenting on a user perspective, where something being itself is presumed to not change behavior.
<havenwood>
al2o3-cr: The syntax involved changes, no doubt.
<al2o3-cr>
havenwood: it doesn't you not applying the operand.
<al2o3-cr>
*your
<al2o3-cr>
itself will always return itself.
<al2o3-cr>
if there is a nil anywhere in the chain it will result in nil
code_zombie has joined #ruby
<al2o3-cr>
so that, nil&.nil? is expected to be nil.
<al2o3-cr>
if you get what i'm saying.
<havenwood>
al2o3-cr: Yeah, that's fair—and I remember an issue ticket along those lines from back when it was added.
<havenwood>
al2o3-cr: It just reminded me of the other issue, but you're right this one isn't a bug. Matz says neither are. I'm not so sure on the (-2) one.
ule has quit [Remote host closed the connection]
william1_ has quit [Ping timeout: 250 seconds]
<al2o3-cr>
havenwood: cool, no worries, it just seems a lot of people have trouble understanding the sno or lo.
ule has joined #ruby
<havenwood>
al2o3-cr: sno lo?
<al2o3-cr>
safe navigation operator or lonely operator ;)
<havenwood>
al2o3-cr: Baby is now asleep, so my brain is present. :)
<al2o3-cr>
you made me type it ;( lol
<havenwood>
Haha
<al2o3-cr>
:P
<al2o3-cr>
xco: btw, in the kovid gem you created, you'd still need to create a custom cache class and pass an instance of that class to Typhoeus::Config.cache for it to work.
<al2o3-cr>
havenwood: you getting much sleep?
<havenwood>
al2o3-cr: never do
<havenwood>
al2o3-cr: so at least that stays the same :)
<al2o3-cr>
i can imagine :)
<al2o3-cr>
she'll be a ruby ninja in no time :P
<havenwood>
xco: Congrats on cutting your first gem!
william1_ has joined #ruby
<al2o3-cr>
xco: it's pretty awesome!
<xco>
al2o3-cr yeah i know something was off there but that's why i waited for a review, the custom cache class would be the one in the their README already right?
<al2o3-cr>
xco: exactly.
<xco>
havenwood thanks :)
<xco>
al2o3-cr thank you :D
<al2o3-cr>
xco: don't forget to pass it to `Typhoes::Config.cache` though ;)
<havenwood>
xco: A nit, but I think it'd be cleaner to do away with the `nineteen` namespace and have that behavior in `Kovid`.
<xco>
havenwood you mean the aliasing of "covid"?
<havenwood>
xco: The `kovid` and `covid` files.
<havenwood>
xco: exe/ ones
<xco>
aha, what about those?
<xco>
i copied code that's true but i didn't know how else to go about that, knew there's a better way
<havenwood>
xco: They look great, but I'd have the alias one require_relative the other—rather than pasting contennt.
<havenwood>
xco: Then you can make updates in one place.
<xco>
oooooooo
<xco>
then i could have one of the files empty right?
<xco>
is that what you mean?
<xco>
but the link you showed me is a .rb file :/
<xco>
i'm confused :D
<havenwood>
xco: Yeah, that's library style.
<havenwood>
xco: Sorry, the same pattern applies to executables and loadable libraries.
drincruz_ has joined #ruby
<havenwood>
xco: You have the alias load the original rather than repeating the content.
<havenwood>
xco: TL;DR: Have `covid` just `require_relative 'kovid'`.
<xco>
:D
<xco>
got it
<havenwood>
xco: The I feel like Kovid::Nineteen should be moved into Kovid, just so other conventions work more cleanly and to make it simpler. I could though see why you like it like you have it. I'd still flatten it, personally.
davispuh has joined #ruby
<xco>
i know some people would, i feel more comfortable this way, got enough "bashing" for doing it like how you're saying now and got used to this style
<havenwood>
xco: You could put the functions inside `class << self` at top level in Kovid, with just a `module_function`. These seem fairly reasonable includable, so that'd be a nice flexibility. And, none of these are private, so module_function works well.
<xco>
i used to do it like how you're describing it
<xco>
oh i even forgot about module_function!!!
<xco>
that's a good idea
<havenwood>
xco: Then You'd have Kovid require Kovid::Request, and I'd move Tableize to kovid/request/tableize.
drincruz_ has quit [Ping timeout: 240 seconds]
<havenwood>
xco: That way, Kovid requires Kovid::Request which requires Kovid::Request::Tableize.
<xco>
got it
<havenwood>
xco: To me, that structure mirrors the hierarchy.
ellcs has joined #ruby
<xco>
havenwood thanks a lot... unless you have more review comments :)
<xco>
yeah those are on my list of todos while i get a lot of the things pushed, but i'm keeping this convo to as reference for things i may forget so keep'em coming :D
<havenwood>
xco: It just reduces object churn by the GC. It's only a nit, but I just do it uniformly on things that are constant.
<_phaul>
omg, or whatever it is appropriate to say right now
schne1der has quit [Ping timeout: 264 seconds]
fluxAeon has joined #ruby
tfreedman has left #ruby ["User left"]
<_phaul>
what is &+ in simple terms? and why is it not &*
<al2o3-cr>
_phaul: take it easy
ChmEarl has quit [Ping timeout: 250 seconds]
<_phaul>
i'm easy. I've not read the discussion.. is this something I would understand from there?
<al2o3-cr>
_phaul: which one?
<_phaul>
nil &+ 2 being a valid expression in the first place
ChmEarl has joined #ruby
<al2o3-cr>
no, not that. -2.itself ** 2 equaling 4.
<leftylink>
I see I was tricked. nicely done.
<leftylink>
but now I have learned, and will not be tricked
<leftylink>
again in the future, I mean to say
<leftylink>
I congratulate the one who came up with the trick, it was quite clever. it would have been less clever if it looked something like its true form... but that is the nature of all trickery, I guess