lib/rim/processor.rb in esr-rim-1.3.4 vs lib/rim/processor.rb in esr-rim-1.3.5

- old
+ new

@@ -15,28 +15,31 @@ MaxThreads = 10 GerritServer = "ssh://gerrit/" def initialize(workspace_root, logger) @ws_root = workspace_root - if ENV.has_key?('HOME') - @rim_path = File.join(ENV['HOME'], ".rim", Digest::SHA1.hexdigest(@ws_root)[0...10]) + rim_dir = nil + rim_dir = ENV['RIM_HOME'] if ENV.has_key?('RIM_HOME') + rim_dir = File.join(ENV['HOME'], ".rim") if rim_dir.nil? && ENV.has_key?('HOME') + if rim_dir + @rim_path = File.join(rim_dir, Processor.shorten_path(@ws_root)) else @rim_path = File.join(@ws_root, ".rim") end @logger = logger end def module_git_path(remote_path) # remote url without protocol specifier # this way the local path should be unique - File.join(@rim_path, remote_path) + File.join(@rim_path, Processor.shorten_path(remote_path)) end def module_tmp_git_path(remote_path) # remote url without protocol specifier # this way the local path should be unique - File.join(@rim_path, ".tmp", remote_path) + File.join(@rim_path, ".tmp", Processor.shorten_path(remote_path)) end def remote_path(remote_url) remote_url. # protocol specifier, e.g. ssh:// @@ -136,9 +139,13 @@ if !messages.empty? raise RimException.new(messages) end end end + +def self.shorten_path(path) + Digest::SHA1.hexdigest(path || '')[0...10] +end end end