From 6e692b6d7eee6aa1247c5317f794586722e5e1cd Mon Sep 17 00:00:00 2001 From: Zaiste! Date: Tue, 23 Apr 2013 17:32:48 -0700 Subject: [PATCH 1/2] support for chruby --- lib/mina/chruby.rb | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 lib/mina/chruby.rb diff --git a/lib/mina/chruby.rb b/lib/mina/chruby.rb new file mode 100644 index 00000000..67e7f662 --- /dev/null +++ b/lib/mina/chruby.rb @@ -0,0 +1,49 @@ +# # Modules: chruby +# Adds settings and tasks for managing [chruby] installations. +# +# [chruby]: https://github.com/postmodern/chruby +# +# require 'mina/chruby' +# +# ## Common usage +# +# task :environment do +# invoke :'chruby[ruby-1.9.3-p392]' +# end +# +# task :deploy => :environment do +# ... +# end + +# ## Settings +# Any and all of these settings can be overriden in your `deploy.rb`. + +# ### chruby_path +# Path where *chruby* init scripts are installed. +# +set_default :chruby_path, "/etc/profile.d/chruby.sh" + +# ## Tasks + +# ### chruby[version] +# Switch to given Ruby version + +task :chruby, :env do |t, args| + unless args[:env] + print_error "Task 'chruby' needs a Ruby version as an argument." + print_error "Example: invoke :'chruby[ruby-1.9.3-p392]'" + die + end + + queue %{ + echo "-----> chruby to version: '#{args[:env]}" + + if [[ ! -s "#{chruby_path}" ]]; then + echo "! chruby.sh init file not found" + exit 1 + fi + + source #{chruby_path} + #{echo_cmd %{chruby "#{args[:env]}"}} || exit 1 + } +end From 9fa8c16e31d0016fff6b2e3f23b15582664feefc Mon Sep 17 00:00:00 2001 From: Zaiste! Date: Mon, 12 Aug 2013 17:56:49 +0200 Subject: [PATCH 2/2] fix: quotes match --- lib/mina/chruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mina/chruby.rb b/lib/mina/chruby.rb index 67e7f662..115c0ede 100644 --- a/lib/mina/chruby.rb +++ b/lib/mina/chruby.rb @@ -36,7 +36,7 @@ end queue %{ - echo "-----> chruby to version: '#{args[:env]}" + echo "-----> chruby to version: '#{args[:env]}'" if [[ ! -s "#{chruby_path}" ]]; then echo "! chruby.sh init file not found"