This file is indexed.

/usr/lib/ruby/vendor_ruby/haml/magic_translations/tasks.rb is in ruby-haml-magic-translations 4.0.3-2.

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
# -*- coding: UTF-8 -*-

require 'rake'
require 'rake/tasklib'
require 'gettext'
require 'gettext/tools'
require 'gettext/tools/xgettext'

require 'haml/magic_translations/xgettext/haml_parser'

module Haml::MagicTranslations::Tasks # :nodoc:
  # Rake task to generate and update PO files for a project using
  # Haml::MagicTranslations
  #
  # === Example
  #
  # Rakefile excerpt:
  #
  #   Haml::MagicTranslations::Tasks::UpdatePoFiles.new do |t|
  #     t.text_domain = 'my_project'
  #     t.files = Dir.glob("views/**/*.{rb,haml}") << "lib/my_project.rb"
  #     t.app_version = 'my_project 0.1'
  #   end
  #
  # Updating PO files in the ++po++ directory will be done by issuing:
  #
  #   rake update_pofiles
  #
  class UpdatePoFiles < ::Rake::TaskLib
    # The name of the task
    attr_accessor :name

    # the textdomain name (see GetText.update_pofiles)
    attr_accessor :text_domain

    # an Array of target files, that should be parsed for messages
    attr_accessor :files

    # the application information which appears "Project-Id-Version: #app_version" in the pot/po-files
    attr_accessor :app_version

    # update files only for one language - the language specified by this option
    attr_accessor :lang

    # the root directory of po-files
    attr_accessor :po_root

    # an array with the options, passed through to the gnu msgmerge tool
    #
    # Symbols are automatically translated to options with dashes,
    # example: ++[:no_wrap, :no_fuzzy_matching, :sort_output]++ translated to
    # ++--no-fuzzy-matching --sort-output++.
    attr_accessor :msgmerge

    # true to show verbose messages. default is false
    attr_accessor :verbose

    def initialize(name = :update_pofiles)
      @name = name

      yield self if block_given?

      define
    end

  protected

    def define
      desc "Update PO files"
      task(name) do
        [ :text_domain, :files, :app_version ].each do |opt|
          abort "`#{opt}` needs to be set." if send(opt).nil?
        end
        options = {}
        [ :lang, :po_root, :verbose ].each do |opt|
          options[opt] = send(opt) if send(opt)
        end
        GetText::Tools::XGetText.add_parser(Haml::MagicTranslations::XGetText::HamlParser)
        GetText.update_pofiles(text_domain, files, app_version, options)
      end
    end
  end
end