Discussion:
Sinatra not running from ./app (old style of routes)
Tim Uckun
2017-09-27 11:03:51 UTC
Permalink
I have an app and it runs fine if I do rackup or puma but it doesn't run
when I do ruby app.rb I tried putting

require 'sinatra'

run Sinatra::Application on the bottom but it says run is not defined.


This used to work but I have no idea what I did to make it stop working.

The reason I am asking is that puma does not run inside of a docker
container for some reason giving me the error "no app specified".

Thanks in advance for your help.
--
You received this message because you are subscribed to the Google Groups "sinatrarb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sinatrarb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Mike Pastore' via sinatrarb
2017-09-28 01:57:32 UTC
Permalink
Post by Tim Uckun
I have an app and it runs fine if I do rackup or puma but it doesn't run
when I do ruby app.rb I tried putting
require 'sinatra'
run Sinatra::Application on the bottom but it says run is not defined.
If you're writing an app in classic mode, you don't need to run it at the
bottom of the file; it runs automatically if invoked directly (i.e. ruby
app.rb). If you're writing an app in modular mode, you can put a run! at
the bottom of the class to run it automatically if it's invoked directly:

# app.rb
class MyApp < Sinatra::Application
get '/' do
'Hello, world!'
end

run! if $0 == __FILE__
end

So maybe that's what you're thinking of?
--
You received this message because you are subscribed to the Google Groups "sinatrarb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sinatrarb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Tim Uckun
2017-09-28 04:50:54 UTC
Permalink
Post by 'Mike Pastore' via sinatrarb
Post by 'Mike Pastore' via sinatrarb
If you're writing an app in classic mode, you don't need to run it at the
bottom of the file; it runs automatically if invoked directly (i.e. ruby
app.rb). If you're writing an app in modular mode, you can put a run! at
I have it in the classic mode but for some reason it doesn't run when I
invoke it that way.
--
You received this message because you are subscribed to the Google Groups "sinatrarb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sinatrarb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Mike Pastore' via sinatrarb
2017-09-28 17:44:22 UTC
Permalink
Post by Tim Uckun
I have it in the classic mode but for some reason it doesn't run when I
invoke it that way.
Are you "running" the file that contains the require "sinatra" (or the
Bundler.require) or are you running a file that requires that file? I'm
guessing the latter. The autorun feature only works if you run the file
that contains the require "sinatra" (or the Bundler.require).
--
You received this message because you are subscribed to the Google Groups "sinatrarb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sinatrarb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...