Update 23-01-2020
This commit is contained in:
242
docs/macos/ruby.md
Normal file
242
docs/macos/ruby.md
Normal file
@@ -0,0 +1,242 @@
|
||||
# Ruby
|
||||
|
||||
|
||||
|
||||
### Installation de ruby
|
||||
|
||||
#### Mettre à jour Ruby (avec homebrew):
|
||||
|
||||
```bash
|
||||
$ which ruby
|
||||
/usr/bin/ruby
|
||||
$ ruby -v
|
||||
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
|
||||
|
||||
|
||||
$ brew install ruby
|
||||
|
||||
$ echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc
|
||||
|
||||
$ which ruby
|
||||
/usr/local/opt/ruby/bin/ruby
|
||||
$ ruby -v
|
||||
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19]
|
||||
|
||||
```
|
||||
|
||||
#### Ajouter au $PATH (.zshrc):
|
||||
|
||||
```bash
|
||||
export PATH="/usr/local/opt/ruby/bin:$PATH"
|
||||
export PATH=/Users/bruno/.gem/ruby/2.6.0/bin:$PATH
|
||||
```
|
||||
|
||||
#### Aide:
|
||||
|
||||
```bash
|
||||
$ gem help examples
|
||||
Some examples of 'gem' usage.
|
||||
|
||||
```
|
||||
|
||||
```bash
|
||||
$ gem help commands
|
||||
GEM commands are:
|
||||
|
||||
build Build a gem from a gemspec
|
||||
cert Manage RubyGems certificates and signing settings
|
||||
check Check a gem repository for added or missing files
|
||||
cleanup Clean up old versions of installed gems
|
||||
contents Display the contents of the installed gems
|
||||
dependency Show the dependencies of an installed gem
|
||||
environment Display information about the RubyGems environment
|
||||
fetch Download a gem and place it in the current directory
|
||||
generate_index Generates the index files for a gem server directory
|
||||
help Provide help on the 'gem' command
|
||||
info Show information for the given gem
|
||||
install Install a gem into the local repository
|
||||
list Display local gems whose name matches REGEXP
|
||||
lock Generate a lockdown list of gems
|
||||
manpages Handling manpages in gems
|
||||
mirror Mirror all gem files (requires rubygems-mirror)
|
||||
open Open gem sources in editor
|
||||
outdated Display all gems that need updates
|
||||
owner Manage gem owners of a gem on the push server
|
||||
pristine Restores installed gems to pristine condition from files
|
||||
located in the gem cache
|
||||
push Push a gem up to the gem server
|
||||
query Query gem information in local or remote repositories
|
||||
rdoc Generates RDoc for pre-installed gems
|
||||
search Display remote gems whose name matches REGEXP
|
||||
server Documentation and gem repository HTTP server
|
||||
signin Sign in to any gemcutter-compatible host. It defaults to
|
||||
https://rubygems.org
|
||||
signout Sign out from all the current sessions.
|
||||
sources Manage the sources and cache file RubyGems uses to search
|
||||
for gems
|
||||
specification Display gem specification (in yaml)
|
||||
stale List gems along with access times
|
||||
uninstall Uninstall gems from the local repository
|
||||
unpack Unpack an installed gem to the current directory
|
||||
update Update installed gems to the latest version
|
||||
which Find the location of a library file you can require
|
||||
yank Remove a pushed gem from the index
|
||||
|
||||
For help on a particular command, use 'gem help COMMAND'.
|
||||
```
|
||||
|
||||
#### Environnment:
|
||||
|
||||
```bash
|
||||
$ gem environment
|
||||
RubyGems Environment:
|
||||
|
||||
- RUBYGEMS VERSION: 3.0.6
|
||||
- RUBY VERSION: 2.6.5 (2019-10-01 patchlevel 114) [x86_64-darwin19]
|
||||
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.6.0
|
||||
- USER INSTALLATION DIRECTORY: /Users/bruno/.gem/ruby/2.6.0
|
||||
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
|
||||
- GIT EXECUTABLE: /usr/local/bin/git
|
||||
- EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/2.6.0/bin
|
||||
- SPEC CACHE DIRECTORY: /Users/bruno/.gem/specs
|
||||
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.6.5/etc
|
||||
- RUBYGEMS PLATFORMS:
|
||||
- ruby
|
||||
- x86_64-darwin-19
|
||||
- GEM PATHS:
|
||||
- /usr/local/lib/ruby/gems/2.6.0
|
||||
- /Users/bruno/.gem/ruby/2.6.0
|
||||
- /usr/local/Cellar/ruby/2.6.5/lib/ruby/gems/2.6.0
|
||||
- GEM CONFIGURATION:
|
||||
- :update_sources => true
|
||||
- :verbose => true
|
||||
- :backtrace => false
|
||||
- :bulk_threshold => 1000
|
||||
- REMOTE SOURCES:
|
||||
- https://rubygems.org/
|
||||
- SHELL PATH:
|
||||
- /Users/bruno/.nvm/versions/node/v12.13.0/bin
|
||||
- /Users/bruno/Documents/Scripts
|
||||
- /Users/bruno/.gem/ruby/2.6.0/bin
|
||||
- /usr/local/opt/ruby/bin
|
||||
- /usr/local/sbin
|
||||
- /usr/local/bin
|
||||
- /usr/bin
|
||||
- /bin
|
||||
- /usr/sbin
|
||||
- /sbin
|
||||
- /Library/TeX/texbin
|
||||
- /usr/local/MacGPG2/bin
|
||||
- /opt/X11/bin
|
||||
|
||||
$ gem environment gemdir
|
||||
/usr/local/lib/ruby/gems/2.6.0
|
||||
|
||||
$ gem environment gempath
|
||||
/Users/bruno/.gem/ruby/2.6.0:/usr/local/lib/ruby/gems/2.6.0:/usr/local/Cellar/ruby/2.6.5/lib/ruby/gems/2.6.0
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Gem
|
||||
|
||||
#### Installer un gem:
|
||||
|
||||
```bash
|
||||
$ gem install color_echo
|
||||
Fetching color_echo-3.1.1.gem
|
||||
|
||||
Thank you for installing! =(^x^=
|
||||
See also http://colorecho.github.io
|
||||
|
||||
Successfully installed color_echo-3.1.1
|
||||
Parsing documentation for color_echo-3.1.1
|
||||
Installing ri documentation for color_echo-3.1.1
|
||||
Done installing documentation for color_echo after 0 seconds
|
||||
1 gem installed
|
||||
|
||||
# Installer une version spécifique:
|
||||
|
||||
$ gem install color_echo -v 3.1.0
|
||||
|
||||
```
|
||||
|
||||
#### Installer un gem en local:
|
||||
|
||||
```bash
|
||||
$ gem install colorls --user-install
|
||||
```
|
||||
|
||||
#### Mettre à jour un gem:
|
||||
|
||||
```bash
|
||||
$ gem update colorls
|
||||
Updating installed gems
|
||||
```
|
||||
|
||||
#### Mettre à jour tous les gems:
|
||||
|
||||
```bash
|
||||
$ gem update
|
||||
Updating installed gems
|
||||
```
|
||||
|
||||
La mise-à-jour ne supprime pas les anciennes versions. Utiliser la commande *cleanup* .
|
||||
|
||||
#### Liste des gems installés:
|
||||
|
||||
```bash
|
||||
$ gem list
|
||||
|
||||
*** LOCAL GEMS ***
|
||||
|
||||
bigdecimal (default: 1.4.1)
|
||||
bundler (default: 1.17.3)
|
||||
clocale (0.0.4)
|
||||
...
|
||||
```
|
||||
|
||||
#### Où un gem est installé:
|
||||
|
||||
```bash
|
||||
# installé avec gem install colorls --user-install
|
||||
|
||||
$ gem list -d colorls
|
||||
|
||||
*** LOCAL GEMS ***
|
||||
|
||||
colorls (1.2.0)
|
||||
Author: Athitya Kumar
|
||||
Homepage: https://github.com/athityakumar/colorls
|
||||
License: MIT
|
||||
Installed at: /Users/bruno/.gem/ruby/2.6.0
|
||||
|
||||
A Ruby CLI gem that beautifies the terminal's ls command, with color
|
||||
and font-awesome icons.
|
||||
|
||||
|
||||
```
|
||||
|
||||
```bash
|
||||
# installé avec gem install martilla
|
||||
|
||||
$ gem list -d martilla
|
||||
|
||||
*** LOCAL GEMS ***
|
||||
|
||||
martilla (0.4.0)
|
||||
Author: Fernando Valverde
|
||||
Homepage: https://github.com/fdoxyz/martilla
|
||||
License: MIT
|
||||
Installed at: /usr/local/lib/ruby/gems/2.6.0
|
||||
|
||||
Easy to configure backup tool for simple everyday use
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
$ gem which martilla
|
||||
/usr/local/lib/ruby/gems/2.6.0/gems/martilla-0.4.0/lib/martilla.rb
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user