Sha256: e7ccb14dba60b5e104e61f24b86b4b90976bb8d9fda99b218493e9f439c1e734

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

# frozen_string_literal: true

set :rvm_use_path, '$HOME/.rvm/scripts/rvm'

task :'rvm:use', :env do |_, args|
  unless args[:env]
    puts "Task 'rvm:use' needs an RVM environment name as an argument."
    puts "Example: invoke :'rvm:use', 'ruby-1.9.2@default'"
    exit 1
  end

  comment %(Using RVM environment \\\"#{args[:env]}\\\")
  command %(
    if [[ ! -s "#{fetch(:rvm_use_path)}" ]]; then
      echo "! Ruby Version Manager not found"
      echo "! If RVM is installed, check your :rvm_use_path setting."
      exit 1
    fi
  )
  command %(source #{fetch(:rvm_use_path)})
  command %(rvm use "#{args[:env]}" --create)
end

task :'rvm:wrapper', :env, :name, :bin do |_, args|
  unless args[:env] && args[:name] && args[:bin]
    puts "Task 'rvm:wrapper' needs an RVM environment name, a wrapper name and the binary name as arguments"
    puts "Example: invoke :'rvm:wrapper', 'ruby-1.9.2@myapp,myapp,unicorn_rails'"
    exit 1
  end

  comment %(creating RVM wrapper "#{args[:name]}_#{args[:bin]}" using \\"#{args[:env]}\\")
  command %(
    if [[ ! -s "#{fetch(:rvm_use_path)}" ]]; then
      echo "! Ruby Version Manager not found"
      echo "! If RVM is installed, check your :rvm_use_path setting."
      exit 1
    fi
  )
  command %(source #{fetch(:rvm_use_path)})
  command %(rvm wrapper #{args[:env]} #{args[:name]} #{args[:bin]} || exit 1)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mina-1.2.5 tasks/mina/rvm.rb