Class: Gem2Rpm::RpmFile

Inherits:
String
  • Object
show all
Defined in:
lib/gem2rpm/rpm_file.rb

Instance Method Summary collapse

Instance Method Details

#doc?Boolean

Returs true for documentation files.

Returns:

  • (Boolean)


27
28
29
# File 'lib/gem2rpm/rpm_file.rb', line 27

def doc?
  Helpers.check_str_on_conditions(self, Gem2Rpm::Configuration.instance.rule_for(:doc))
end

#ignore?Boolean

Returns true for files which should be ommited from the package.

Returns:

  • (Boolean)


37
38
39
# File 'lib/gem2rpm/rpm_file.rb', line 37

def ignore?
  Helpers.check_str_on_conditions(self, Gem2Rpm::Configuration.instance.rule_for(:ignore))
end

#license?Boolean

Returns true for license files.

Returns:

  • (Boolean)


32
33
34
# File 'lib/gem2rpm/rpm_file.rb', line 32

def license?
  Helpers.check_str_on_conditions(self, Gem2Rpm::Configuration.instance.rule_for(:license))
end

#misc?Boolean

Returns true for other known miscellaneous files.

Returns:

  • (Boolean)


47
48
49
# File 'lib/gem2rpm/rpm_file.rb', line 47

def misc?
  Helpers.check_str_on_conditions(self, Gem2Rpm::Configuration.instance.rule_for(:misc))
end

#test?Boolean

Returns true for files which are part of package test suite.

Returns:

  • (Boolean)


42
43
44
# File 'lib/gem2rpm/rpm_file.rb', line 42

def test?
  Helpers.check_str_on_conditions(self, Gem2Rpm::Configuration.instance.rule_for(:test))
end

#to_rpmObject

Returns string with entry suitable for RPM .spec file. This typically includes all necessary macros depending on file categorization.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/gem2rpm/rpm_file.rb', line 8

def to_rpm
  config = Gem2Rpm::Configuration.instance

  case
  when license?
    "#{config.macro_for(:license)} #{config.macro_for(:instdir)}/#{self}".strip
  when doc?
    "#{config.macro_for(:doc)} #{config.macro_for(:instdir)}/#{self}".strip
  when ignore?
    "#{config.macro_for(:ignore)} #{config.macro_for(:instdir)}/#{self}".strip
  # /lib should have its own macro
  when self == 'lib'
    "#{config.macro_for(:libdir)}"
  else
    "#{config.macro_for(:instdir)}/#{self}"
  end
end