Class: Gem2Rpm::Configuration
- Inherits:
-
Object
- Object
- Gem2Rpm::Configuration
- Includes:
- Singleton
- Defined in:
- lib/gem2rpm/configuration.rb
Defined Under Namespace
Classes: InvalidOption
Constant Summary collapse
- CURRENT_DIR =
Dir.pwd
- DEFAULT_OPTIONS =
{ :print_template_file => nil, :template_file => nil, :templates => false, :version => false, :output_file => nil, :local => false, :srpm => false, :deps => false, :nongem => false, :doc_subpackage => true, :fetch => false, :directory => CURRENT_DIR, }.freeze
- DEFAULT_MACROS =
The defaults should mostly work
{ :instdir => '%{gem_instdir}', :libdir => '%{gem_libdir}', :doc => '%doc', :license => '%license', :ignore => '%exclude' }.freeze
- 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/i, /\/?COPYING/, ], :ignore => [ '.gemtest', '.gitignore', '.travis.yml', '.hound.yml', '.yardopts', '.rspec', '.rvmrc', '.rubocop.yml', '.rubocop_todo.yml', /^\..*rc$/i, ], :test => [ '.rspec', 'cucumber.yml', /^features.*/, /^r?spec.*/, /^tests?/, ], # Other files including test files that are not required for # runtime and therefore currently included in -doc :misc => [ /Gemfile.*/, 'Rakefile', 'rakefile.rb', 'Vagrantfile', /^examples.*/, /\/?.*\.gemspec$/, ] }.freeze
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #macro_for(category) ⇒ Object
-
#macros ⇒ Object
Hash with macros for files categories.
-
#options ⇒ Object
Get options.
-
#reset ⇒ Object
Set the configuration back to default values.
- #rule_for(category) ⇒ Object
-
#rules ⇒ Object
Hash with rules for file categorization.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
85 86 87 88 |
# File 'lib/gem2rpm/configuration.rb', line 85 def initialize @options = nil @parser = nil end |
Instance Method Details
#macro_for(category) ⇒ Object
107 108 109 |
# File 'lib/gem2rpm/configuration.rb', line 107 def macro_for(category) macros[category] ||= '' end |
#macros ⇒ Object
Hash with macros for files categories
98 99 100 |
# File 'lib/gem2rpm/configuration.rb', line 98 def macros @_macros ||= DEFAULT_MACROS.dup end |
#options ⇒ Object
Get options.
116 117 118 119 |
# File 'lib/gem2rpm/configuration.rb', line 116 def unless @options @options end |
#reset ⇒ Object
Set the configuration back to default values
91 92 93 94 95 |
# File 'lib/gem2rpm/configuration.rb', line 91 def reset @_macros = nil @_rules = nil self end |
#rule_for(category) ⇒ Object
111 112 113 |
# File 'lib/gem2rpm/configuration.rb', line 111 def rule_for(category) rules[category] ||= '' end |
#rules ⇒ Object
Hash with rules for file categorization
103 104 105 |
# File 'lib/gem2rpm/configuration.rb', line 103 def rules @_rules ||= DEFAULT_RULES.dup end |