Module: UberTask::Internal::Path

Defined in:
lib/uber_task/internal/path.rb

Class Method Summary collapse

Class Method Details

.shorten(path) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/uber_task/internal/path.rb', line 6

def self.shorten(path)
  if defined?(Rails)
    rails_root = Rails.root.to_s
    if rails_root && path.start_with?(rails_root)
      path = path.delete_prefix(rails_root)
      return "[PROJECT]#{path}"
    end
  end
  path.gsub(%r{^.+?/(ruby)?gems}, '[GEM]')
end