[ruby] Add Ruby configs
change
commit c5d3ff35241aebcdcca4e9196452225c6f520eb5
author Alpha Chen <alpha.chen@gmail.com>
date
parent 4e81dec0
diff --git a/ansible/config.yml b/ansible/config.yml
index 27c14dbc..d0e10256 100644
--- a/ansible/config.yml
+++ b/ansible/config.yml
@@ -16,7 +16,9 @@
   vars:
     stow_packages:
     - git
+    - ruby
     - tmux
+    - vim
   tasks:
   - name: clone/update dotfiles
     git: repo=https://github.com/kejadlen/dotfiles.git dest=~/.dotfiles
diff --git a/ruby/.gemrc b/ruby/.gemrc
new file mode 100644
index 00000000..154cd47e
--- /dev/null
+++ b/ruby/.gemrc
@@ -0,0 +1 @@
+gem: --no-document
diff --git a/ruby/.irbrc b/ruby/.irbrc
new file mode 100644
index 00000000..baf9f68c
--- /dev/null
+++ b/ruby/.irbrc
@@ -0,0 +1,35 @@
+require 'irb/completion'
+require 'irb/ext/save-history' unless RUBY_ENGINE == 'macruby'
+require 'pp'
+
+# tab completion
+ARGV.concat %w[ --readline --prompt-mode simple ] unless RUBY_ENGINE == 'macruby'
+
+IRB.conf[:AUTO_INDENT] = true
+IRB.conf[:EVAL_HISTORY] = 1000
+IRB.conf[:SAVE_HISTORY] = 1000
+IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
+
+# shut irb up
+# IRB.conf[:PROMPT][ IRB.conf[:PROMPT_MODE] ][:RETURN] = ''
+
+# require 'wirble'
+# def pc(*ary)
+#   ary.each do |obj|
+#     puts Wirble::Colorize.colorize(obj.inspect)
+#   end
+# end
+
+def history
+  Readline::HISTORY.to_a
+end
+
+irbrc_local = File.expand_path('../.irbrc.local', __FILE__)
+require irbrc_local if File.exists?(irbrc_local)
+
+begin
+  # use Pry if it exists
+  require 'pry'
+  Pry.start || exit
+rescue LoadError
+end
diff --git a/ruby/.pryrc b/ruby/.pryrc
new file mode 100644
index 00000000..b0f53068
--- /dev/null
+++ b/ruby/.pryrc
@@ -0,0 +1,26 @@
+Pry.config.editor = 'vim'
+
+Pry.prompt = [
+  proc { |target, _, _| "(#{Pry.view_clip(target)})> " },
+  proc { |target, _, _| "(#{Pry.view_clip(target)})| " },
+]
+
+begin
+  require 'pry-debugger'
+  Pry.commands.alias_command 'c', 'continue'
+  Pry.commands.alias_command 's', 'step'
+  Pry.commands.alias_command 'n', 'next'
+  Pry.commands.alias_command 'u', 'finish' # up
+  Pry.commands.alias_command 'b', 'break'
+rescue LoadError
+end
+
+def pbcopy(str)
+  IO::popen(%w[pbcopy], 'w') {|io| io.write str }
+end
+
+def tic; @_tic = Time.now; end
+def toc; Time.now - @_tic; end
+
+pryrc_local = File.expand_path('../.pryrc.local', __FILE__)
+load pryrc_local if File.exists?(pryrc_local)