bundle install failing for 'letter-opener' gem in rails - ruby-on-rails

I am trying to use Ryan Bates 'letter-opener' gem as described in Episode #104 (and in many other places on the web) In every instance I have found, it appears that users are simply including the gem in their Gem file with the traditional ruby gems gemsource. When I attempt this, rails fails to find the gem. I must be doing something wrong, but what?
source "http://rubygems.org"
...
gem "letter-opener", group: :development
Then I type
$ bundle install
and I receive the following message:
Fetching source index for http://rubygems.org/
Could not find gem 'letter-opener (>= 0) x86-mingw32' in any of the gem sources listed in > your Gemfile.
Thanks for the help!

It's a common error to mistype a compound-word rubygem with an underscore ('_') instead of a hyphon ('-') or viceversa.
If you ever find this problem, you can go to http://rubygems.org, and search for the gem's name.
In this case, searching for letter opener returns this result, which suggests that the gem is actually called letter_opener

use gem 'letter_opener'instead of gem 'letter-opener'.

Related

Ruby on Rails 4, Gem Install

I have had a lot of difficulty installing Gems into my Rails 4 Apps that I have built. For example, I have recently had issues with these two Gems:
Ckeditor:
https://github.com/galetahub/ckeditor
Twitter Bootstrap 3:
https://github.com/twbs/bootstrap-sass
I have no idea what I am doing wrong, in the slightest. I include the gems in my Gem file (gem 'ckeditor_rails'), and then I run 'bundle install'. However, whenever I provide my includes in my application.js (example: '//= require ckeditor/init'), my app yells at me and tells me that it cannot resolve the file. When I check why, its because no file was ever downloaded. Even though the gem installed with no errors. I have got to think I am doing something wrong. Any advice?
Before installing gem, first noted if there is any dependency gem. if the gem having dependency gem means you must install it first. and you may edit in your project/gem file gem 'ckeditor' and gem 'bootstrap-sass' and then run the server.

I've installed a gem - but can't find it in /lib

I've installed a ruby gem using the command line. When I try gem list --local it clearly shows that the gem is clearly installed on my machine.
However I want to make changes according to the documentation. According to the documentation (using gem server and then http://localhost:8808/), I should look for the gem under /lib.
However I cannot find it anywhere on my machine - I looked using my mac's finder so that I can then edit it using textmate, but nada.
Any ideas? Where should I look for the gem so I can edit/use it? Thanks!
You need to use the -d flag to get detailed information.
gem list --local -d
For uglifier, for example
uglifier (1.3.0)
Author: Ville Lautanala
Homepage: http://github.com/lautis/uglifier
Installed at: /Users/deefour/.rbenv/versions/1.9.3-p327/gemsets/myapp
Ruby wrapper for UglifyJS JavaScript compressor
To find the location of a gem:
gem which <gemname>
For example with the debugger gem
gem which debugger
/opt/ruby/ruby-1.9.3-p392/lib/ruby/gems/1.9.1/gems/debugger-1.5.0/lib/debugger.rb

Not able to run/install Gems using Gemfile

When i give bundle install or bundle exec i am getting this error
Could not find gem 'acts_as_ferret-0.4.4.gem (>= 0) ruby' in any of the gem sources listed in your Gemfile.
Apparently the first gem in the Gemfile is acts_as_ferret-0.4.4 and source is
source 'http://rubygems.org'
I tried other sources also but still not working!!!
As Pete is saying there probably is a problem with your gemfile
Try to open it and see if your acts_as_ferret looks something like this.
gem "acts_as_ferret", "~> 0.5.3"
if not try and change it to the above
There is more info to be found on the gem on the github page
https://github.com/jkraemer/acts_as_ferret
Looks like your gem identifier is misstyped if it cannot be found even if you try different sources. Did you try to remove the (>=0) ? I think that just says, 'get me any version' but you already specify the version as 0.4.4. Also I'm not too sure about the 'ruby' addition.
Here the gem is listed as acts_as_ferret-0.4.4.gem

Getting gcal4ruby gem to work

I'm trying to create a RoR web application that allows people to connect to their accounts to google calendar.
I found a gem called gcal4ruby that seemed to do the right things based on looking at sample code and its documentation.
I ran gem install and the cmd claimed the installation was ok.
However, when I added the gem to my gemfile then try to run the server again I get:
Could not find 'gcal4ruby (= 0.0.5, runtime)' in any of the gem sources
Try running 'bundle install'.
Then I tried bundle install which basically gets me the message above and a line:
Fetching source index for http://rubygems.org/
Could not find 'gcal4ruby (= 0.0.5, runtime)' in any of the gem sources
Yet when I type in "gem list -d g", gcal4ruby (0.5.5) appears on the list.
I've tried adding in requires and includes but that just gets me uninitialized constant errors.
Other details that may be relevant:
ruby 1.8.7
rails 3.0.1
gem check --alien returns:
mysql-2.8.1-x86-mingw32 has 1 problems
.require_paths:
Extra file
*Note: This doesn't seem to negatively impact me when I'm doing anything though.
If possible, please supply tutorials/sites with samples of working code.
Cheers,
Zigu
Could you post your gemfile please?
I'm guessing your Gemfile reads
gem 'gcal4ruby', '0.0.5'
which means it will only look for that specific verison. So there are two ways to fix this.
Change it to minimum version syntax
gem 'gcal4ruby', '>= 0.0.5'
Change to correct specific gem version
gem 'gcal4ruby', '0.5.5'
Hope that helps

Specify a plugin as gem from github in Gemfile

I am including 'acts_as_rateable' gem in my Gemfile like this
gem 'acts_as_rateable', :git => 'git://github.com/azabaj/acts_as_rateable.git'
and then when I do bundle install it gives me this error message!
Could not find gem 'acts_as_rateable
(>= 0, runtime)' in
git://github.com/azabaj/acts_as_rateable.git
(at master). Source does not contain
any versions of 'acts_as_rateable (>=
0, runtime)'
I am developing a plugin of my own, when I include that, even that gives the same error like this..
I assume this has something to do with the gemspec?
Please help
Rails version : 3.0.1
Rubygems version : 1.3.7
Bundler version : 1.0.3
let me know if you need any other details..
If you want to pull a gem directly from GitHub, you can put this into your GemFile:
gem 'twitter', github: 'sferik/twitter'
Which will use the default branch. To specify the branch to use:
gem 'twitter', github: 'sferik/twitter', branch: 'branch_name'
The problem is that the repository you link to is not a RubyGem. You can get with
$ rails plugin install git://github.com/azabaj/acts_as_rateable.git
Edit: This answer was accurate on the date it was published. Rails 4 doesn't support plugins anymore, so you will have to make this into a local gem yourself. Bundler has some commands that will help you with it, or alternatively you can use a different library, e.g. https://github.com/anton-zaytsev/acts_as_rateable.
Jakub Hampl is right, but it seems strange to depend on git repos like that. I guess you're you making it yourself? If so, make it a real gem. It should have a acts_as_rateable.gemspec and you'll be able to depend on it like you wrote. Bundler makes your life easy, create the gemspec with
$ bundle gem acts_as_rateable

Resources