Class: Gem2Rpm::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/gem2rpm/configuration.rb

Constant Summary collapse

DEFAULT_MACROS =

The defaults should mostly work

{
  :instdir => '%{gem_instdir}',
  :libdir => '%{gem_libdir}',
  :doc => '%doc',
  :license => '%license',
  :ignore => '%exclude'
}
DEFAULT_RULES =
{
  :doc => [/\/?CHANGELOG.*/i, /\/?CONTRIBUTING.*/i, /\/?CONTRIBUTORS.*/i,
           /\/?AUTHORS.*/i,/\/?README.*/i, /\/?History.*/i, /\/?Release.*/i,
           /\/?doc(\/.*)?/, 'NEWS'],
  :license => [/\/?MIT/, /\/?GPLv[0-9]+/, /\/?.*LICEN(C|S)E/, /\/?COPYING/],
  :ignore => ['.gemtest', '.gitignore', '.travis.yml', '.yardopts', '.rvmrc',
              '.rubocop.yml', /^\..*rc$/i],
  # Other files including test files that are not required for
  # runtime and therefore currently included in -doc
  :misc => [/.*.gemspec/, /Gemfile.*/, 'Rakefile', 'rakefile.rb', 'Vagrantfile',
            /^spec.*/, /^rspec.*/, /^test(s|)/, /^examples.*/]
}

Instance Method Summary collapse

Instance Method Details

#macro_for(category) ⇒ Object



46
47
48
# File 'lib/gem2rpm/configuration.rb', line 46

def macro_for(category)
  macros[category] ||= ''
end

#macrosObject

Hash with macros for files categories



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

def macros
  @_macros ||= DEFAULT_MACROS.dup
end

#rule_for(category) ⇒ Object



50
51
52
# File 'lib/gem2rpm/configuration.rb', line 50

def rule_for(category)
  rules[category] ||= ''
end

#rulesObject

Hash with rules for file categorization



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

def rules
  @_rules ||= DEFAULT_RULES.dup
end

#to_defaultObject

Set the configuration back to default



30
31
32
33
34
# File 'lib/gem2rpm/configuration.rb', line 30

def to_default
  @_macros = nil
  @_rules = nil
  self
end