Sha256: efb2c6e517072444cc2146613c18b49e958770c3738a209803117e7b80260610

Contents?: true

Size: 977 Bytes

Versions: 8

Compression:

Stored size: 977 Bytes

Contents

module Rda
  class Rvm < Thor
    include Thor::Actions

    def self.source_root
      File.dirname(__FILE__)
    end

    desc "setup", "Setup RVM for rails application"
    def setup
      if installed?
        template('templates/rvmrc', rvmrc_path)
      else
        $stderr.puts "ERROR: RVM is not found. Please make sure that RVM is installed."
      end
    end

    desc "discard", "Discard RVM settings for rails application"
    def discard
      if File.exists?(rvmrc_path)
        remove_file(rvmrc_path)
      else
        $stderr.puts "ERROR: #{rvmrc_path} not found."
      end
    end

    private
    def installed?
      rvm_path && Dir.exists?(rvm_path)
    end

    def rvm_path
      ENV['rvm_path']
    end

    def gemset_name
      "ruby-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}@#{Rda::Rails.app_name}"
    end

    def gemset_env
      "#{rvm_path}/environments/#{gemset_name}"
    end

    def rvmrc_path
      "#{::Rails.root}/.rvmrc"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rda-0.3.0 lib/rda/rvm.rb
rda-0.2.0 lib/rda/rvm.rb
rda-0.1.0 lib/rda/rvm.rb
rda-0.0.6 lib/rda/rvm.rb
rda-0.0.4 lib/rda/rvm.rb
rda-0.0.3 lib/rda/rvm.rb
rda-0.0.2 lib/rda/rvm.rb
rda-0.0.1 lib/rda/rvm.rb