Sha256: f19f03ffd956269a25950ec6cff1a893b0737f038bdb26cbf4ab84959c784ffa

Contents?: true

Size: 1.16 KB

Versions: 107

Compression:

Stored size: 1.16 KB

Contents

module RVM
  class Environment

    # Batch define common operations.
    %w(all archives repos sources logs).each do |cleanup_type|
      define_method(:"cleanup_#{cleanup_type}") do
        rvm(:cleanup, cleanup_type).successful?
      end
    end

    # Returns the ruby-like interface defined by CleanupWrapper
    def cleanup
      @cleanup_wrapper ||= CleanupWrapper.new(self)
    end

    # Implements a Ruby-like interface to cleanup, making it nicer to deal with.
    class CleanupWrapper

      def initialize(parent)
        @parent = parent
      end

      # Cleans up archives, repos, sources and logs
      def all
        @parent.cleanup_all
      end
      alias everything all

      # Cleans up everything in the archives folder
      def archives
        @parent.cleanup_archives
      end

      # Cleans up everything in the repos path
      def repos
        @parent.cleanup_repos
      end
      alias repositories repos

      # Cleans up everything in the source folder
      def sources
        @parent.cleanup_sources
      end
      alias src sources

      # Cleans up all of the logs
      def logs
        @parent.cleanup_logs
      end

    end

  end
end

Version data entries

107 entries across 107 versions & 2 rubygems

Version Path
rvm-1.11.3.9 lib/rvm/environment/cleanup.rb
rvm-1.11.3.8 lib/rvm/environment/cleanup.rb
rvm-1.11.3.7 lib/rvm/environment/cleanup.rb
rvm-1.11.3.6 lib/rvm/environment/cleanup.rb
rvm-1.11.3.5 lib/rvm/environment/cleanup.rb
rvm-1.11.3.4 lib/rvm/environment/cleanup.rb
rvm-1.11.3.3 lib/rvm/environment/cleanup.rb
rvm-1.11.3.2 lib/rvm/environment/cleanup.rb
rvm-1.11.3.1 lib/rvm/environment/cleanup.rb
rvm-1.11.3 lib/rvm/environment/cleanup.rb
rvm-1.9.2 lib/rvm/environment/cleanup.rb
rvm-1.9.1 lib/rvm/environment/cleanup.rb
rvm-1.9.0 lib/rvm/environment/cleanup.rb
rvm-1.8.6 lib/rvm/environment/cleanup.rb
rvm-1.8.5 lib/rvm/environment/cleanup.rb
rvm-1.8.4 lib/rvm/environment/cleanup.rb
rvm-1.8.3 lib/rvm/environment/cleanup.rb
rvm-1.8.2 lib/rvm/environment/cleanup.rb
rvm-1.8.1 lib/rvm/environment/cleanup.rb
rvm-1.7.0 lib/rvm/environment/cleanup.rb