<riceandbeans>
shit you're right I have an idea hold on
cadillac_ has joined #ruby
<baweaver>
That, and Open3 has a nicer API if you want to capture status codes
<baweaver>
when trying to refactor, group similar things and find out what they have in common, then look for ways to compose the differences with smaller functions.
akaiiro has quit [Remote host closed the connection]
<riceandbeans>
andi: you're going to end up with a monstrous maniest
<riceandbeans>
andi: I worked at a place that did that for nagios setups, the puppet runs took 20+ minutes
<andi>
So it's only for a particular element in my manifest. It's only an array which keeps the list of domains that is managed by puppet. The puppet configuration is written in a way that this manifest really only keeps the array of zones, nothing more.
<andi>
What I like to achieve is to automatically generate this list to configure our nameservers out of a json file which I can get from an api. This enables us to manage our domains in a mysql database which will make the process to add new domains much easier.
<andi>
It would be a great headache if I would try to build the whole puppet configuration like that, you're right.
<riceandbeans>
Well, we had like 30,000 entries build into this massive manifest
<andi>
Yes, ok this will take its time. :)
<andi>
So can you tell me what I'm doing wrong while create my hash?
reber has quit [Remote host closed the connection]
suukim has joined #ruby
sameerynho has joined #ruby
micutzu has quit [Ping timeout: 248 seconds]
snickers has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ta_ has quit [Remote host closed the connection]
snickers has joined #ruby
karuna has quit [Quit: Connection closed for inactivity]
micutzu has joined #ruby
jottr has joined #ruby
jottr has quit [Ping timeout: 240 seconds]
sepp2k has joined #ruby
reber has joined #ruby
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
biberu has joined #ruby
mtkd has quit [Ping timeout: 260 seconds]
BlopMonster has joined #ruby
mtkd has joined #ruby
BlopMonster has quit [Ping timeout: 264 seconds]
amar_ has joined #ruby
amar_ has quit [Ping timeout: 265 seconds]
za1b1tsu has quit [Quit: WeeChat 2.1]
micutzu has quit [Ping timeout: 248 seconds]
kliq has joined #ruby
amar_ has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
amar__ has joined #ruby
Azure has quit [Read error: Connection reset by peer]
Azure has joined #ruby
amar_ has quit [Ping timeout: 240 seconds]
ramfjord has quit [Ping timeout: 265 seconds]
amar__ has quit [Remote host closed the connection]
amar_ has joined #ruby
plexigras has joined #ruby
amar_ has quit [Ping timeout: 248 seconds]
za1b1tsu has joined #ruby
Mike11 has joined #ruby
FernandoBasso has joined #ruby
za1b1tsu has quit [Quit: WeeChat 2.1]
<FernandoBasso>
What people use for unicode string manipulation?
<dminuoso>
FernandoBasso: String?
<dminuoso>
FernandoBasso: What are you trying to do?
<FernandoBasso>
I know of unicode_utils, activesupport (I guess that is rails only?)
<FernandoBasso>
Hmm. I remember 'ação'.upcase would not upcase the chars 'ç' and 'ã' in the past.
<al2o3-cr>
FernandoBasso: does now ;)
<FernandoBasso>
Just noticed. Looking for the release notes where this appeared.
<qknight>
Installing oj 2.12.14 (was 3.6.2) with native extensions
<qknight>
Fetching oj 2.12.14 (was 3.6.2)
<qknight>
is that some transitive dependency which i missed somehow?
<qknight>
however, it worked for the json update...
konsolebox has joined #ruby
akem_ has joined #ruby
akem has quit [Ping timeout: 264 seconds]
kapil___ has joined #ruby
ramfjord has joined #ruby
desperek has quit [Quit: xoxo]
akem__ has joined #ruby
ramfjord has quit [Ping timeout: 264 seconds]
akem_ has quit [Ping timeout: 264 seconds]
ciscam has quit [Ping timeout: 240 seconds]
ciscam has joined #ruby
BaroMeter has quit [Ping timeout: 260 seconds]
jottr has quit [Ping timeout: 265 seconds]
akem_ has joined #ruby
mtkd has quit []
akem__ has quit [Ping timeout: 260 seconds]
qknight has quit [Quit: Lost terminal]
shinnya has joined #ruby
akem_ has quit [Quit: Leaving]
eising has joined #ruby
<eising>
Hey, I'm reviving an old project of mine that I finished about four years ago. That time it was written in Ruby 1.9 and used the Sinatra microframework together with Sequel ORM. Since I'm effectively salvaging bits of the project in to a new project, I was wondering anyone had any opinions whether I should remain in these frameworks or if in this four years time, they have been obsoleted?
<apeiros>
sinatra and sequel are both thriving
<apeiros>
so no reason from the side of those two to switch to something else
<apeiros>
@ eising ^
<eising>
That's good to hear, thanks :)
<eising>
It's a bit of a task this. Understanding what I was thinking 4+ years ago, even though I actually documented things pretty well.
<eising>
I imagine most of my work will be on the front-end side, since that has moved quite a bit since then
eelster has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
stretchlimo has joined #ruby
AJA4350 has joined #ruby
stretchlimo has quit [Client Quit]
jottr has joined #ruby
minimalism has quit [Quit: minimalism]
jottr has quit [Ping timeout: 248 seconds]
karapetyan has joined #ruby
karapetyan has quit [Remote host closed the connection]
karapetyan has joined #ruby
karapety_ has joined #ruby
Silox| has joined #ruby
fmcgeough has joined #ruby
karapetyan has quit [Ping timeout: 265 seconds]
AJA4350 has quit [Remote host closed the connection]
AJA4350 has joined #ruby
whowantstolivefo has quit [Ping timeout: 260 seconds]
dionysus69 has quit [Ping timeout: 260 seconds]
agent_white has quit [Quit: napteim]
whowantstolivefo has joined #ruby
amar_ has joined #ruby
whowantstolivefo has quit [Ping timeout: 248 seconds]
braindead_ has joined #ruby
cyberg has joined #ruby
dionysus69 has joined #ruby
chamar has joined #ruby
whowantstolivefo has joined #ruby
fab has joined #ruby
fab has quit [Client Quit]
fmcgeough has quit [Quit: fmcgeough]
chamar has quit [Quit: Leaving]
shinnya has quit [Ping timeout: 264 seconds]
sepp2k has quit [Read error: Connection reset by peer]
leitz has joined #ruby
DLSteve has joined #ruby
fmcgeough has joined #ruby
t0xik has quit [Quit: Connection closed for inactivity]
<braindead_>
hello all
dreamthese has quit [Ping timeout: 248 seconds]
<havenwood>
braindead_: hi
ciscam has quit [Ping timeout: 260 seconds]
<braindead_>
i am a ruby noob (programming in general) and trying to tweak a script. lobste.rs in question
ciscam has joined #ruby
<braindead_>
there is one part where time is shown. like "x minutes ago"
<braindead_>
its looking like this: ago = "#{hours} #{'hours'.pluralize(hours)} ago"
catbusters has quit [Quit: Connection closed for inactivity]
<braindead_>
and i want to translate it to german so i tried something like this: ago = "vor #{hours} #{'Stunde'.pluralize(hours)}"
dreamthese has joined #ruby
<braindead_>
that is working. but there is a problem with the pluralize(hours). the result of this will be "vor 1 Stunde" which is correct. but also "vor 2 Stundes" the s at the end is because of the english pluaralize(hours) function
<braindead_>
i tried for many hours now to change it somehow with yml files but i failed
<braindead_>
is there a way to hardcode it so it shows: "1 Stunde" and "2 Stunden"?
clemens3 has joined #ruby
pabs has quit [Ping timeout: 265 seconds]
<braindead_>
or any other "simple" solution to localize it
Diogo has joined #ruby
<braindead_>
i am thinking of something like if #{hours} <=1 'Stunde' else 'Stunden' .. of course this is not the syntax but maybe something like this would do the trick
<havenwood>
braindead_: This would just put an "n" on the end of everything, for example: ActiveSupport::Inflector.inflections { |inflect| inflect.plural /(.+)/, '\1n' }
<havenwood>
braindead_: Do you understand this part?: inflect.plural /(.+)/, '\1n'
<braindead_>
no :(
<havenwood>
braindead_: The `//` is a Regexp literal. The parens are a match. The `.+` means at least one non-newline character. The `\1` means the first match. The `n` is the character "n" added to each word.
karapetyan has joined #ruby
<cdunklau>
wow the plural for Nein is really Neins
<cdunklau>
alles klar
<havenwood>
braindead_: It'd be quite a challenge to add regexp rules to support the German language.
fmcgeough has quit [Quit: fmcgeough]
fmcgeough has joined #ruby
<braindead_>
so how exactly would this example look like? "vor #{hours} #{'Stunde'.pluralize(hours)}"
<braindead_>
to reload the script/app is it enough to restart the rails server?
<havenwood>
braindead_: yup
<braindead_>
than its not working.
<braindead_>
ok, ill give it a try in rails
<braindead_>
thank you for the input though
<havenwood>
you're welcome
aeontech has quit [Quit: aeontech]
fmcgeough has quit [Quit: fmcgeough]
dionysus69 has quit [Ping timeout: 256 seconds]
mikecmpbll has joined #ruby
BlopMonster has joined #ruby
<havenwood>
braindead_: The ActiveSupport::Inflector solution from #ruby definitely works. Gist your: config/initializers/inflections.rb
<havenwood>
braindead_: Meant that to be in #RubyOnRails. If you gist the file there I'm sure someone can spot what's up.
<braindead_>
except for your line its empty
<braindead_>
just some comments
<braindead_>
thats what i included: ActiveSupport::Inflector.inflections(:de) { |inflect| inflect.irregular 'Stunde', 'Studen' }
Esa_ has joined #ruby
BlopMonster has quit [Ping timeout: 256 seconds]
pabs has quit [Ping timeout: 264 seconds]
pabs has joined #ruby
<havenwood>
braindead_: And that's in your?: config/initializers/inflections.rb
<havenwood>
braindead_: Try restarting. Maybe Spring is borking you.
<havenwood>
Dunno! Works on my machine.
<braindead_>
i mean i could get rid of the :de to test it again
<braindead_>
hold on
<braindead_>
cant believe it. without de it worked
<braindead_>
so this is not correct
<braindead_>
config.i18n.default_locale = :de
<braindead_>
i added this to application.rb
<eam>
why don't we ever run production on developer machines, the code always works there :D
* havenwood
ships his laptop to be installed on a rack in prod
<eam>
lol
<braindead_>
to add the same thing for "Minute" and "Minuten" do i need to copy the whole thing or can i squeeze it in there?
<havenwood>
braindead_: Seems you just haven't setup your i18n, in your application_controller.rb for example. The Rails channel is still the best place for this. ;-P
<rabajaj_>
basically i am not being able to interpolate a key from the hash
minimalism has joined #ruby
nowhere_man has quit [Ping timeout: 256 seconds]
Diogo has quit [Quit: Connection closed for inactivity]
pabs has quit [Ping timeout: 265 seconds]
pabs has joined #ruby
Puffball has quit [Quit: Puffball]
RougeR has joined #ruby
Mike11 has joined #ruby
pabs has quit [Ping timeout: 255 seconds]
pabs has joined #ruby
tdy1 has joined #ruby
t0xik has joined #ruby
ellcs has joined #ruby
ellcs has quit [Client Quit]
mzo has quit [Ping timeout: 248 seconds]
za1b1tsu has quit [Quit: WeeChat 2.1]
RougeR has quit [Ping timeout: 256 seconds]
za1b1tsu has joined #ruby
kmurphy4 has joined #ruby
ur5us has joined #ruby
psprint_ has joined #ruby
<psprint_>
Hello. Do someone use ruby at command line, with the -e switch, like perl one-liners?
mzo has joined #ruby
\void has joined #ruby
RougeR has joined #ruby
RougeR has joined #ruby
RougeR has quit [Changing host]
psprint_ is now known as psprint
Giphy[m] has joined #ruby
za1b1tsu has quit [Quit: WeeChat 2.1]
conta has quit [Quit: conta]
jottr has joined #ruby
cjohnson has quit [Remote host closed the connection]
RougeR has quit [Ping timeout: 260 seconds]
<apeiros>
psprint: sometimes for small pieces of code, why?
<psprint>
apeiros: I'm writing in-prompt colorized keywords, braces, already have such function for awk & perl
jottr has quit [Ping timeout: 245 seconds]
<psprint>
something like this, requires ruby to have "compile, syntax check only" perl example: https://asciinema.org/a/186098
<apeiros>
looks interesting
<psprint>
I can code this for Ruby, two issues a) do people use Ruby inline? b) does ruby have "syntax error checker"
<apeiros>
ruby -c
<apeiros>
for syntax check
<lupine>
"use ruby inline" ?
<apeiros>
but I think `ruby -e` is used rather rarely
<psprint>
lupine: like perl highlighters, the 1 liners
<apeiros>
irb/pry is much more often used
<Zarthus>
i would prefer irb/pry over a CLI highlighting with `ruby -e` too
<psprint>
I just make my own version
kmurphy4 has quit [Quit: kmurphy4]
<Zarthus>
the moment my expression becomes too lengthy I'm fucked.
isene has joined #ruby
akaiiro has joined #ruby
<isene>
Is there a way to compile a ruby program into a stand-alone executable on Linux?
pabs has quit [Ping timeout: 240 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chussenot has joined #ruby
mtkd has quit [Ping timeout: 276 seconds]
bascht has joined #ruby
iceskins[m] has joined #ruby
luna_x[m] has joined #ruby
jonjits[m] has joined #ruby
intheclouddan has joined #ruby
haylon_ has joined #ruby
Hanma[m] has joined #ruby
redlegion[m] has joined #ruby
velu_aon[m] has joined #ruby
turt2live has joined #ruby
aviraldg has joined #ruby
KevinMGranger has joined #ruby
zalipuha[m] has joined #ruby
karapetyan has joined #ruby
mtkd has joined #ruby
karapetyan has quit [Remote host closed the connection]
mikeiniowa has joined #ruby
pabs has joined #ruby
karapetyan has joined #ruby
ta_ has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
megamos has quit [Ping timeout: 245 seconds]
kmurphy4 has joined #ruby
houhoulis has quit [Remote host closed the connection]
RougeR has joined #ruby
RougeR has joined #ruby
RougeR has quit [Changing host]
<RougeR>
zmo: you can also use instance and global the same way fyi. glad you found it though
akaiiro has quit [Ping timeout: 260 seconds]
megamos has joined #ruby
amar has quit [Remote host closed the connection]
Some-body_ has joined #ruby
DarthGandalf has quit [Ping timeout: 256 seconds]
Some-body_ is now known as DarthGandalf
gr33n7007h has joined #ruby
al2o3-cr has quit [Ping timeout: 240 seconds]
chussenot has quit [Quit: chussenot]
megamos has quit [Quit: Leaving]
biberu has quit []
akaiiro has joined #ruby
mzo has quit [Ping timeout: 256 seconds]
eyedrop has joined #ruby
amar has joined #ruby
Mike11 has quit [Quit: Leaving.]
pabs has quit [Ping timeout: 245 seconds]
pabs has joined #ruby
megamos has joined #ruby
<eyedrop>
Hello everyone. I've a very newbie problem and can't understand why it doesn't work. https://pastebin.com/raw/1V0nu5Xa Any explanation would be really appreciated.
<ruby[bot]>
eyedrop: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
<eyedrop>
akaiiro: Is it because of the order of variables? Just trying to understand how it works.
yaiyaichu has joined #ruby
clemens3_ has quit [Ping timeout: 276 seconds]
<akaiiro>
eyedrop yes, the order of the instructions matter
clemens3 has quit [Ping timeout: 256 seconds]
<eyedrop>
akaiiro: Thanks.
BlopMonster has joined #ruby
nicht has quit [Remote host closed the connection]
nicht has joined #ruby
orbyt_ has joined #ruby
<yaiyaichu>
Hi all. I hope you guys don't mind if I bother you with a question :) . I'm trying to run my ruby program (a web scraper) as a cronjob with the whenever gem. My cron job command cds into the directory with the Gemfile and runs the script with bundle exec. When the scheduled job runs, bundler says it cannot find the gem ffi in any of the sources. Any thoughts on why that happens? - The cronjob is run with
<yaiyaichu>
my user. Also, I use rbenv.
reber has quit [Remote host closed the connection]
<yaiyaichu>
Please let me know if you need any additional info, and I'll gladly provide it.
psychicist__ has quit [Ping timeout: 260 seconds]
mtkd has quit []
schleppel has quit [Quit: Konversation terminated!]
<apeiros>
yaiyaichu: the usual suspect there is a different env
<apeiros>
can even be the case if it's run with the same user, since that doesn't necessarily mean it's a login shell
<apeiros>
but I don't know enough about rbenv to give a sensible tip
<apeiros>
s/tip/hint/
eyedrop has quit [Quit: Page closed]
<braindead_>
when i run my production enviroment i get IP - - [09/Jun/2018:22:06:08 UTC] "GET / HTTP/1.0" 301 0
<braindead_>
anybody an idea what that could be?
<braindead_>
i mean it sounds like nginx redirect problem but its working in dev
BlopMonster has quit [Ping timeout: 264 seconds]
megamos has quit [Ping timeout: 265 seconds]
ur5us has quit [Remote host closed the connection]
ramfjord has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
dviola has joined #ruby
paraxial has quit [Read error: Connection reset by peer]
paraxial has joined #ruby
<akaiiro>
braindead_ are you using the same commands and settings to start you application in both environments?
<braindead_>
akaiiro: i dont know if you mean this but to start dev i just use "rails server -b 0.0.0.0" and for prodution "rails server -e production" .. do you mean this?
<akaiiro>
braindead_ yes, for example, I use this in production `bundle exec puma -C ./config/puma.rb` and then in nginx `upstream puma { server my_server_name:3000 }`