From c5d3ff35241aebcdcca4e9196452225c6f520eb5 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Thu, 24 Jul 2014 20:09:24 -0700 Subject: [PATCH] [ruby] Add Ruby configs --- ansible/config.yml | 2 ++ ruby/.gemrc | 1 + ruby/.irbrc | 35 +++++++++++++++++++++++++++++++++++ ruby/.pryrc | 26 ++++++++++++++++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 ruby/.gemrc create mode 100644 ruby/.irbrc create mode 100644 ruby/.pryrc diff --git a/ansible/config.yml b/ansible/config.yml index 27c14db..d0e1025 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 0000000..154cd47 --- /dev/null +++ b/ruby/.gemrc @@ -0,0 +1 @@ +gem: --no-document diff --git a/ruby/.irbrc b/ruby/.irbrc new file mode 100644 index 0000000..baf9f68 --- /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 0000000..b0f5306 --- /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)