rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
Ziyan has quit [Ping timeout: 260 seconds]
howdoi has quit [Quit: Connection closed for inactivity]
teclator has joined #ruby
polishdub has joined #ruby
Ziyan has joined #ruby
rvalue- has joined #ruby
rvalue has quit [Ping timeout: 240 seconds]
rvalue- has quit [Remote host closed the connection]
rvalue has joined #ruby
roshanavand has joined #ruby
dionysus69 has joined #ruby
Ziyan has quit [Ping timeout: 240 seconds]
leah2 has quit [Quit: trotz alledem!]
leah2 has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
Ziyan has joined #ruby
roshanavand has quit [Ping timeout: 272 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 244 seconds]
jpn has joined #ruby
jl- has joined #ruby
jl- has quit [Ping timeout: 244 seconds]
ollysmith has quit [Quit: ZNC 1.8.2+deb2+b5 - https://znc.in]
ollysmith has joined #ruby
bastienleonard has joined #ruby
gproto23 has joined #ruby
jpn has quit [Ping timeout: 272 seconds]
jpn has joined #ruby
Ziyan has quit [Ping timeout: 276 seconds]
Ziyan has joined #ruby
Rounin has joined #ruby
moldorcoder7_ has quit [Ping timeout: 240 seconds]
libsys has quit [Ping timeout: 276 seconds]
libsys has joined #ruby
jl- has joined #ruby
dionysus69 has quit [Ping timeout: 255 seconds]
jl- has quit [Ping timeout: 260 seconds]
Ziyan has quit [Ping timeout: 260 seconds]
Ziyan has joined #ruby
dionysus69 has joined #ruby
roshanavand has joined #ruby
Ziyan has quit [Ping timeout: 272 seconds]
Ziyan has joined #ruby
jpn has quit [Ping timeout: 272 seconds]
jpn has joined #ruby
roshanavand has quit [Ping timeout: 255 seconds]
Ziyan has quit [Ping timeout: 244 seconds]
Ziyan_ has joined #ruby
jpn has quit [Ping timeout: 260 seconds]
jpn has joined #ruby
<depesz>
Hi. I need to create http service that will respond to one specific request, basically getting data from request, passing to some underlying library, and outputting what the library returns. that's all. 1 request, nothing else. rails seem like an overkill. can you suggest what to use/how to do it?
jpn has quit [Ping timeout: 272 seconds]
<depesz>
i tried to use sinatra, but I can't find any way to disable logging, or how to make it fork to background. plus, sinatra seems to be dead. and I'm almost sure that it's overkill anyway.
<ox1eef>
depesz: roda is popular these days. https://github.com/ch1c0t/hobby looks interesting and light, found courtesy of adam12 - besides that, a simple rack app might do.
<depesz>
"rack" seems like the underlying thing. and given that my "handler" method is simple: SomeClass.new.process(request[param]).to_json - i think it will be the best thing to do.
<depesz>
need to read more on it.
jpn has joined #ruby
<ox1eef>
it is essentially a class that implements a #call method, receives a single argument by the name 'env', and returns a 3-element array: [status_code, headers(Hash), response_body] - response_body must implement #each. that's going from memory, and there might have been recent variations as of late.
markong has joined #ruby
jpn has quit [Ping timeout: 272 seconds]
roshanavand has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 240 seconds]
Ziyan_ has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
jl- has joined #ruby
jpn has joined #ruby
jl- has quit [Ping timeout: 272 seconds]
roshanavand has quit [Ping timeout: 272 seconds]
jpn has quit [Ping timeout: 272 seconds]
<adam12>
ox1eef: Indeed, it did look interesting.
<adam12>
ox1eef: I used Sinatra a few weeks ago for a client because I didn't want to introduce the Roda routing tree to them. I forgot how enjoyable Sinatra is.
Ziyan has joined #ruby
<ox1eef>
cool :)
Sankalp has quit [Ping timeout: 240 seconds]
<adam12>
I do wish Sinatra cribbed a few things from other places tho, like built-in Flash. And a nicer way to do named routes (like Flask has).
<ox1eef>
my impression of sinatra is that it is in maintainence mode, with not much innovation going on.
jpn has joined #ruby
Sankalp has joined #ruby
<adam12>
Hobby is very close to Hobbit
<adam12>
which I contributed to wayyy back in like 2014.
<adam12>
Where you define the routes using decorators.
<adam12>
Everyone seems to use class methods for verbs.
<ox1eef>
i'd like to see the DSL *just* for the router, then map to methods. ime the DSL style can turn into spagetti too easily.
<adam12>
I'm using hanami-router in gemdocs.org and it's been enjoyable to have SRP classes and a routes file again.
<ox1eef>
i like the route idea, that's what i have in mind.
<adam12>
Only downside of Hobby (and Hobbit, by extension) that I can see is the naive regex routing implementation.
<adam12>
Sinatra ofc adopted Mustermann, and Hanami Router uses a Trie of some sort.
<adam12>
Probably OK for small subset of routes but larger applications would suffer I bet.
jpn has quit [Ping timeout: 268 seconds]
<ox1eef>
indeed, but i like the concept - turning any old class into a rack app is a nice idea. i would just expand on it by removing the DSL, and using that for mapping routes only.
<Guest26nakilon>
I want to reraise it with a custom message but looks like not only the args are ignored, the whole method code makes no sense to me
gr33n7007h has joined #ruby
hasley is now known as mahler
Linux_Kerio has quit [Quit: Konversation terminated!]
Linux_Kerio has joined #ruby
roshanavand has joined #ruby
bit4bit has joined #ruby
bit4bit_ has joined #ruby
bit4bit has quit [Ping timeout: 260 seconds]
cocalero has joined #ruby
dionysus69 has quit [Ping timeout: 244 seconds]
moldorcoder7 has joined #ruby
Guest26nakilon has quit [Quit: Client closed]
cocalero has quit [Quit: Going offline, see ya! (www.adiirc.com)]
<depesz>
ox1eef: sorry for pinging you, but you mentioned roda, and I can't find any slack/irc/discord about it - do you know how to get "post payload" in roda? i need to receive data sent by: curl -i -XPOST --data-urlencode "$( < test.sql )" http://127.0.0.1:9292 ?
<depesz>
or should I just make id --data-urlencode "q=$( < test.sql )" ?
<adam12>
depesz: can you get it from r.body?
bit4bit_ has quit [Ping timeout: 260 seconds]
<adam12>
depesz: There was an IRC channel for Roda at one point in time, but Jeremy discontinued it when Freenode imploded and everyone moved to Libera. But I believe he opened Github discussions which is pretty good.
<depesz>
what is r.body? or, where can I find it documented?
<adam12>
depesz: Well, `r` is a `RodaRequest`. But a `RodaRequest` inherits from `Rack::Request`.
<depesz>
:( docs require A LOT of understanding of what is happening to find related docs. this leads to another question - how can I log something from within roda app ? in docs i see "common_logger" plugin, but there is no example on how to actually log something?
<adam12>
depesz: Well, common_logger is a logger format that's been around a long time and somewhat standard.
<adam12>
depesz: But you don't need to use the common_logger plugin to log things. Just make your own instance of a Logger class (from ruby stdlib) and log to that.
<adam12>
depesz: Using a global here (but only for demonstration, you should use a different approach). require "logger"; $logger = Logger.new; $logger.info("Hello world")
<depesz>
adam12: but shouldn't there be some kind of logger already available - there are things logged from the app?
<depesz>
or am I missing some big thing?
<adam12>
depesz: Not necessarily.
<adam12>
depesz: For Roda, that's not configured OOB. If you use `rackup`, the development environment middleware has a logger as default, in common logger format.
<depesz>
when I run: "rackup" i get some log to stdout. and I'd like to add something there. I probably can jiust puts ...
<adam12>
But only for requests. Not for generic log output.
<adam12>
You'd have to look at the source, because I don't know off hand, but the rackup logger might be placed in `env`.
<adam12>
Which means in your Roda app, you _might_ be able to do env["rack.logger"].info("Hello world")
kaivai has joined #ruby
<adam12>
But you'd have to check
<depesz>
ok. thanks.
<rapha>
y'all
<rapha>
i just discovered a disconcerting thing
<rapha>
`"مظفَّر".unicode_normalize(:nfc) == "مظفَّر"` is False! Why in the world would it not be true?! (Note: the word was hand-typed by me to make sure I type it as it's commonly typed)
howdoi has joined #ruby
<ox1eef>
what language is that?
<ox1eef>
if you idle here all the time, i suggest scroll up a bit, we discussed something similar and how you can analyze the bytes such a string is made up of
szkl has joined #ruby
<depesz>
ok. another set of questions. sorry, but I'm *VERY* new at this. where can I find information how to configure the app so that it will listen on some other port than default, make pidfile, daemonize, andmove logs from console to some file?
Ziyan_ has quit [Read error: Connection reset by peer]
Ziyan has joined #ruby
Sankalp has quit [Ping timeout: 272 seconds]
<adam12>
depesz: This is dependent on the application server you choose. You might be able to get it through rackup, or you could be more specific and use Puma or Unicorn or other application server.
<depesz>
so I have currently 4 avaialble: thin, webrick and puma. so I should be looking into these projects docs about configuration?
<depesz>
for now it looks to me that webrick, out of the box, behaves (for me) the best.
<adam12>
Maybe someone else knows, as I don't normally.
<depesz>
thanks.
orbyt has joined #ruby
roshanavand has quit [Remote host closed the connection]
roshanavand has joined #ruby
jl- has joined #ruby
jl- has quit [Ping timeout: 272 seconds]
jpn has quit [Ping timeout: 240 seconds]
sagax has quit [Remote host closed the connection]
axisys has quit [Remote host closed the connection]
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
jpn has joined #ruby
gproto23 has quit [Quit: Leaving]
Ziyan_ has joined #ruby
ur5us has joined #ruby
Ziyan has quit [Ping timeout: 272 seconds]
roshanavand has quit [Ping timeout: 272 seconds]
sagax has joined #ruby
bit4bit has joined #ruby
dionysus69 has joined #ruby
swaggboi has quit [Read error: Connection timed out]
swaggboi has joined #ruby
ur5us has quit [Ping timeout: 272 seconds]
markong has quit [Ping timeout: 276 seconds]
gproto23 has joined #ruby
orbyt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jl- has joined #ruby
orbyt has joined #ruby
jl- has quit [Ping timeout: 260 seconds]
Ziyan_ has quit [Read error: Connection reset by peer]
Ziyan has joined #ruby
ur5us has joined #ruby
ur5us has quit [Ping timeout: 268 seconds]
dionysus69 has quit [Ping timeout: 272 seconds]
<kenichi>
depesz: recommend using puma, then run `puma --help`, almost all your needs are there
Na_Klar has joined #ruby
orbyt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Na_Klar>
Why can't I File.open{f.read(1)} from /dev/input/event0 ? It works on /dev/input/mouse0 .. the pseudo files seems not to be any different in regard to rights an owner etc.? .read() works, but I fon't get any data. in shell cat /dev/input/event0 works and shows the raw data of the events ..
<Na_Klar>
(error msg is: invalid argument @io_fread Errno EInVAL)