LoginSignup
29
30

More than 5 years have passed since last update.

コマンド1つでRails開発用tmuxパネルを構築する

Last updated at Posted at 2012-08-14

追記

tmuxinatorで一瞬で開発環境を起動するにあるtmuxinatorを使うと,gemを入れてyamlファイルを書くだけで以下のようなことができるようです.
追記ここまで

以下のファイルを~/.tmux/ror.confなどに保存し,tmuxを立ち上げてからtmux source-file ~/.tmux/ror.confを実行すると,ログ用ウィンドウやpry用ウィンドウなどを作ってくれる.

利用しているツール

設定ファイル

ror.conf
# Settings for Rails project
# $ tmux source-file ~/.tmux/ror.conf
# 
# Set up 3 windows
# 1: LOG: rails logs with powder
# 2: TEST: execute spork
# 3: pry (rails c) & rails-sh

# To create three new windows
# neww
# neww
# neww

# 0
select-window -t 0
send-keys 'git status' C-m

# 1
select-window -t 1
rename-window LOG
split-window -h
send-keys -t LOG.0 'powder applog | grep -vE "(^\s*$|asset)"' C-m
send-keys -t LOG.1 'powder log' C-m

# 2
select-window -t 2
rename-window TEST
split-window -h
send-keys -t TEST.0 'bundle exec spork' C-m
send-keys -t TEST.1 'bundle exec spec'

# 3
select-window -t 3
rename-window PRY_RAILS-SH
split-window -h
send-keys -t PRY_RAILS-SH.0 'rails c' C-m
send-keys -t PRY_RAILS-SH.1 'rails-sh' C-m

# Back to 0
select-window -t 0

tmuxで特定ウィンドウ/paneでコマンドを実行する方法は http://qiita.com/items/5e3e047569aa15187c49 を参考にした.
tmux send-keys -t name.0 'ls' C-m

29
30
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
29
30