Can you install your ruby gems via ftp? I mean just copy your local gem directory /var/lib/gems/1.9.1/gems and put it online with filezilla in the ruby>gems>gems directory.
The reason I want to do this is because with cPanel it gives me errors when trying to install some gems (like permission errors, some require ruby >=1.9.2 but I already have ruby 1.9.3). So is there a simple way?
Thanks!
Instead of copying your system's gem which may be ruby version specific, you could place all the required gems sources in your application's lib directory and reference them in your Gemfile. Not that you cannot place these sources in other directories.
Place gem source in your local application e.g. #{Rails.root}/lib/my_gem and update your Gemfile to reference the gem using:
gem "my_gem", path: "lib/my_gem"
Then run bundle install to install the sourced gem in your application.
and you can run
gem server
then add the source
http://some.ip:8808
there you'll have shared the gem installed in that system
Related
I'm using Ruby 2.6 and Rail 5. I want to install the following gem
$ gem install ffi -v '1.9.18' -- --with-cflags="-Wno-error=implicit-function-declaration"
Fetching ffi-1.9.18.gem
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.
but the above attempts to install it in a global location, and I would prefer to have this in my project directory, which I configured using
bundle config set --local path 'vendor/bundle'
Per the documentation, I can add this to my "gem install" command
--local path_to_gem/filename.gem
but my question is what would "path_to_gem/filename.gem" need to be to properly install this ffi gem, or can I just make something up?
Look into using RVM and taking advantage of its gemset feature. Rails projects are not like Node projects where you would have a node_modules directory where all of your dependencies live. Instead, RVM would manage your dependencies locally and keep them separate using gemsets.
As the question states - where does the gem install?
Is it installing within the app directory that I'm working in (i.e. user/sites/sample_app)? Or is it being installed on my computer? If the latter where exactly?
Thanks!
gem install process
first download gem and save desktop
1.next step open command prompt and set location that means c:/desktop> gem install --local "gemname"
2.next step com to rails consoler and type $bundle install --local.
3. type the gem name on gem list
I have two questions:
Where do you install your ruby?
Did you use RVM or rbenv?
Now I will explain your question using my situation as an example.
I use RVM to manage rubies on my mac os.
now the ruby install in path
/Users/pin/.rvm/rubies/ruby-2.1.1
and these will be a gems directory under .rvm path. In this directory,
/Users/pin/.rvm/gems
there are many gems group, I have a group named
ruby-2.1.1#global
which is used by the default ruby version.
This is a directory and there will be a gems directory under it.
/Users/pin/.rvm/gems/ruby-2.1.0/gems
In this directory, you will find all of the gems you installed using cmd
bundle install
If you don't use ruby version management tools like rvm or rbenv, you may find the gems
around your ruby path. If you still can't find them, you can post the details of how you
install the rubies and other system configs, so that we can discuss here.
If you are using rvm then its get installed in
/home/user/.rvm/gems/ruby-version#global/ or /home/user/.rvm/gems/ruby-version/
If you are using specific gemset for gems then
/home/user/.rvm/gems/ruby-version#gemset_name/
If you want to know where gem is installed use gem which *gem_name* e.g.:
gem which rails
If you installed your gems with bundle install use bundle show *gem name* e.g.:
bundle show rails
Gems
If you use gem install x, you're adding the gem to the local ruby version on your system. This is a system-wide installation, and will be stored in your rubylib/ruby/gems dir:
The install command downloads and installs the gem and any necessary
dependencies then builds documentation for the installed gems.
Bundler
Using the bundle install command (when you have a Gemfile & use bundler), you basically tell bundler to install the gems relative to your specific applicaiton:
Bundler makes sure that Ruby can find all of the gems in the Gemfile
(and all of their dependencies). If your app is a Rails 3 app, your
default application already has the code necessary to invoke bundler.
If it is a Rails 2.3 app, please see Setting up Bundler in Rails 2.3.
For example, if you have a Rails 3.2 app, and a Rails 4.1 app on your system, using bundler allows you to instal the dependencies (gems) for each app independently
If you use gem install x, it will install the gem for all applications, and should only be used for things like rmagick and the database connection gems
Generally, if I need a gem, I put it in the Gemfile and bundle install. However, I don't understand if there is a benefit to downloading the gems locally first with gem install _____. Is there any benefit to this? Does bundle install no longer have to connect to the net in that situation?
Bundler installs the gems located in your Gemfile locally the same as if you ran gem install for each of those gems.
Gem install needed for gems that can be used outside of bundler applications. For example request-log-analyzer need to be installed outside of any apps for be available in command line.
I myself use gem install _______ then i use bundle install --local which doesn't require internet connection if the gem is found locally but will return an error if the gem was not found locally...
I find this method faster in downloading and installing gems, plus if the gems are found locally then i have also the benefit of altering the gemfile and install the gems without having internet connection.
Hi I have installed and working Spree 1.1.1. and want to integrate PayPal to the engine. and when i am trying to install 'spree_paypal_express' the console is showing the below message please help me out.
Could not find gem 'spree-paypal-express (>= 0) x86-mingw32' in the gems available on this machine.
There are a few possible issues with this.
First, there may be an issue with your Gemfile. For example,
-- the gem may not be in the gemfile,
-- you may have misspelled the name of the gem in your gemfile
-- you may have extra whitespace in the gem name (e.g., gem 'spree-paypal-express ' <- note extra space)
Here are some things you can try (after checking the above first to make sure your Gemfile is correct):
Remove all your gems (go to the gems folder of your ruby, remove the specifications folder and the gems folder -- or create a new gemset using rvm)
gem list should be more or less empty
gem install bundler
And try to bundle install again from scratch.
I have manually downloaded zip folder from github repository and extracted.
by going in to the directory run gem build spree_paypal_express.gemspec
then it will generate some files in which spree_paypal_express-1.1.0.gem will be one of them.
so later run gem install spree_paypal_express-1.1.0.gem
then you are ready to go... you can check by gem list
I have to add a custom gem which is downloaded onto my local machine. How do I get it installed with Rails? I also have RVM installed. I tried pasting it into the gems folder but it doesn't get installed.
I believe to install a gem you need to run the setup.rb file but this gem doesn't seem to have that present. Any pointers to how to get this gem installed?
It's very important because I think this gem has dependencies and is stopping my project from running.
Another option, in addition to #shingara's, is you can still add it to your Gemfile, but it will depend on everyone in your project team having the gem in the same location. Then you can do:
gem 'my_gem', '0.1.2.3', :path => '~/my_projects/my_gem_folder/'
And when you bundle, it'll pull and install from there.
If you're working on something by yourself, you can do this without worry that someone else who pulls down that project won't have that gem in the same location.
EDIT In addition to your comment for #shingara's answer, this works for not pointing straight to a .gem file, but to a folder that your gem resides in.
You can install a gem by this path
gem install path/my_gem.gem