Common Ruby Package Manager gem commands and common rubygem commands
Gem-related commands
1. display the help and version of gem
The Code is as follows:
Gem-h/-- help
# Display the help of gem
Gem-v/-- version
# Display the gem version number
2. List all available software in the remote database
The Code is as follows:
Gem query -- remote
# Short command: gem q-r
You can see a detailed list of all software on the remote host.
3. Search for specific software on the remote host
The Code is as follows:
Gem query -- remote -- name-matches doom
# Short command: gem q-rn doom
You will see a detailed list that matches doom.
The Code is as follows:
Gem list-remote -- d
# List remotely installed gems using the sub-command list
4.1 install a remote software
The Code is as follows:
Gem install -- remote progressbar
# Short command: gem I-r progressbar-y
Remotely install progressbar to your host.-y indicates unconditional installation of dependency packages.
The Code is as follows:
Gem install rails-remote
# Install the rails package from the remote server. rails can be replaced with any software package displayed in the gem list-remote-d.
4.2 install a specific version of the software
The Code is as follows:
Gemins-r progressbar-0.0.3
Install progressbar 0.0.3
The Code is as follows:
Gem ins-r progressbar -- version '> 0.0.1'
Install the latest version of progressbar later than 0.0.1
5. view an installed software
The Code is as follows:
Gem specification progressbar
# Short command: gem spec progressbar
You will see detailed information about the Installed Package progressbar.
6. Uninstall a software
The Code is as follows:
Gem uninstall progressbar
Uninstalled progressbar
7.1 list all installed software
The Code is as follows:
Gem query -- local
# Short command: 'gem q-l'
7.2 view an installed software
The Code is as follows:
Gem query -- local -- name-matches doom
# Short command: 'gem q-ln doom'
Or: gem list -- local
7.3 installation methods
The Code is as follows:
Gem ins rake
Will first try local installation, if not local will be remote download.
The Code is as follows:
Gem list-B ^ C
List local and remote software starting with C
8. Browse all installed software and their instructions
The Code is as follows:
Gem_server
A web server is generated to enable http: // localhost: 8808.
You can see an html listing detailed information you need.
9. Use the configuration file
The Code is as follows:
Gem: -- gen-rdoc -- run-tests
If you want to install software and always generate their documents and run unit tests, you can write related commands in the preparation file. The configuration file name is. gemrc, which is in the main directory.
10. Build a gem package
The Code is as follows:
Gem build package. gemspec
# Use the bulid sub-command to build the gem package