I like django, unfortunately i have to use RoR for 2 projects, and it seems like I'm having problems from the start :P
how to install nifty-generators on xp? i found 3 solutions out there, none works for me :P
1- use sudo gem install nifty-generators which won't work obviously
2- gem 'nifty-generators', '>= 0.4.6' .......... the output is
Error: while executing gem ...(RuntimeError)
unknown command nifty-generators,
3- gem "nifty-generators", :group => :development would give that same error
i'm using rails 3, windows xp pro, 32 bit, sp3, installed ruby on rails using railsinstaller
I am not familiar with Windows, so I can't advise the first method.
You don't just type 2 and 3 in the terminal, they are to be added to your Gemfile in the root of your rails app. After saving your Gemfile, you can run bundle install from the terminal to install the gem. It will then be available for use in your rails app.
Related
I'm having problems with bcrypt when either trying to start my rails server or attempting to login on the localhost.
I have played around by re-downloading/updating my Gem file with different versions of bcrypt and moving files around as per some of the github issues raised around this.
At the moment, my rails server starts, and when I login I get the error:
cannot load such file — 2.3/bcrypt_ext
And my Gem file has: gem 'bcrypt-ruby', '~> 3.0.0'
Any thoughts to get this working consistently on Windows?
Came across this github issue and the following seems to work
Firstly uninstall bcrypt and bcrypt-ruby by running these two commands:
gem uninstall bcrypt and gem uninstall bcrypt-ruby
Install it again with gem install bcrypt --platform=ruby
In your Gemfile write gem 'bcrypt-ruby', '3.1.5', :require => 'bcrypt'
Run bundle install
Okay I got this working by referring to the following answer: https://stackoverflow.com/a/33593911/6676900
The key steps are as follows:
1. Install Devkit from - http://rubyinstaller.org/downloads/ (NOTE: I had to use the 32 bit version even though I am running Windows 10 64 Bit)
2. Update my PATH variable to use the 32bit version of the Dev kit. i.e. %DEVKIT_HOME%\bin (Where %DEVKIT_HOME% is the location of the extracted Dev Kit)
3. Follow the commands in the following answer: https://stackoverflow.com/a/33593911/6676900
Good to go!
I just updated to Ruby 1.9.3p0 and Rails 3.1.1. Now when I try to launch the server, it complains that I should install ruby-debug, even though it's already installed.
% rails server --environment=development --debug
=> Booting WEBrick
=> Rails 3.1.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
Exiting
In my Gemfile I have
# see: http://stackoverflow.com/questions/1083451/debugging-in-ruby-1-9
gem 'ruby-debug-base19', "0.11.24"
gem 'ruby-debug19', "0.11.6"
Is it possible to run debug with the latest version of Ruby?
Update (April 28, 2012)
Try the new debugger gem as a replacement for ruby-debug.
(credit to #ryanb)
Update (March 2, 2012)
Installation of linecache19 and ruby-debug-base19 can be easily done with:
bash < <(curl -L https://raw.github.com/gist/1333785)
(credit to #fredostarr)
Original answer
Have you looked at ruby-debug19 on ruby-1.9.3-preview1?
Here's a temporary solution:
http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
Excerpt from the site:
First download linecache19-0.5.13.gem and
ruby-debug-base19-0.11.26.gem from
http://rubyforge.org/frs/?group_id=8883, then …
$ gem install linecache19-0.5.13.gem
Building native extensions. This could take a while...
Successfully installed linecache19-0.5.13
1 gem installed
$ gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=/Users/santiago/.rbenv/source/ruby-1.9.3-p0
Building native extensions. This could take a while...
Successfully installed ruby-debug-base19-0.11.26
1 gem installed
$ irb
irb(main):001:0> require 'ruby-debug'
=> true
Installation of linecache19 and ruby-debug-base19 can be easily done with:
bash < <(curl -L https://raw.github.com/gist/1333785)
Someone else posted in a comment to try Pry, which is what I did. This is what's necessary for Rails:
# Gemfile
gem 'pry-rails'
# In your Rails Project where you want a 'debugger'
puts 'i want to insert some code between this'
binding.pry
puts 'and this'
Immediately after installing I notice my .irbrc doesn't load, so I don't get pretty console output. I also added this to my '~/.pryrc'
# setting up pry to have irb helpers like reload!
if defined?(Rails) && Rails.env
extend Rails::ConsoleMethods
end
Pry has some nice features that I've wanted to check out, and I may yet return to ruby-debug once there's a simple way to integrate it into a Rails project for Ruby 1.9.3. I can run the curl command from the other answers, but this is something I'll have to point my teammates to for our Rails project, so it doesn't scale well IMO.
Maybe not the definitive answer to this question, but I was lead here by a chain of closed duplicates.
For me the problem was that I run a project in both ruby 1.8 and ruby 1.9, and my Gemfile needed this change:
gem 'debugger', :require => 'ruby-debug', :platforms => :mri_19
gem 'ruby-debug', :platforms => :mri_18
Now it works for both rubies.
For more info see here: http://gembundler.com/man/gemfile.5.html#PLATFORMS-platforms-
For Windows Users:
First Download :linecache19-0.5.13.gem and ruby-debug-base19-0.11.26.gem
From : http://rubyforge.org/frs/?group_id=8883&release_id=46303
Assumption: Ruby is in c:\Ruby1.93
put the gem files downloaded to c:\temp
(linecache19-0.5.13.gem and ruby-debug-base19-0.11.26.gem)
then execute from command line:
gem install c:\temp\linecache19-0.5.13.gem
gem install c:\temp\ruby-debug-base19-0.11.26.gem -- --with-ruby-include=C:\Ruby1.93\include\ruby-1.9.1\ruby-1.9.3-p0
BTW, if you use the newest patch for ruby1.9.3 (falcon, https://gist.github.com/1688857), use following commands
wget http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
wget http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
gem install linecache19-0.5.13.gem
## with rvm:
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$HOME/.rvm/src/ruby-1.9.3-p0-falcon
## with rbenv (this is a guess):
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$HOME/.rbenv/source/ruby-1.9.3-p0-falcon
See my answer here :
Ruby-debug not working - Stack Overflow
It's about getting Ruby debugging to work with the following setup
Mac OS X Lion 10.7.2
Aptana Studio 3 (Build 3.0.8.201201201658)
Using rvm, in my project working directory I have a .rvmrc stating:
rvm use ruby-1.9.3-p0#mygemset
Basically, I had to use :
linecache19 (0.5.13)
ruby-debug-base19x (0.11.30.pre10)
ruby-debug-ide (0.4.16)
Note that I'm not using ruby-debug-base19 but ruby-debug-base19x
I hope this helps!
-- Freddy
Also you need to check if the gem 'ruby_source_code' is already installed.
Check: http://bugs.ruby-lang.org/issues/1857#note-8
If you don't have rvm and assuming you ruby installation is in /usr/local/ruby-1.9.3-po your can use this command:
curl -L https://raw.github.com/gist/1533750 | sudo /bin/bash
Alright, I've been trying to install Rmagick on a Windows 7 x64 machine pretty much all day. I've checked out every single tutorial on Stack Overflow and other sites, but I keep getting an "Invalid Drive Specification" error no matter which tutorial I follow. My environment came from http://railsinstaller.org/. Has anyone successfully installed Rmagick recently that can point me in the right direction? Thanks, this is driving me crazy but I really have to get it working.
First and most important, when reporting issues or asking for help, always include version information about what you're trying to install, specially Ruby.
It seems you're installing using RailsInstaller, but since you didn't mention if is the 2.0 preview version or the stable one, I'll assume you used the stable one, which is based on Ruby 1.8.7-p334.
Now, RailsInstaller already includes the needed pieces: Ruby and RubyInstaller DevKit component, so going to skip the steps about installation of that and jump directly to RMagick itself.
To successfully install RMagick gem, you need ImageMagick binaries with development headers, as documented in RubyInstaller's Tutorial wiki page, which links here
Please download 32bits version of ImageMagick, as Ruby is 32bits.
For my test I've downloaded the installer version ImageMagick-6.7.0-8-Q16-windows-dll.exe
Once downloaded and installed in a path without spaces and I've selected the option Install development headers and libraries for C and C++.
Then open a new Command Prompt, ensure Ruby is available (checking with ruby -v) and after performed the following command:
gem install rmagick --platform=ruby -- --with-opt-lib=C:\ImageMagick-6.7.0-Q16\lib --with-opt-include=C:\ImageMagick-6.7.0-Q16\include
That command is going to take considerable amount of time (took 1 minute on my Core 2 Duo) but the end result was:
Fetching: rmagick-2.13.1.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed rmagick-2.13.1
1 gem installed
Now you can verify RMagick installed successfully using IRB:
irb(main):001:0> require "rubygems"
=> true
irb(main):002:0> require "rmagick"
=> true
irb(main):003:0> Magick::Version
=> "RMagick 2.13.1"
Now, if you're using Ruby 1.9.2, last RMagick release is not compatible with it and you will need to build from source. There is another tutorial on RubyInstaller wiki that covers that, but please read this thread at RubyInstaller group were we discuss the issues.
Hope all this helps.
This above post did not work for me, the key for me was using GitBash wich comes with RailsInstaller, and also includes Devkit.
Install railsinstaller -> www.railsinstaller.org (I installed it to c:\Rails)
Install ImageMagick -> ImageMagick-6.7.3-8-Q16-windows-dll.exe (I installed it to c:\ImageMagick)
Open GitBash
$ gem install rmagick --platform=ruby -- --with-opt-lib=c:/ImageMagick/lib --with-opt-include=c:/ImageMagick/include
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed rmagick-2.13.1
1 gem installed
Installing ri documentation for rmagick-2.13.1...
Installing RDoc documentation for rmagick-2.13.1...
Also, in the gemfile I have commented out gem 'rmagick' in the development group
This is what my gemfile looks like
group :development do #this is used on localhost
gem 'mysql2'
gem 'paperclip'
#gem 'rmagick' #dont need this
gem 'devise'
end
group :production do #this is used on heroku
gem "pg" #this is postgresql used on heroku
gem "aws-s3" #this is used for amason S3 filestorage
gem 'paperclip'
gem 'rmagick'
gem 'devise'
end
We just had this problem with Windows 7, Ruby 2.0 & Rails 4.0
This tutorial works really well:
Download the latest ImageMagick installer from ImageMagick.org (as of writing, "[ImageMagick-6.8.7-0-Q16-x86-dll.exe][3]" -- the complete installer (not the binaries))
Once downloaded, install ImageMagick without any white spaces in the file path (E.G C:/ImageMagick) with the following options checked:
Add Application Directory To Your System Path
Installer Development Headers For Libraries C & C++
In the Ruby CMD, install the RMagick Gem with the correct file paths:
gem install rmagick --platform=ruby -- --with-opt-lib=**c:/ImageMagick-6.7.0-Q16/lib** --with-opt-include=**c:/ImageMagick-6.7.0-Q16/include**
This should work for you
I did install it about a month ago. One of many errors I had to overcome was the "Invalid drive specification"
I've just started a blog with a post about installing RMagick on Win7 based on my self-answered question here.
One note though: I used ruby 1.9.2 and railsinstaller seem to use 1.8.7.
If I remember it right, this error could be caused by spaces in your image magick installation path.
I don't have enought privileges, sorry for posting my comment to Luis Lavena's answer here.
One solution that worked for me was running Luis Lavena's solution from "Command Prompt with Ruby and Rails" (from the Windows start menu). It loads all necessary configurations.
I'm very new to Rails (and Ruby), and am having trouble installing and using gems. I'm trying to use ruby-tmdb (https://github.com/aarongough/ruby-tmdb) and there's very little documentation.
"sudo gem install ruby-tmdb" runs just fine and I can see the gem installed when I run "gem list --local"
But, when I try and run the app, I get the error "no such file to load -- ruby-tmdb".
I'm on Mac OS X Snow Leopard. Ruby 1.8.7. Rails 3.0.3. Gem 1.3.7.
Is the gem listed in your Gemfile? In Rails 3, all gem dependencies should be listed in the Gemfile, so that it is properly loaded when the app runs.
You should have something like the following line:
gem 'ruby-tmdb'
Then, run bundle install to ensure that all gem dependencies are installed, and to have Bundler save the lock file that will ensure that all copies of this application run with the same gem versions. From this point on, you will no longer have to write the require line yourself; Rails will load in all necessary gems as the environment loads.
You might get the same error even after this, but it's always worth going through the standard process to help narrow things down :)
$ sudo which gem
$ which gem
$ sudo ruby -v
$ ruby -v
Sometimes users have different gems and rubys compared to root.
A common problem is that a gem installed for ruby 1.8 by root isn't visible for the users ruby 1.9
gems for ruby 1.8 and gems for 1.9 are NOT compatible.
This probably isn't the issue but is something that may be worth considering.
I'm a newbie to Ruby on Rails. I had a quick question about installing gems.
I'm using a windows 7 64 bit machine with Ruby 1.9.2 and Rails 3.0 and I'm trying to install the gravatar_image_tag gem.
gem install gravatar_image_tag
After I run that it says its succcessful. But when I try to do this:
gravatar_image_tag -v
It says that 'gravatar_image_tag' is not recognized as an internal or external command, operable program or batch file'
When i looked into my ruby192/bin file there are batch files for rails, annotate etc etc that work fine but there's not batch file for gravatar_image_tag.
I was wondering where I'm going wrong with this.
Thanks in advance.
Not all gems are executable from the command line. The best way to see if a gem is installed (as well as its version) is to run:
gem list
If you want to use a gem inside your rails 3 project, you should add it to your Gemfile (in the root of your project). Something like this
gem "gravatar_image_tag"
then run bundle install.
The gravatar_image_tag should placed somewhere in your view, to generate the correct html.
More information can be found on their github page.
[EDIT] Maybe my answer was not too the point. To check if the gem was correctly installed, you either type
gem list gravatar_image_tag
or
bundle show gravatar_image_tag
if you installed the gem using bundler.
Not all gems install a batch-file, and according to the documentation this doesn't either.