added oh-my-ssh back as raw code, not as a submodule.

This commit is contained in:
Johannes Findeisen 2026-11-19 19:29:16 +01:00
commit f663947bfc
1195 changed files with 126994 additions and 0 deletions

View file

@ -0,0 +1,33 @@
# Ruby plugin
This plugin adds aliases for common commands used in dealing with [Ruby](https://www.ruby-lang.org/en/) and [gem packages](https://rubygems.org/).
To use it, add `ruby` to the plugins array in your zshrc file:
```zsh
plugins=(... ruby)
```
## Aliases
| Alias | Command | Description |
| ------- | -------------------------------------- | ---------------------------------------------------- |
| rb | `ruby` | The Ruby command |
| sgem | `sudo gem` | Run sudo gem on the system ruby, not the active ruby |
| rfind | `find . -name "*.rb" -print0 \| xargs -0 grep -n` | Find ruby file |
| rrun | `ruby -e` | Execute some code: E.g: `rrun "puts 'Hello world!'"` |
| rserver | `ruby -run -e httpd . -p 8080` | Start HTTP Webrick serving local directory/files |
| gein | `gem install` | Install a gem into the local repository |
| geun | `gem uninstall` | Uninstall gems from the local repository |
| geli | `gem list` | Display gems installed locally |
| gei | `gem info` | Show information for the given gem |
| geiall | `gem info --all` | Display all gem versions |
| geca | `gem cert --add` | Add a trusted certificate |
| gecr | `gem cert --remove` | Remove a trusted certificate |
| gecb | `gem cert --build` | Build private key and self-signed certificate |
| geclup | `gem cleanup -n` | Do not uninstall gem |
| gegi | `gem generate_index` | Generate index file for gem server |
| geh | `gem help` | Provide additional help |
| gel | `gem lock` | Generate a lockdown list of gems |
| geo | `gem open` | Open gem source in default editor |
| geoe | `gem open -e` | Open gem sources in preferred editor |

View file

@ -0,0 +1,26 @@
# Run sudo gem on the system ruby, not the active ruby
alias sgem='sudo gem'
# Find ruby file
alias rfind='find . -name "*.rb" -print0 | xargs -0 grep -n'
# Shorthand Ruby
alias rb="ruby"
# Gem Command Shorthands
alias gein="gem install"
alias geun="gem uninstall"
alias geli="gem list"
alias gei="gem info"
alias geiall="gem info --all"
alias geca="gem cert --add"
alias gecr="gem cert --remove"
alias gecb="gem cert --build"
alias geclup="gem cleanup -n"
alias gegi="gem generate_index"
alias geh="gem help"
alias gel="gem lock"
alias geo="gem open"
alias geoe="gem open -e"
alias rrun="ruby -e"
alias rserver="ruby -run -e httpd . -p 8080" # requires webrick

View file

@ -0,0 +1,32 @@
#!/usr/bin/env zsh
emulate -LR zsh
source "${1:-${0:A:h:h}/ruby.plugin.zsh}"
test_dir=$(mktemp -d) || exit 1
trap 'command rm -rf -- "$test_dir"' EXIT
typeset -i failures=0 tests=0
typeset filename output
for filename in plain.rb 'file with spaces.rb' "single'quote.rb" 'double"quote.rb' $'line\nbreak.rb' 'unicode-ą.rb'; do
print -r -- 'needle' >| "$test_dir/$filename"
output=$(cd "$test_dir" && rfind needle 2> "$test_dir/stderr")
actual_status=$?
(( tests++ ))
if [[ $actual_status == 0 && $output == '1:needle' && ! -s "$test_dir/stderr" ]]; then
print -r -- "PASS: ${(qqq)filename}"
else
print -u2 -r -- "FAIL: ${(qqq)filename} (status $actual_status)"
print -u2 -r -- " stdout: ${(qqq)output}"
print -u2 -r -- " stderr: $(<"$test_dir/stderr")"
(( failures++ ))
fi
command rm -- "$test_dir/$filename"
done
print -r -- "$tests tests, $failures failures"
(( failures == 0 ))