RailsCasts Pro episodes are now free!
Learn more or hide this
Resources
root :to => "home#index" root :to => HomeController.action(:index) root :to => HomeApp match "/about" => redirect("/aboutus") match "/aboutus" => "info#about" resources :products match "/p/:id" => redirect("/products/%{id}") match "/processes" => ProcessesApp.action(:index)
gem "sinatra"
class HomeApp < Sinatra::Base get "/" do "Hello from Sinatra!" end end
class ProcessesApp < ActionController::Metal include ActionController::Rendering append_view_path "#{Rails.root}/app/views" def index @processes = `ps -axcr -o "pid,pcpu,pmem,time,comm"` render end end
<h1>Processes</h1> <pre><%= @processes %></pre>