Text
Page: 1
Terminal
With
Your Life
ITOYANAGI Sakura
THE CONF 2018
Powered by Rabbit 2.2.1 and COZMIXNG
Page: 2
Greeting
Hello, everyone!
Page: 3
Let me introduce myself
name
ITOYANAGI Sakura
GitHub
aycabta
maintainer
RDoc
Page: 4
Community: Asakusa.rb
Asakusa.rb every Ruby Tuesday
Page: 5
Company:
Space Pirates, LLC.
Space Pirates, LLC.
Page: 6
I'm
from Japan
a member of Ruby core
team.
Page: 7
I'm
from Japan
a member of Ruby core
team.
Page: 10
Japan
Brazil is the backside of Japan
Page: 11
Japan
12742km(Through the earth)
Page: 12
Japan
Too far and too hard.
Page: 13
Japan
So many routes from Japan to
Brazil.
Page: 14
Japan
So I decided to go to Brazil via
Europe.
Page: 16
Hobby: Climbing
Mont Blanc mountain range
Page: 17
Hobby: Climbing
Mont Blanc, Grandes Jorasses
Page: 18
Hobby: Climbing
Grandes Jorasses via normale
Page: 19
Hobby: Climbing
I climbed it, but...
Page: 20
Hobby: Climbing
The glacier's condition was bad
Page: 21
Hobby: Climbing
I escaped from 3430m point
Page: 22
Hobby: Climbing
So I want to forget this climbing
route as soon as possible
Page: 23
Terminal
With
Your Life
Page: 24
Terminal With Your Life
I'll talk about "confused
terminal processing routes".
Page: 25
Development environment
What way do you use?
Page: 26
Development environment
Console applications
shell, text editor,
debugger, ...
Browser(frontend)
with text editor
IDE
Page: 27
Development environment
Console applications
shell, text editor,
debugger, ...
Browser(frontend)
with text editor
IDE
Page: 28
Console
On Unix like OSs:
Users press key
Keyboard driver
Terminal emulator
Line descipline
TTY driver
You see character!
Page: 29
Console
On Unix like OSs:
Users press key
Keyboard driver
Terminal emulator
Line descipline
TTY driver
You see character!
Page: 30
Console
On Unix like OSs:
Users press key
Keyboard driver
Terminal emulator
Line descipline
TTY driver
You see character!
Page: 31
Console
On Unix like OSs:
Users press key
Keyboard driver
Terminal emulator
Line descipline
TTY driver
You see character!
Page: 32
Terminal emulator
The rudimentary "terminal" is
a good mix of
typewriter
cable
printer
Page: 33
Terminal emulator
Old teletype
Page: 34
Terminal emulator
Back then, all teletypes used
different "characters and
control codes set" on terminal.
Page: 35
Terminal emulator
So Unix started to provide
compatible "terminal
emulater" layer that is based
on VT100.
Page: 36
Terminal emulator
VT100, famous real terminal
Page: 37
Terminal emulator
VT100 is introduced in August
1978 by DEC(Digital
Equipment Corporation).
Page: 38
Terminal emulator
Most Unix like operating
systems still has VT100
compatible terminal emulator.
Page: 39
Console
On Unix like OSs:
Users press key
Keyboard driver
Terminal emulator
Line descipline
TTY driver
You see character!
Page: 40
Line descipline
This is a simple "line editor" in
kernel.
Page: 41
Line descipline
Two mode in line descipline:
cooked(or canonical) mode
raw mode
Page: 42
Line descipline: cooked(or
canonical) mode
Backspace
Clear line
Redraw
...
Page: 43
Line descipline: cooked(or
canonical) mode
But this is too simple in the
present day.
Page: 44
Line descipline: raw mode
So, this "raw mode" is
important. I'll talk about this
later.
Page: 45
Console
On Unix like OSs:
Users press key
Keyboard driver
Terminal emulator
Line descipline
TTY driver
You see character!
Page: 46
TTY driver
This is for multi "terminal
emulater" with "session". This
is for multi users at first, but
this is for multi terminals in a
day and age.
Page: 47
TTY driver
Do you use terminal
multiplexer?
GNU Screen
tmux
...
Page: 48
TTY driver
The terminal multiplexers
handle the TTY drivers.
Page: 49
TTY driver
And these applications
connect TTY driver:
Terminal.app(macOS)
PuTTY(Windows)
xterm(X Window System)
...
Page: 50
Console
On Unix like OSs:
Users press key
Keyboard driver
Terminal emulator
Line descipline
TTY driver
You see character!
Page: 51
You see character!
Congratulation! You are the
computer master!
Page: 52
Line descipline: raw mode
Tha get back to what I was
saying...
Page: 53
Line descipline: raw mode
Some terminal applications
has so powerful user
interfaces:
Emacs like key bindings
History
Complement
Page: 54
Line descipline: raw mode
In many cases, the "rich" user
inteface is provided by "GNU
Readline" with "raw mode" of
line descipline.
Page: 55
GNU Readline
I think that it's "brand-new
cooked mode line descipline
on application layer".
Page: 56
GNU Readline
Do you use GNU Readline?
Page: 57
GNU Readline
This is powerful line editor for
terminal emulator. It's used
by:
shell(tcsh, Bash, Zsh, ...)
REPL(IRB, Python
Interpreter, ...)
MySQL command-line tool
The GNU Project
Page: 58
GNU Readline
Do you use GNU Readline?
Page: 59
GNU Readline
And now, I'm a member of
Ruby core team.
Page: 60
GNU Readline
Do you use Ruby?
Page: 61
GNU Readline on Ruby
Ruby has "readline" standard
library, but it needs GNU
Readline library when you
build Ruby.
Page: 62
GNU Readline on Ruby
You should install GNU
Readline before installing
Ruby.
Page: 63
GNU Readline on Ruby
The "you build Ruby" means:
By hand
cd ruby-2.5.1 && ./configure
&& make
By rbenv
rbenv install 2.5.1
...
Page: 64
GNU Readline on Ruby
How to install GNU Readline:
macOS
brew install readline
Ubuntu GNU/Linux
sudo apt-get install
libreadline-dev
FreeBSD
sudo pkg install editline
Page: 65
GNU Readline on Ruby
If you build Ruby without GNU
Readline, Ruby doesn't
provide readline library.
Page: 66
GNU Readline on Ruby
If Ruby doesn't provide
readline library:
IRB can not completes
classes, modules, methods
and variables
Pry fails to launch
Page: 67
Pry fails
to launch
Page: 68
Pry fails to launch
One day, a child receive a new
computer as a birthday
present from tender parents.
Page: 69
Pry fails to launch
The child says, "Thank you my
tender parents, can I install
Ruby to my great machine?"
Page: 70
Pry fails to launch
Tender parents nod in
satisfaction.
Page: 71
Pry fails to launch
The child presses commands
below:
$
$
$
$
$
wget http://.../ruby-3.0.0-preview100.tar.gz
tar xvzf ruby-3.0.0-preview100.tar.gz
cd ruby-3.0.0-preview100
./configure
make
Page: 72
Pry fails to launch
$ irb
The child says, "can't
complete class names..."
Page: 73
Pry fails to launch
Tender parents say, "Ruby
core team is developing many
standard tools, you should use
Pry".
Page: 74
Pry fails to launch
$ pry
Sorry, you can't use Pry without Readline or a compatible library.
Possible solutions:
* Rebuild Ruby with Readline support using `--with-readline`
* Use the rb-readline gem, which is a pure-Ruby port of Readline
* Use the pry-coolline gem, a pure-ruby alternative to Readline
Page: 75
Pry fails to launch
$ pry
Sorry, you can't use Pry without Readline or a compatible library.
Possible solutions:
* Rebuild Ruby with Readline support using `--with-readline`
* Use the rb-readline gem, which is a pure-Ruby port of Readline
* Use the pry-coolline gem, a pure-ruby alternative to Readline
The child says, "so sad"
Page: 76
Pry fails to launch
LAPTOP
Page: 77
Pry fails to launch
TERMINATOR
Page: 78
Pry fails to launch
TERMINATOR: "Please wait,
I'm developing pure Ruby
Readline compatible library for
Ruby core"
Page: 79
Pry fails to launch
TERMINATOR: "It's Reline"
Page: 80
Pry fails to launch
The child: "Really?"
Page: 81
Pry fails to launch
TERMINATOR: "Yes"
Page: 82
Reline
Reline is the Readline
compatible pure Ruby library
for Ruby core.
Page: 83
Reline
If you build Ruby without GNU
Readline, "readline" standard
library uses Reline inside.
...maybe next Ruby 2.6...
Page: 84
Reline
If you build Ruby without GNU
Readline, "readline" standard
library uses Reline inside.
...maybe next Ruby 2.6...or...
2.7...
Page: 85
Reline
If you build Ruby without GNU
Readline, "readline" standard
library uses Reline inside.
...maybe next Ruby 2.6...or...
2.7...I can not promise...
Page: 86
Reline
I'll explain Reline
implementation.
Page: 87
Reline
Reline changes line descipline
to "raw mode".
Page: 88
Reline
Reline handles all console
screen:
line editing
completion
Emacs binding
settings
by .inputrc(including
changes to vi binding)
Page: 89
Reline
And, Ruby core team values a
Windows support, so Reline
uses Windows API on
Windows.
Page: 90
Reline
This is exactly what Ruby core
team's works because this
contains many "Unicode"
handling for String class.
Page: 91
Reline
The child: "I'm glad to hear
that"
Page: 92
Reline
But, original IRB author, keiju-
san, is developing "Reidline".
It's multiline editor like
browser's JavaScript console
for new IRB.
Page: 93
Reline
I'll join the development of
Reidline after Reline.
Page: 94
Ruby's line editors that I
talked today
GNU Readline
readline(Ruby's standard
library)
Reline(pure Ruby re-
implementation)
Reidline(multiline editor
library)
Page: 95
Ruby's line editors that I
talked today
Maybe, Ruby 3,
Page: 96
Ruby's line editors that I
talked today
Maybe, Ruby thre...future
Ruby must be greater more.
Page: 97
Ruby's line editors that I
talked today
So you should NOT remember
the complex names.
GNU Readline
readline(Ruby's standard
library)
Reline(pure Ruby re-
implementation)
Page: 98
Thank you
Terminal is complex
TERMINATOR solves it
Bright futre of children with
Ruby
Powered by Rabbit 2.2.1 and COZMIXNG