简体   繁体   English

sinatra在rubymine 3.24中不会启动webrick

[英]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 我不知道为什么这个Sinatra hello World不会从我的Rubymine 3.2.4中启动webrick

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

Output in the Run window from Rubymine: 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 Rubymine使用相同的SDK,ruby 1.9.3

any Idea, anybody? 任何想法,有人吗?

If i use this Code, webrick starts from within my Rubymine 3.2.4. 如果我使用此代码,则webrick从我的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! 如果在#run行中发表评论! if app_file == $0 it wont start and sme behaviour as above. 如果app_file == $ 0,它将无法启动并出现上述sme行为。

Now i can go on and learn some more sinatra :-) 现在我可以继续学习更多sinatra了:-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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