This file is indexed.

/usr/lib/ruby/vendor_ruby/vim/addon_manager/addon.rb is in vim-addon-manager 0.5.3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# vim-addons: command line manager of Vim addons
#
# Copyright (C) 2007 Stefano Zacchiroli
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

require 'vim/addon_manager/addon_status'

module Vim

  class AddonManager

    class Addon

      # Initializes a new Addon instance.
      #
      # If a subclass defines its own +initialize+ method, then it *must* call
      # super at some point to make sure essential data is properly
      # initialized.
      #
      def initialize(yaml, basedir)
        @metadata = yaml

        @basedir = (yaml['basedir'] or basedir)
        @description = yaml['description']
        @name = yaml['addon']

        @disabled_by_line = yaml['disabledby']
        if @disabled_by_line then
          @disabled_by_RE = /^\s*#{Regexp.escape @disabled_by_line}\s*$/
        else
          @disabled_by_RE = nil
        end

      end

      # Returns a Set of the files contained in this addon.
      #
      # This method must be overriden by subclasses.
      #
      def files
        Set.new
      end

      # return the status of the self add-on wrt a target installation
      # directory, and the system wide installation directory.
      #
      # A status may be one of the following values
      #  * :not_installed (the addon is not installed at all)
      #  * :installed (the addon is completely installed)
      #  * :broken (the addon is only partially installed)
      #  * :unavailable (source files are missing)
      #  * :unkonwn (the addon is unkonwn to the system)
      #
      # This method must be overriden by subclasses.
      #
      def status(target_dir)
        AddonStatus.new :unkonwn
      end

      def mkdir(dest)
        dest_dir = File.dirname dest
        if Process.euid == 0
          FileUtils.mkdir_p dest_dir, :mode => 0755
        else
          FileUtils.mkdir_p dest_dir
        end
      end

      # Installs addon files into +target_dir+ and returns a list of installed
      # files.
      #
      # This method must be overriden by subclasses.
      #
      def install(target_dir)
        []
      end

      # Removes addon files from +target_dir+ and returns a list of installed
      # files.
      #
      # This method must be overriden by subclasses.
      #
      def remove(target_dir)
        []
      end

      def to_s
        name
      end

      def <=>(other)
        self.name <=> other.name
      end

      # checks if a given line (when present in a Vim configuration file) is
      # suitable for disabling the addon
      #
      def is_disabled_by?(line)
        return false unless @disabled_by_RE # the addon can't be disabled if no
        # disabledby field has been provided
        line =~ @disabled_by_RE ? true : false
      end

      attr_reader :metadata
      attr_reader :basedir
      attr_reader :description
      attr_reader :name
      attr_reader :disabled_by_line
      alias_method :addon, :name

      def self.build(yaml, basedir)
        case yaml['type']
        when 'directory'
          Vim::AddonManager::Addon::Directory.new(yaml, basedir)
        else
          Vim::AddonManager::Addon::Legacy.new(yaml, basedir)
        end
      end

      private

      def logger
        Vim::AddonManager.logger
      end

      # checks whether the addon is disabled wrt a given target installation dir
      #
      def is_disabled_in?(target_dir)
        filename = Vim::AddonManager.override_file(target_dir)
        return false unless File.exist?(filename)
        File.open(filename) do |file|
          file.any? {|line| is_disabled_by? line}
        end
      end

    end

  end

end

require 'vim/addon_manager/addon/legacy'
require 'vim/addon_manager/addon/directory'