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.1.10 lib/rvm/environment/cleanup.rb
rvm-1.1.9 lib/rvm/environment/cleanup.rb
rvm-1.1.8 lib/rvm/environment/cleanup.rb
rvm-1.1.7 lib/rvm/environment/cleanup.rb
rvm-1.1.6 lib/rvm/environment/cleanup.rb
rvm-1.1.5 lib/rvm/environment/cleanup.rb
rvm-1.1.4 lib/rvm/environment/cleanup.rb
rvm-1.1.3 lib/rvm/environment/cleanup.rb
rvm-1.1.2 lib/rvm/environment/cleanup.rb
rvm-1.1.1 lib/rvm/environment/cleanup.rb
rvm-1.1.0 lib/rvm/environment/cleanup.rb
rvm-1.0.23 lib/rvm/environment/cleanup.rb
rvm-1.0.22 lib/rvm/environment/cleanup.rb
rvm-1.0.21 lib/rvm/environment/cleanup.rb
rvm-1.0.20 lib/rvm/environment/cleanup.rb
rvm-1.0.19 lib/rvm/environment/cleanup.rb
rvm-1.0.18 lib/rvm/environment/cleanup.rb
rvm-1.0.17 lib/rvm/environment/cleanup.rb
rvm-1.0.15 lib/rvm/environment/cleanup.rb
gemrage-1.0.0 vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/cleanup.rb