Heroku and RoR server on Ubuntu 64bit 11.04 - ruby-on-rails-3

So I want to deploy my app to Heroku, registered the account and did other necessary things. But I ran on a problem running command heroku keys:add. Here's the errors I get:
ruby#Rubuntu:~/rails_projects/first_app$ heroku keys:add
/home/ruby/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- readline (LoadError)
from /home/ruby/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/ruby/.rvm/gems/ruby-1.9.2-p180#rails3tutorial/gems/heroku-2.1.4/lib/heroku/command/run.rb:1:in `<top (required)>'
from /home/ruby/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/ruby/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/ruby/.rvm/gems/ruby-1.9.2-p180#rails3tutorial/gems/heroku-2.1.4/lib/heroku/command.rb:17:in `block in load'
from /home/ruby/.rvm/gems/ruby-1.9.2-p180#rails3tutorial/gems/heroku-2.1.4/lib/heroku/command.rb:16:in `each'
from /home/ruby/.rvm/gems/ruby-1.9.2-p180#rails3tutorial/gems/heroku-2.1.4/lib/heroku/command.rb:16:in `load'
from /home/ruby/.rvm/gems/ruby-1.9.2-p180#rails3tutorial/gems/heroku-2.1.4/bin/heroku:13:in `<top (required)>'
from /home/ruby/.rvm/gems/ruby-1.9.2-p180#rails3tutorial/bin/heroku:19:in `load'
from /home/ruby/.rvm/gems/ruby-1.9.2-p180#rails3tutorial/bin/heroku:19:in `<main>'
Help me out please!
PS! I am learning RoR using this book:
http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec:install_rubygems

Solution here

