firstruby

Master ruby with us

Posts Tagged ‘gem’

json gem installation problem in Ruby on Rails 3.0 on Windows and usage of DevKit

Posted by firstruby on November 13, 2011

While installaing json gem in Ruby on Rails 3.0 or 3.1, I was getting following error,

firstruby@FIRSTRUBY /demo
$ gem install json -v=1.4.6 –platform=ruby –no-ri –no-rdoc
Fetching: json-1.4.6.gem (100%)
ERROR: Error installing json:
The ‘json’ native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from ‘http://rubyinstaller.org/downloads’ and follow the instructions
at ‘http://github.com/oneclick/rubyinstaller/wiki/Development-Kit’

firstruby@FIRSTRUBY /demo

To fix this problem, need to install Development Kit (DevKit – Its a toolkit that makes it easy to build and use native C/C++ extensions for Ruby on Windows) as follows,

1) Download DevKit file from http://rubyinstaller.org/downloads (DevKit-tdm-32-4.5.2-20110712-1620-sfx.exe)
2) Extract DevKit to path C:\Ruby192\DevKit
3) Goto DevKit installation directory,

cd C:\Ruby192\DevKit

4) Run following command,

ruby dk.rb init

It will generate the config.yml file. This config file should include installed Ruby path, like “C:\Ruby192”
5) Run following command,

ruby dk.rb review

It is useful to review the list of Rubies to be enhanced to use the DevKit and verify the changes you made to it are correct.
6) Run following command,

ruby dk.rb install

It is useful to enhance your installed Rubies and makes it easy to build and use native C/C++ extensions such as json.

Reference : https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

Advertisements

Posted in Useful Links | Tagged: , , , , | 25 Comments »

Rails 3.0.x + Gem installation from git source + Passenger

Posted by firstruby on December 31, 2010

In Rails 3.0.3 application, I have developed login functionality using ‘Authlogic’ gem. Gem added in ‘Gemfile’ as,

gem 'authlogic', :git => 'git://github.com/odorcicd/authlogic.git', :branch => 'rails3'

Application was working fine with Mongrel and WEBrick server, but it was throwing an error with Passenger,

git://github.com/odorcicd/authlogic.git (at rails3) is not checked out. Please run `bundle install` (Bundler::GitError)

When we do ‘bundle install’, bundler installs gem (from GIT source) to different path other than regular one. Passenger does not understand this path, and that’s why above error was coming. So I have fixed it in following way,

I have installed ‘authlogic’ as a Plugin from branch “rails3” of given git path as,


cd vendor/plugins
git clone git://github.com/odorcicd/authlogic.git
cd authlogic
git checkout --track -b rails3 origin/rails3

After this, restarted application, and app works fine with Passenger, Mongrel, and WEBrick.

Hope this is helpful.

Posted in Useful Links | Tagged: , , , | Leave a Comment »

ri and rdoc in Ruby On Rails

Posted by firstruby on November 16, 2008

To install ri and rdoc of any gem,

gem install gemname

This command installs ri and rdoc with installation of gem.

To skip the installation of ri and rdoc of gem,

gem install gemname –no-ri –no-rdoc

This command will skip the installation of ri and rdoc when installing gem.

Posted in firstruby, Forum, Useful Links | Tagged: , , , | Leave a Comment »