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

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

Related

Add Gem 'wdm' to your GemFile

Error
I have tried running the following command in git bash
rails g scaffold_controller oragnizationsController
And I get the error in the picture.
I have tried multiple solutions:
1- Tried running
gem install wdm
2- Tried running
bundle install
3- I have tried adding
gem 'wdm', '~> 0.1.0'
and
gem 'wdm', '~> 0.1.1'
since I read that 0.1.0 ain't working anymore.
But the problem hasn't been solved yet. I am using windows 10, ruby 2.3.3, rails 5.1.4
Uninstall wdm gem and put it to the gemfile like this:
gem 'wdm' if Gem.win_platform?
Or like the error tells you
The message about wdm is misleading here. It seems to be just a notice/warning.
If you look closer, you'll see that the actual error message is printed in the line below that. It says:
cannot load such file -- bcrypt_ext (LoadError)
Then see here: Ruby on windows causes error Cannot load such file bcrypt_ext

Ruby on Rails error during installation

I'm trying to install Ruby, I followed the installation guide well, but when I tried to run the server by the command:
ruby bin/rails setup
after I created the controller called blog as described in the instructions, it gave me an error in red and a text in yellow:
Error:
Could not find gem uglifier <>= 1.3.0 in the gems available on the machine.
Yes! I know that this is a Googleable question but all I can get are solutions for people with internet access on their PC.
But unfortunately, my computer doesn't have a working Internet connection. I'm posting this question from my phone. So I'm unable to install uglifier(if that's the required thing to do) through the command prompt. Many thanks.
Please could you check if your Gemfile has the following gem
gem 'uglifier'
If the Gem is not present add it to your Gemfile, if you already have it in your Gemfile please run:
bundle install
After that you should check if the bundler is installing the uglifier gem.
Hope that helps,

bundle install failing for 'letter-opener' gem in 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'.

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

Resources