It looks like this is a fairly common problem on Ubuntu. From this post on another forum:
On my system Ubuntu (Hardy 8.04) I
required libncurses5-dev and
libreadline5-dev (installed with
apt-get install . Re-run
"ruby extconv.rb" and it will show you
whether anything else is missing, or
create a makefile. Once you have your
makefile, run make, then make install.

Using rvm solved all the problems.
Install RVM with ruby:
$ \curl -L https://get.rvm.io | bash -s stable --ruby
Additionally with rails:
$ \curl -L https://get.rvm.io | bash -s stable --rails
$ gem install heroku
$heroku login

Related

Jekyll Serve not working.Uninitialized constant. Windows 8

I have installed Jekyll on Windows 8 and created a new application. I am inside the directory and it gives me this error when I run jekyll serve
C:/Blog/> jekyll serve
C:/Ruby200/lib/ruby/gems/2.0.0/gems/safe_yaml-1.0.4/lib/safe_yaml/psych_resolver
.rb:4:in `<class:PsychResolver>': uninitialized constant Psych::Nodes (NameError
)
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/safe_yaml-1.0.4/lib/safe_yaml/p
sych_resolver.rb:2:in `<module:SafeYAML>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/safe_yaml-1.0.4/lib/safe_yaml/p
sych_resolver.rb:1:in `<top (required)>'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_requir
e.rb:69:in `require'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_requir
e.rb:69:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/safe_yaml-1.0.4/lib/safe_yaml/l
oad.rb:131:in `<module:SafeYAML>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/safe_yaml-1.0.4/lib/safe_yaml/l
oad.rb:26:in `<top (required)>'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_requir
e.rb:69:in `require'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_requir
e.rb:69:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll.rb:26:i
n `<top (required)>'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_requir
e.rb:69:in `require'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_requir
e.rb:69:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-2.5.3/bin/jekyll:6:in `<
top (required)>'
from C:/Ruby200/bin/jekyll:23:in `load'
from C:/Ruby200/bin/jekyll:23:in `<main>'
Here is my _config.yml file
# Site settings
title: Your awesome title
email: your-email#domain.com
description: > # this means to ignore newlines until "baseurl:"
Write an awesome description for your new site here. You can edit this
line in _config.yml. It will appear in your document head meta (for
Google search results) and in your feed.xml site description.
baseurl: "" # the subpath of your site, e.g. /blog/
url: "http://yourdomain.com" # the base hostname & protocol for your site
twitter_username: jekyllrb
github_username: jekyll
# Build settings
markdown: kramdown
Thanks if anyone can help!
run gem cleanup it should solve the problem
This happened to me I fixed it by doing this:
First list your gems gem list
...
pg_search (0.7.9)
polyglot (0.3.5)
posix-spawn (0.3.10)
power_assert (0.2.2)
psych (2.0.5, 2.0.0)
pygments.rb (0.6.2)
rack (1.6.0)
rack-cache (1.2)
rack-protection (1.5.3)
...
Where you see psych, try using psych 2.0.5 gem uninstall psych -v 2.0.0
If you get an error message than uninstall gem 2.0.5 instead gem uninstall psych -v 2.0.5
Try Jekyll. This worked for me. You need to find the version of psych that interacts with your Ruby setup correctly. In my case was 2.0.0 but could be different for you.
Try bundle exec jekyll serve in some cases this will solve your issues.

Cocoa Pods 'No such file or Directory' Error

I have an IOS project that uses cocoapods. After switching computers and updating the OS on the new computer I am getting the following error when I try running "pod update"
Robbys-iMac-454:ios-v2 robbykmyers$ pod update
Update all pods
Analyzing dependencies
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/pathname.rb:422:in `open': No such file or directory - /Users/robbykmyers/.cocoapods/repos (Errno::ENOENT)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/pathname.rb:422:in `foreach'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/pathname.rb:422:in `children'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/sources_manager.rb:63:in `all'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/user_interface/error_report.rb:130:in `repo_information'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/user_interface/error_report.rb:34:in `report'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/command.rb:58:in `report_error'
from /Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command.rb:300:in `handle_exception'
from /Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command.rb:274:in `rescue in run'
from /Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command.rb:264:in `run'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/command.rb:45:in `run'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/bin/pod:43:in `<top (required)>'
from /usr/bin/pod:23:in `load'
from /usr/bin/pod:23:in `<main>'
Does anyone know how to solve this?
Delete the folder ~/.cocoapods/ with rm -rf ~/.cocoapods
Enter pod setup command in Terminal.
This process will take time as this command clones the CocoaPods Specs repository into ~/.cocoapods/ on your computer.
It sometimes occurs when using a wrong apostrophe character in a Podfile or in a Podspec
Those apostrophes are default when using standard TextEdit app on OS X. I prefer Sublime Text to avoid such errors
https://blog.cocoapods.org/Repairing-Our-Broken-Specs-Repository/
rm -fr ~/Library/Caches/CocoaPods && \
gem update --system && \
gem update && \
gem cleanup && \
pod setup

Installing/Running Thin Webserver on Rails 3

Having an issue running the "Thin" web server. It looks like installation was successful but when I run "thin start" It appears as though Thin starts to initialize but then cannot find some resources it needs.
Below, is the audit trail from my terminal session. Can someone offer a hand with this? According to the Thin docs, installation was done correctly. Thanks
Rails 3.2.12
ruby 1.9.3
root#pgateway:/var/www/testapp# gem install thin
Fetching: eventmachine-1.0.0.gem (100%)
Building native extensions. This could take a while...
Fetching: daemons-1.1.9.gem (100%)
Fetching: thin-1.5.0.gem (100%)
Building native extensions. This could take a while...
Successfully installed eventmachine-1.0.0
Successfully installed daemons-1.1.9
Successfully installed thin-1.5.0
3 gems installed
root#pgateway:/var/www/testapp# thin start
>> Using rack adapter
>> Thin web server (v1.5.0 codename Knife)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
/usr/local/rvm/gems/ruby-1.9.3-p385/gems/thin-1.5.0/lib/thin/backends /tcp_server.rb:16:in `connect': cannot load such file -- thin/connection (LoadError)
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/thin-1.5.0/lib/thin/backends/base.rb:55:in `block in start'
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `call'
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run_machine'
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/thin-1.5.0/lib/thin/backends/base.rb:63:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/thin-1.5.0/lib/thin/server.rb:159:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/thin-1.5.0/lib/thin/controllers/controller.rb:86:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/thin-1.5.0/lib/thin/runner.rb:187:in `run_command'
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/thin-1.5.0/lib/thin/runner.rb:152:in `run!'
from /usr/local/rvm/gems/ruby-1.9.3-p385/gems/thin-1.5.0/bin/thin:6:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p385/bin/thin:19:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p385/bin/thin:19:in `<main>'
from /usr/local/rvm/gems/ruby-1.9.3-p385/bin/ruby_noexec_wrapper:14:in `eval'
from /usr/local/rvm/gems/ruby-1.9.3-p385/bin/ruby_noexec_wrapper:14:in `<main>'
You seem to install thin separate from rails
Add it to your gemfile and you should be fine
If you want to use a gem, it must be in your Gemfile. You can solve your problem as follows:
Add the following line to your Gemfile: gem 'thin'
Update your current app's environment: bundle install
Then start server
Try to execute the following command:
cd to/your/rails/app
echo 'gem "thin"' >> Gemfile
thin start
this content from https://github.com/macournoyer/thin/issues/115

Could not find cache store adapter for memory_store

For some reason anytime I'm running a Rails 3.0.3 application with Ruby 1.8.7. It's been running fine and I haven't set any cache_store settings anywhere. Now anytime I try to run rake tasks or rails command I get this:
$:rails console production
/home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/cache.rb:65:in `lookup_store': Could not find cache store adapter for memory_store (no such file to load -- active_support/cache/memory_store) (RuntimeError)
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/application/bootstrap.rb:48
from /home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
from /home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/core_ext/kernel/reporting.rb:22:in `with_warnings'
from /home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/application/bootstrap.rb:48
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `instance_exec'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `run'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:50:in `run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:134:in `initialize!'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:77:in `send'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing'
from /home/marc_m3pt0/m3pt0.com/config/environment.rb:5
from /home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from /home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from /home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from /home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from /home/marc_m3pt0/.gems/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:103:in `require_environment!'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:22
from script/rails:6:in `require'
from script/rails:6
Any ideas on what I could be missing?
Thanks so much. My clients site is down right now so any help soon would be appreciated.
UPDATE
When I run rake tasks I get this:
Could not find cache store adapter for memory_store (no such file to load -- active_support/cache/memory_store)
I saw this error recently when a shared host moved an application to a new server. I ended up blowing away the application's bundle and reinstalling it, and it seemed to work.
I use Capistrano for deployment, so if you use something else, YMMV. If your application root is this:
/home/jeff/myapp/
with the following subdirectories:
/home/jeff/myapp/current
/home/jeff/myapp/releases
/home/jeff/myapp/shared
the gem bundle is here:
/home/jeff/myapp/shared/bundle
Then I did:
rm -rf /home/jeff/myapp/shared/bundle
then
cd /home/jeff/myapp
bundle install
Once I did this, it seemed to work for me.

Thin LoadError: no such file to load thin_parser

I have installed thin and try to do thin start, which end up with this error
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- C:/Ruby192/lib/ruby/gems/1.9.1/gems/thin-1.2.8-x86-mingw32/lib/1.9/thin_parser (LoadError)
from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thin-1.2.8-x86-mingw32/lib/thin.rb:48:in `rescue in <top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thin-1.2.8-x86-mingw32/lib/thin.rb:43:in `<top (required)>'
from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/thin-1.2.8-x86-mingw32/bin/thin:5:in `<top (required)>'
from C:/Ruby192/bin/thin:19:in `load'
from C:/Ruby192/bin/thin:19:in `<main>'
Can someone help me out please, thanks in advance
the output denotes a directory called 1.9 i.e.
<ruby_install_dir>/lib/ruby/gems/1.9.1/gems/thin-1.2.8-x86-mingw32/lib/1.9/
Note: My thin version is 1.2.10. In the following i will use the path as it appears on my system.
For some reason the thin gem doesn't come with this directory. But a file called thin_parser.so resides in the parent directory <ruby_install_dir>/lib/ruby/gems/1.9.1/gems/thin-1.2.10/lib/
So my first solution was to create a directory 1.9 and copy the file thin_parser.so to it.
Now thin start works for me.
Alternatively you can edit the file <ruby_install_dir>/lib/ruby/gems/1.9.1/gems/thin-1.2.10/lib/thin.rb and change
if Thin.win?
# Select proper binary under Windows
major_ruby_version = RUBY_VERSION[/^(\d+\.\d+)/]
require "#{Thin::ROOT}/#{major_ruby_version}/thin_parser"
else
require "#{Thin::ROOT}/thin_parser"
end
to
if Thin.win?
# Select proper binary under Windows
major_ruby_version = RUBY_VERSION[/^(\d+\.\d+)/]
require "#{Thin::ROOT}/thin_parser"
else
require "#{Thin::ROOT}/thin_parser"
end
or even simpler
require "#{Thin::ROOT}/thin_parser"
I'm not sure what workaround is the better one, since i don't know what else files thin expects in the not existing directory. I don't know either where the Thin.win? fork becomes important.
I decided in favor of the first solution. But both ways fixed the Problem for me.
Best regards,
Tim
I ran into this same error when running rake db:migrate (I suspect thin start would have given me the same error.)
I'm running on Amazon Linux (rpm based, so similar to CentOS and Redhat). I had previously installed thin as root (gem install thin). Although it may be irrelevant to your situation, just for completeness, I had also installed eventmachine using:
gem install eventmachine --platform=ruby
Here is the error I got:
% rake db:migrate
rake aborted!
LoadError: cannot load such file -- thin_parser
/home/rails/.gem/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
etc. etc.
Based on the above information, I ran rake under strace and discovered that it was looking for thin_parser.so in the wrong place. I was able to fix the problem by installing this symbolic link (I did this as root since I installed thin as root). Obviously, adjust the path to where your version of thin is installed:
cd /usr/local/share/gems1.9/gems/thin-1.6.3/lib
ln -s ../ext/thin_parser/thin_parser.so .
Poof! That fixed it for me.