我尝试运行应用程序,4567没有任何反应,所以我CTRL+C
但是继续收到此消息并且计算机就在那里
Juan-Gallardos-MacBook-Pro:lagunacave juangallardo$ ruby main.rb
Ignoring executable-hooks-1.3.2 because its extensions are not built. Try: gem pristine executable-hooks-1.3.2
Ignoring gem-wrappers-1.2.7 because its extensions are not built. Try: gem pristine gem-wrappers-1.2.7
Ignoring kgio-2.9.2 because its extensions are not built. Try: gem pristine kgio-2.9.2
Ignoring pg-0.17.1 because its extensions are not built. Try: gem pristine pg-0.17.1
Ignoring sqlite3-1.3.9 because its extensions are not built. Try: gem pristine sqlite3-1.3.9
[2015-03-12 18:56:47] INFO WEBrick 1.3.1
[2015-03-12 18:56:47] INFO ruby 1.9.3 (2012-12-25) [x86_64-darwin11.4.2]
== Sinatra/1.4.5 has taken the stage on 4567 for development with backup from WEBrick
[2015-03-12 18:56:47] INFO WEBrick::HTTPServer#start: pid=1262 port=4567
^C== Sinatra has ended his set (crowd applauds)
[2015-03-12 18:57:12] INFO going to shutdown ...
直到我关机。这种情况发生在我添加Google分析的应用中,如本教程所示
http://pydelion.com/2013/02/25/adding-google-analytics-to-sinatra-application/
推荐 rack-google-analytics gem
这是我的新文件
require 'sinatra'
require 'slim'
require 'sass'
require 'sinatra/reloader' if development?
require 'rack-google-analytics'
use Rack::GoogleAnalytics, :tracker => 'UA-60714558-1'
get('/styles.css'){ scss :styles }
get '/' do
slim :home
end
get '/contact' do
slim :contact
end
get '/privacy' do
slim :contact
end
not_found do
slim :not_found
end
以前的功能文件
require 'sinatra'
require 'slim'
require 'sass'
require 'sinatra/reloader' if development?
get('/styles.css'){ scss :styles }
get '/' do
slim :home
end
get '/contact' do
slim :contact
end
get '/privacy' do
slim :contact
end
not_found do
slim :not_found
end