x86sk has quit [Quit: Connection closed for inactivity]
dviola has joined #ruby
sagax has quit [Ping timeout: 258 seconds]
absolutejam4 has quit [Ping timeout: 268 seconds]
sagax has joined #ruby
gix has joined #ruby
darix has quit [Quit: may the packets be with you...]
darix has joined #ruby
x86sk has joined #ruby
Huck777 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_whitelogger has joined #ruby
queip has quit [Ping timeout: 245 seconds]
queip has joined #ruby
suukim has joined #ruby
schne1der has joined #ruby
fphilipe has quit [Ping timeout: 250 seconds]
schne1der has quit [Ping timeout: 246 seconds]
chalkmonster has quit [Quit: WeeChat 2.5]
fphilipe has joined #ruby
chalkmonster has joined #ruby
jenrzzz has joined #ruby
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chalkmonster has quit [Client Quit]
fphilipe has quit [Ping timeout: 264 seconds]
jenrzzz has quit [Ping timeout: 245 seconds]
kyrylo has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nowhere_man has joined #ruby
dviola has quit [Quit: WeeChat 2.5]
postmodern has quit [Quit: Leaving]
fphilipe has joined #ruby
howdoi has joined #ruby
chalkmonster has joined #ruby
leah2 has quit [Ping timeout: 245 seconds]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
leah2 has joined #ruby
Fernando-Basso has joined #ruby
tdy has quit [Ping timeout: 245 seconds]
tdy has joined #ruby
tdy has quit [Read error: error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac]
deepreds1 has joined #ruby
ellcs has joined #ruby
nowhere_man has quit [Remote host closed the connection]
nowhere_man has joined #ruby
AJA4350 has joined #ruby
schne1der has joined #ruby
jenrzzz has joined #ruby
x86sk has quit [Quit: Connection closed for inactivity]
jenrzzz has quit [Ping timeout: 258 seconds]
_whitelogger has joined #ruby
absolutejam4 has joined #ruby
ellcs has quit [Ping timeout: 264 seconds]
sh7d_ has joined #ruby
sh7d has quit [Ping timeout: 272 seconds]
megamos has joined #ruby
absolutejam4 has quit [Ping timeout: 245 seconds]
BH23 has joined #ruby
oetjenj has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sh7d_ has quit [Read error: Connection reset by peer]
sh7d has joined #ruby
Swyper has joined #ruby
Emmanuel_Chanel has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 258 seconds]
AJA4351 is now known as AJA4350
akem-hp has joined #ruby
akem-hp has quit [Remote host closed the connection]
Emmanuel_Chanel has quit [Read error: Connection reset by peer]
sh7d has quit [Ping timeout: 245 seconds]
matheusm1reira has joined #ruby
matheusmoreira has quit [Ping timeout: 246 seconds]
conta has joined #ruby
sh7d has joined #ruby
kyrylo has joined #ruby
fphilipe_ has joined #ruby
fphilipe has quit [Ping timeout: 250 seconds]
<barg>
is there a good simple web server in ruby e.g. python has python -m http.server, which is https://raw.githubusercontent.com/python/cpython/3.7/Lib/http/server.py and you can do python server.py and it will run that web server.. Is there a good ruby equivalent of that server.py ?
<havenwood>
barg: There are many ways to do it in Ruby. That's one way ^ to create a Ruby file that serves up its directory.
<havenwood>
barg: Does that work for your case?
<barg>
pretty much, thanks
<havenwood>
you're welcome
<barg>
is there any way I can convert un.rb from a library into a standalone program?
<havenwood>
barg: yes
<barg>
okay, i'll look into how libararies are written.. i guess the last line would have to be httpd
Huck777 has joined #ruby
<havenwood>
barg: I showed you how to just use un in a standalone program above. You could just extract the copyright notice, #setup and #httpd methods into a separate file if you wanted to. Or you can write your own little server to serve up the current directory.
<barg>
I don't mean use un in a standalone program. I mean just have one program that doesn't use un.. Like an edited un that is standalone
akem-hp has joined #ruby
<havenwood>
barg: Yes, you can edit and run Ruby code.
<barg>
i know i can i'm just that since i'm not that familiar with writing a library i'm not that familiar with converting a library into a standalone program
<barg>
i'm just that = it's just that
<havenwood>
barg: There's really no converting to be done.
Inline has joined #ruby
<barg>
i'm looking at what amendments need to be made to un.rb to make ruby un.rb work
<havenwood>
barg: Write `httpd` once at the end of the file?
<havenwood>
barg: Or remove the `def httpd` and corresponding `end` lines.
<havenwood>
barg: There's some option parsing stuff you could also remove.
<havenwood>
barg: Personally, I'd rewrite the option parsing.
dbugger has joined #ruby
dbugger has quit [Remote host closed the connection]
<barg>
oh wow that is little.. thanks. What if i'm looking to access headers though e.g. I want to make an edit to a web server so that it never sends a 304(not modified), so if a browser sends an http header of if-modified-since... then even if the file has not been modified i'd like the server to still send the file with status 200, rather than not sending the file and giving a 304. (I wouldn't
<barg>
make the server public it's purely technical curiosity)
<barg>
i know a server shouldn't do that!
jenrzzz has quit [Ping timeout: 245 seconds]
BH23 has quit [Ping timeout: 245 seconds]
<barg>
so I want to be playing around with some web sever code that has things like reading http request headers and sending htp tresponse headers
<barg>
htp=http
<havenwood>
barg: Are you familiar with Rack?
<barg>
i heard of it
<barg>
but i'm looking not to write my own web server from scratch, but just to edit an existing one
<havenwood>
barg: Rack is a specification that pairs web frameworks like Rails, Sinatra, Hanami, Roda, etc. use under the hood with web servers like Puma, Unicorn, Falcon, Passenger, etc.
<barg>
so which web server does sinatra use?
<havenwood>
barg: Sinatra can use any Rack webserver.
<havenwood>
barg: There's a default order that will be used when servers are available, with Puma in first place.
<havenwood>
barg: If you `gem install puma`, Sinatra will use Puma.
<havenwood>
barg: You can write a pure Rack app, without a framework like Sinatra. Here's one: run -> _env { [200, {}, ['Hi, barg'] }
<havenwood>
barg: Save that ^ as config.ru, and you can run it with the command: rackup
<havenwood>
barg: Or: puma
<barg>
thanks.. i'd used sinatra before but not noticed it said puma at the top when running the rb file that had require 'sinatra'.
<barg>
but yeah i see it now
<havenwood>
barg: Roda is a minimalist addition on top of Rack. I'd suggest giving it a look: http://roda.jeremyevans.net/
sh7d has quit [Quit: meh]
<barg>
ok, thanks
<havenwood>
barg: All it adds is a routing tree, and then there are optional plugins that you can cherry pick.
<havenwood>
barg: You can also use "Rack middleware" for things like changing response codes and headers.