简体   繁体   中英

sinatra in rubymine 3.24 wont start webrick

I wonder why this Sinatra hello World doesnt start webrick from within my Rubymine 3.2.4

require 'sinatra'
# set :bind, '0.0.0.0'
get '/' do
  "Hello" 
end

Output in the Run window from Rubymine:

C:\Ruby193\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:/Users/gonzo/RubymineProjects/jktest/sinatra.rb

Process finished with exit code 0

on the other hand, started this script on the commandline does the expected...

gonzo@uhura ~/prj/sinatra
$ /cygdrive/c/Ruby193/bin/ruby test.rb
[2015-04-04 07:50:11] INFO  WEBrick 1.3.1
[2015-04-04 07:50:11] INFO  ruby 1.9.3 (2014-11-13) [i386-mingw32]
== Sinatra (v1.4.6) has taken the stage on 4567 for development with backup from WEBrick
[2015-04-04 07:50:11] INFO  WEBrick::HTTPServer#start: pid=11212 port=4567

Rubymine uses same SDK , ruby 1.9.3

any Idea, anybody?

If i use this Code, webrick starts from within my Rubymine 3.2.4.

 # my_app.rb require 'sinatra/base' class MyApp < Sinatra::Base # ... app code here ... get '/' do "Hello" end # start the server if ruby file executed directly run! if app_file == $0 end 

If commented the line #run! if app_file == $0 it wont start and sme behaviour as above.

Now i can go on and learn some more sinatra :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM