Sha256: cc0a93788138c903e4fcd18b9e5780e8662d90196490eab6ec8a1f99af11ed31

Contents?: true

Size: 837 Bytes

Versions: 80

Compression:

Stored size: 837 Bytes

Contents

require 'fileutils'

module AppMap
  module Depends
    module Util
      extend self

      def normalize_path(path, pwd: Dir.pwd)
        normalize_path_fn(pwd).(path)
      end

      def normalize_paths(paths, pwd: Dir.pwd)
        paths.map(&normalize_path_fn(pwd))
      end
            
      def delete_appmap(appmap_path)
        FileUtils.rm_rf(appmap_path)
        appmap_file_path = [ appmap_path, 'appmap.json' ].join('.')
        File.unlink(appmap_file_path) if File.exist?(appmap_file_path)
      rescue
        warn "Unable to delete AppMap: #{$!}"
      end

      private

      def normalize_path_fn(pwd)
        lambda do |path|
          next path if AppMap::Util.blank?(path)

          path = path[pwd.length + 1..-1] if path.index(pwd) == 0
          path.split(':')[0]
        end  
      end
    end
  end
end

Version data entries

80 entries across 80 versions & 1 rubygems

Version Path
appmap-1.1.1 lib/appmap/depends/util.rb
appmap-1.0.1 lib/appmap/depends/util.rb
appmap-1.0.0 lib/appmap/depends/util.rb
appmap-0.103.0 lib/appmap/depends/util.rb
appmap-0.102.2 lib/appmap/depends/util.rb
appmap-0.102.1 lib/appmap/depends/util.rb
appmap-0.102.0 lib/appmap/depends/util.rb
appmap-0.101.0 lib/appmap/depends/util.rb
appmap-0.100.0 lib/appmap/depends/util.rb
appmap-0.99.4 lib/appmap/depends/util.rb
appmap-0.99.2 lib/appmap/depends/util.rb
appmap-0.99.1 lib/appmap/depends/util.rb
appmap-0.99.0 lib/appmap/depends/util.rb
appmap-0.98.1 lib/appmap/depends/util.rb
appmap-0.98.0 lib/appmap/depends/util.rb
appmap-0.97.0 lib/appmap/depends/util.rb
appmap-0.96.0 lib/appmap/depends/util.rb
appmap-0.95.2 lib/appmap/depends/util.rb
appmap-0.95.1 lib/appmap/depends/util.rb
appmap-0.95.0 lib/appmap/depends/util.rb