Using bundler, you can do something like this in the Gemfile
:
gem 'my_gem', :git => 'git@github:me/my_gem.git'
That builds the gem in that repo and installs it. Works great. Is it possible to do something similar just using the command-line gem tool? Something like this?
gem install my_gem --git="git@github:me/my_gem.git"
Obviously that command doesn't work, but is there something like it that does? I know I can clone the repo, run a gem build my_gem.gemspec
and then a gem install my_gem-1.2.3.gem
. But I'm wondering if there is a direct one-liner that hides these intermediate steps behind the scenes.
To install a gem, use gem install [gem] . Browsing installed gems is done with gem list . For more information about the gem command, see below or head to RubyGems' docs. There are other sources of libraries though.
Install BundlerSelect Tools | Bundler | Install Bundler from the main menu. Press Ctrl twice and execute the gem install bundler command in the invoked popup. Open the RubyMine terminal emulator and execute the gem install bundler command.
Use `gem install -v` You may already be familiar with gem install , but if you add the -v flag, you can specify the version of the gem to install. Using -v you can specify an exact version or use version comparators.
A gemfile is automatically created when you start a new rails application. type rails new appName and then it will be generated automatically. It will also be populated with some gems.
Because unlike typical Git repositories, GitHub builds gems, if the project is hosted on GitHub and the gem is found in the source list then you can add GitHub to your sources list like this:
$ gem sources -a http://gems.github.com
and then later install gems as desired in a single step, like this:
$ sudo gem install username-projectname
Otherwise, there's no one-step solution, and you'll have to do something like this:
gem build <gemname>.gemspec
sudo gem install <gemname>-x.x.x.gem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With