Couldn't install local gem - ruby

I'm trying to install a gem that i'm developing from local.
gem install mygem.gemspec
It produces an error:
ERROR: Could not find a valid gem 'mygem.gemspec' (>= 0) in any repository
I can't find any error why it doesn't work, what might be a problem here?

You don’t install the .gemspec file, you use that to build the gem, and then install the resulting gem.
Something like:
$ gem build mygem.gemspec
Successfully built RubyGem
Name: mygem
Version: 1.0.0
File: mygem-1.0.0.gem
and then:
$ gem install mygem-1.0.0.gem
Successfully installed mygem-1.0.0
1 gem installed

Related

Can bundler use locally installed gems when a custom source is specified

I have a project where we are building a custom gem which is hosted on a private gemserver (gemfury). This gem is a dependency in multiple Gemfiles where I need to run tests.
So I have a Gemfile that looks like this:
source "https://rubygems.org"
source 'https://gem.fury.io/custom/' do
gem 'my-custom-gem', '0.0.42'
end
gem 'aws-sdk-iotdataplane', '~>1.15.0'
gem 'bson', '~>4.4.2'
gem 'mongoid', '~>6.1.1'
.
.
.
I build and install the gem locally with rake install (which works fine) and then attempt to run bundle install on the above Gemfile.
I get the following error:
$ bundle install
Fetching gem metadata from https://gem.fury.io/custom/..
Could not find gem 'my-custom-gem (= 0.0.42)' in rubygems repository https://gem.fury.io/custom/ or installed locally.
The source contains the following versions of 'my-custom-gem': 0.0.1, 0.0.4
It is my understanding that if the gem is installed locally on the system, bundler should not attempt to fetch it from the source.
Is this correct?
If I remove the custom source block from around the gem line, it will use the local gem and the fact that the error message says "... or installed locally" really seems to suggest this should work.

Howe to install a Plugin for Jekyll with a homebrew install of ruby running on local Mac?

I am running latest MAC OSX with brew. I have installed Ruby with brew install ruby and have successfully installed Jekyll as per instructions. sudo gem install jekyll.
I am unable to get _plugins working and get errors when i try to do install the seo plugin. gem 'jekyll-seo-tag'
I get Unknown command jekyll-seo-tag
How do I get this to work?
Where are you adding gem 'jekyll-seo-tag' to? Based on the error, I guess you're trying to run it as a command:
$ gem 'jekyll-seo-tag'
ERROR: While executing gem ... (Gem::CommandLineError)
Unknown command jekyll-seo-tag
You should add gem 'jekyll-seo-tag to your Gemfile instead:
$ cat Gemfile
source 'https://rubygems.org/'
...
gem 'jekyll-seo-tag'
...
And then to your _config.yml file:
$ cat _config.yml
...
gems:
- jekyll-seo-tag
...
For more information, take a look at the installation instructions:
https://github.com/jekyll/jekyll-seo-tag#installation

Could not find gem 'wdm (>= 0.1.0) x64-mingw32' in any of the gem sources listed in your Gemfile or available on this machine

When I run Jekyll serve on Git Bash I get the following warning:
Please add the following to your Gemfile to avoid polling for changes:
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
After adding the Gemfile I get another error message.
Could not find gem 'wdm (>= 0.1.0) x64-mingw32' in any of the gem sources
listed in your Gemfile or available on this machine.
I tried installing Ruby Devkit to fix this issue but I only end up getting the following error messages.
$ ruby dk.rb install
[INFO] Skipping existing gem override for 'C:/Ruby200-x64'
[WARN] Skipping existing DevKit helper library for 'C:/Ruby200-x64'
$ gem install json --platform=ruby
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'
You need to run bundle install after adding the wdm gem to your Gemfile to download it.
It seems you have installed devkit before, and it skips the new installation, try
ruby dk.rb install --force
Need to add wdm into bundle after downloading it. Try
bundle add wdm

Strange gem installation runtime depedency error on rake version on ubuntu

Inside my gemspec file I have:
s.add_runtime_dependency 'rake',
[ '>= 0.9.0.0']
On Windows I install it with the command:
gem install --local myGem-0.9.0.gem
Because --user does not seem to work on windows and it installs in the main ruby gem area.
This works fine the current rake version on that machine is 0.9.2.2 and the current gem version on that machine is 1.8.28
On Ubuntu with the same gemspec file I install it with:
gem install --local --user myGem-0.9.0.gem
which fails with the error:
ERROR: While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: myGem requires rake (>= 0.9.0.0)
The version of rake installed on that machine is: 10.0.4
and then current gem version on that machine is 1.8.23
I tried changing the gemspec file to '>= 9.0.0' and I got the same error.
This gem uses rake at runtime.
This behavior seems quite contrary to the documentation on the gemspec file. How do I accomplish this version test? It works fine without a version dependency value.

ruby-debug-base19-0.11.26 installation errror

I'm trying to get ruby-debug working with ruby 1.9.3 and rails on OSX Lion.
I've been following http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug , but my problem is I can't get ruby-debug-base19-0.11.26.gem
In my .Gemfile for sources i have
source 'http://rubygems.org'
source :rubyforge
source 'http://gems.rubyforge.org'
when I do
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby- include=/Users/minadoroudi/.rvm/rubies/ruby-1.9.3-p0/include=/Users/me/.rvm/rubies/ruby-1.9.3-p0/
or
gem install ruby-debug-base19-0.11.26 -- --with-ruby- include=/Users/me/.rvm/rubies/ruby-1.9.3-p0/
I get:
ERROR: Could not find a valid gem 'ruby-debug-base19-0.11.26.gem' (>= 0) in any repository
0ERROR: Possible alternatives: ruby-debug-base19, ruby-debug-base19x
Looks like it doesn't pick rubyforge, any ideas?
You need to type gem install ruby-debug-base19 to install the latest version of ruby-debug-base-19.
If you absolutely need to have version 0.11.26, use the v switch, like so:
gem install ruby-debug-base19 -v 0.11.26

Resources