shotgun

Sinatra and session variables which are not being set

徘徊边缘 提交于 2020-01-12 03:32:09
问题 For some reason, session variables are not being set in my app. I am using Sinatra 1.2.1. Here is a piece of code: module GitWiki class App < Sinatra::Base configure do enable :sessions set :app_file, __FILE__ set :root, File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) set :auth do |bool| condition do redirect '/login' unless logged_in? end end end helpers do def logged_in? not @user.nil? end end error PageNotFound do page = request.env["sinatra.error"].name redirect "/#{page}

Errors with shotgun gem and msvcrt-ruby18.dll when running my Sinatra app

不问归期 提交于 2019-12-08 07:12:58
问题 Greetings, Every time I make a change to a Sinatra app I'm working on and try to refresh the browser (located at http://localhost:4567/) the browser will refresh and, the console window seems to restart the WEB brick server. The problem is that the content in the browser window does not change. A friend of mine told me it was a shotgun issue and referred me to rtomayko's shotgun gem: http://github.com/rtomayko/shotgun On this page I read that the shotgun gem would basically solve my problem,

Errors with shotgun gem and msvcrt-ruby18.dll when running my Sinatra app

↘锁芯ラ 提交于 2019-12-06 15:41:04
Greetings, Every time I make a change to a Sinatra app I'm working on and try to refresh the browser (located at http://localhost:4567/ ) the browser will refresh and, the console window seems to restart the WEB brick server. The problem is that the content in the browser window does not change. A friend of mine told me it was a shotgun issue and referred me to rtomayko's shotgun gem: http://github.com/rtomayko/shotgun On this page I read that the shotgun gem would basically solve my problem, allowing the changes made to my app to show up in the browser window after I refresh it. So I

Sinatra and session variables which are not being set

柔情痞子 提交于 2019-12-03 02:44:29
For some reason, session variables are not being set in my app. I am using Sinatra 1.2.1. Here is a piece of code: module GitWiki class App < Sinatra::Base configure do enable :sessions set :app_file, __FILE__ set :root, File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) set :auth do |bool| condition do redirect '/login' unless logged_in? end end end helpers do def logged_in? not @user.nil? end end error PageNotFound do page = request.env["sinatra.error"].name redirect "/#{page}/edit" end before do content_type "text/html", :charset => "utf-8" @user = session[:user] end get "

Use different Procfile in development and production

不问归期 提交于 2019-11-28 15:28:57
问题 I have a homemade Sinatra application for which I intend to use Heroku to host it. I use foreman and shotgun in development, with the following Procfile: web: shotgun config.ru -s thin -o 0.0.0.0 -p $PORT -E $RACK_ENV It works great with both development and production. But the thing is, I don't want to use shotgun in production since it's too slow. Can we use separate Procfile configurations for both dev and prod? 回答1: You could use two Procfiles (e.g. Procfile and Procfile.dev ) and use

Running fork(2) from Windows with Cygwin. Possible?

扶醉桌前 提交于 2019-11-27 18:53:49
问题 I am trying to use a Ruby gem called shotgun that requires fork(2) command which I discovered is aa Linux command, and might be available in Cygwin. Is it possible to make it available through Windows command shell? 回答1: fork(2) is kludgey under Cygwin, as the Windows process model does not easily allow it to happen. Cygwin may allow its spawn to use it, but you're going to suffer a serious performance hit as Cygwin has to emulate everything by hand -- including copying the executable data,