sinatra

Hot deploy Ruby just like PHP: FTP upload file and valid immediately

我的梦境 提交于 2019-12-10 11:13:04
问题 Is it possible to hot deploy Ruby just like PHP? Normally I used FTP to upload the PHP file, then it will be available automatically. Can Ruby hot deploy its file like this? Your comment welcome. 回答1: Are you talking about a ruby on rails application ? If so, when deploying a rails application in production mode, the all application gets loaded in memory. So changing the files won't affect the running application. For hot restarting a rails application you will need to use solution such as:

Ruby Sinatra Hello World Error in `remove_const': constant URI::WFKV_ not defined (NameError)

最后都变了- 提交于 2019-12-10 08:31:20
问题 Just trying to get simple http server running and have no clue about ruby /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/backports/uri/common_192.rb:53:in `remove_const': constant URI::WFKV_ not defined (NameError) from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/backports/uri/common_192.rb:53:in `<module:URI>' from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/backports/uri/common_192.rb:19:in `<top (required)>' from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3

“Heroku push rejected, no Cedar-supported app detected” when trying to upload a Sinatra app with an existing git repo

╄→гoц情女王★ 提交于 2019-12-10 07:09:18
问题 I have an existing git repo for my personal website, which I am porting to Sinatra (mainly for templating, it's a static site). I do NOT want to lose/reset this git repository. When I try to push to Heroku, I get the error below. I have a config.ru file, a Gemfile, and a Gemfile.lock, along with some other stuff for Sinatra. Running rackup works, running bundle exec rackup works, and I didn't get any warnings from Heroku about missing dependencies. Am I missing something? I can post the

Setting up Sinatra to run in a subdirectory

风流意气都作罢 提交于 2019-12-10 06:49:56
问题 Now I am pretty new to Sinatra/Ruby/Apache but have inherited a Sinatra application to deploy. Currently Apache is set up to run from a document root (httpdocs) and I need to run a ruby application underneath a folder subdirectory such as: /httpdocs/webapp What do I need to do to get this up and running under a subdirectory? 回答1: This link might be helpful, it explains how to deploy a Sinatra app with Apache using Passenger (mod_rack): Deploying a Sinatra App with Apache and Phusion Passenger

Empty, uneditable pg_hba.conf file

风格不统一 提交于 2019-12-10 01:54:43
问题 I am trying to connect my Sinatra app to PostgreSQL database with this tutorial: http://samuelstern.wordpress.com/2012/11/28/making-a-simple-database-driven-website-with-sinatra-and-heroku/. Everything goes fine until I try to execute: rake:db migrate then I get this error: rake aborted! PG::ConnectionBad: fe_sendauth: no password supplied It seems like I should change my permissions in pg_hba.conf file, but, opening it, I see nothing. And, if I try to write something into it, it says it's "

How do I use .html.erb as a file extension for my views with Sinatra?

左心房为你撑大大i 提交于 2019-12-09 15:56:59
问题 If I have the following Sinatra code: get '/hi' do erb :hello end This works great if I have a file called views/hello.erb . However if I have a file called views/hello.html.erb Sinatra can't find the file and gives me an error. How do I tell Sinatra I want it to look for .html.erb as a valid .erb extension? 回答1: Sinatra uses Tilt to render its templates, and to associate extensions with them. All you have to do is tell Tilt it should use ERB to render that extension: Tilt.register Tilt:

Sinatra Variable Scope

Deadly 提交于 2019-12-09 15:36:41
问题 Take the following code: ### Dependencies require 'rubygems' require 'sinatra' require 'datamapper' ### Configuration config = YAML::load(File.read('config.yml')) name = config['config']['name'] description = config['config']['description'] username = config['config']['username'] password = config['config']['password'] theme = config['config']['theme'] set :public, 'views/themes/#{theme}/static' ### Models DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/marvin.db") class Post include

gzip assets in Sinatra app

亡梦爱人 提交于 2019-12-09 13:05:12
问题 I have been reading that zipping your assets using gzip will increase the performance of a site. There seems to be many ways to do this in a Sinatra application, so i was looking to confirm the most effective and easiest way to understand. I have come across use Rack::Deflater Which should be placed in my config.ru file before running the app, so in my case require './david' use Rack::Deflater run Sinatra::Application is that it? is it this simple, Just to add I know this will zip all my

Deploy Gollum wiki to Heroku

…衆ロ難τιáo~ 提交于 2019-12-09 08:39:14
问题 Gollum is "A simple, Git-powered wiki with a sweet API and local frontend." It's hosted on GitHub: http://github.com/github/gollum It seems to be a simple Sinatra app, and as such, it seems like it should be easy to deploy to Heroku. I can't seem to get it to work. Mostly because I know next to nothing about Rake and config.ru files. Is it even possible to deploy a Gollum wiki to Heroku? If so, what would my config.ru file need to look like? Update/Edit lib/gollum/frontend/app: module

Sinatra Sub-Directory Views

佐手、 提交于 2019-12-09 07:38:15
问题 I want to be able to get Sinatra views from sub-directories of ./views (such as ./views/admin). I know you can set the views like so: set :views, Proc.new { File.join(root, "templates") } But how would I be able to set this for only part of the file? 回答1: I'm not sure exactly what you're asking, but you can render a view in views/admin by doing this: erb :"admin/report" If you're asking how to automatically look in subdirectories of views when you call erb :report , I'm not sure how to do