I have an app deployed on Heroku. I can access the remote heroku console from my local computer via the command:
heroku console
I have the Hirb gem installed in my app by putting Hirb in my gemfile, I am able to but cannot get any of the Hirb formatting to show up.
In Heroku console, I can run:
Hirb.enable
and in return, get
=> true
But when I run User.all I don't get a table in return, just the old unformatted records. Is there anyway to get Hirb working on Heroku console?
There is a workaround described in a GitHub issue at
https://github.com/cldwalker/hirb/issuesearch?state=closed&q=heroku#issue/37
Related
I'm trying to run byebug so that it works with Heroku Local.
By default, the breakpoints don't give me access to an irb console like they might if I was using rails s. I tried byebug's remote debugging as described here but something about running the byebug server slows my local server down to a crawl and it's unusable. Is there anyway to get byebug to work with Heroku Local? Is there any alternative debugging solution that works well for Rails and Heroku Local?
I updated a gem(rtf) in my ruby on rails app through the Gemfile. The app works fine on my localhost but when I pushed changes to heroku and tried 'bundle install' within heroku bash. I see that the gem has been installed based on the log
Using rtf (0.3.3)
Following this, I did a
heroku restart --a myapp
however, when i tried the app on heroku, it still cant recognize the lib installed through the gem, i get the following error(normally appears when the library cannot be reached for command "require 'RTF'").
cannot load such file -- RTF
What am I doing wrong in heroku?
I think you misunderstand how Heroku works. When you run a bash shell on your app, nothing you do on that dyno will affect any other dynos for your app (like your web dynos). Heroku runs bundle install for you when you deploy your app and if your Gemfile is configured correctly all the gems will be installed.
the answer by sevenseacat is right- i had just got the case wrong-
require 'rtf'
works fine. In OSX, it ignores case in the command require 'RTF'
Can't quite find the answer for my error in related posts.
I'm working my way through the on-line version of the Ruby on Rails Tutorial, Chapter 2
http://ruby.railstutorial.org/chapters/a-demo-app#top
and I'm near the bottom where I've created a small 2-table database and committed it to git. But it fails when I try to deploy with 'git push heroku master'. The same command worked previously before I added the tables to the app (and before I got Mongrel to work on the demo_app, I think).
My bundle includes Ruby 1.8.7, Mongrel 1.1.5 and sqlite3 1.3.3. I'm getting the line:
Installing mongrel (1.1.5) with native extensions /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/installer.rb:483:in 'rescue in block in build_extensions':ERROR: Failed to build gem native extension. (Gem:Installer::ExtensionBuildError).
How do I get around this problem? Can Heroku handle Mongrel at all? Or is it due to having a sqlite3 database? Why does the error mention Ruby1.9.2 when that's not in my bundle?
You don't need to use mongrel at all, and should simply remove it from your Gemfile. Whenever you see a reference to starting mongrel in your tutorial, just use ./script/server instead (or rails server if you're on Rails 3). It will run WebBrick, and that's good enough for development work.
If you really want to retain mongrel for local use you can group it as follows in Gemfile.
group :development do
gem "mongrel"
end
Note that you will likely still have to tell Heroku to not bundle your development gems or you'll run into the same error. If you're on the Cedar stack, then just get rid of the mongrel gem entirely.
I'm trying to create a new app on heroku but it seems no matter what I do heroku runs ruby 1.9.1 rather than 1.9.2
I've created my app...
heroku create writings --stack cedar
Then I've pushed my develop branch to master on heroku for testing
git push heroku develop:master
But the app runs with errors... looking in the heroku logs.. this seems to be the offending error.
/app/vendor/bundle/ruby/1.9.1/gems/execjs-1.1.3/lib/execjs/runtimes.rb:43:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
Which shows that it's running ruby 1.9.1 does it not?
If I run heroku config it shows...
heroku config
DATABASE_URL => postgres://mxlvaczibv:wMtsU7TrPMQM5n-X5SfX#ec2-50-19-226-179.compute-1.amazonaws.com/mxlvaczibv
GEM_PATH => vendor/bundle/ruby/1.9.1
LANG => en_US.UTF-8
PATH => vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
RACK_ENV => production
RAILS_ENV => production
SHARED_DATABASE_URL => postgres://mxlvaczibv:wMtsU7TrPMQM5n-X5SfX#ec2-50-19-226-179.compute-1.amazonaws.com/mxlvaczibv
Is this not showing it is running 1.9.1? I'm totally confused... I thought the cedar stack ran 1.9.2. Any help appreciated.
Thanks, mark.
It does not show that it is running Ruby 1.9.1. Because the standard library changed very little between 1.9.1 and 1.9.2, the same path is used for both of them. You will notice this is not just on Heroku.
It looks like execjs is expecting to have a JS runtime installed on the system. Apparently Celadon Cedar does have one (NodeJS), but it won't work until rails 3.1rc5 arrives. Until then, follow the intructions in this answer.
I am using Ruby 1.9.2 and Heroku as well. I have this in my Gemfile. I remember having some sort of javascript errors when trying to deploy to Heroku before as well, I'm pretty sure this solved it.
group :production do
gem 'therubyracer-heroku', '0.8.1.pre3'
end
Try using:
heroku create --stack bamboo-mri-1.9.2
I know the command that works to do this, but I don't understand why. What is `...` doing in this context.
I know I can run:
heroku console
`gem list`
or
heroku console
`gem list`.split("\n")
to get a nice output, but I don't understand what these are doing. Why the ``?
I've updated this in-case someone happens to come across heroku console as it's been disabled.
heroku run gem list
Show gems installed via :git
heroku run bundle show
The back ticks effectively making a system call and return the response that was written to stdout. Take a look at the Kernel ruby docs for more info.
heroku console is basically running an irb console on the remote computer, so you're in a ruby console when you do it. The backticks (`) are a standard way to run a system command in ruby.
In Ruby, you can run a system command either by using Kernel#exec or by placing the contents in backticks. This is the same as typing gem list on the command line and getting the result back as a string.
For example
heroku run 'gem list'
Becouse
heroku console
is removed from heroku