Module: Danger::Changelog::Config
- Defined in:
- lib/changelog/config.rb
Constant Summary collapse
- ATTRIBUTES =
%i[ placeholder_line filename format ignore_files ].freeze
- ACCESSORS =
ATTRIBUTES.map { |name| "#{name}=".to_sym }
- DELEGATORS =
ATTRIBUTES + ACCESSORS
Class Method Summary collapse
- .format=(value) ⇒ Object
- .ignore_files=(value) ⇒ Object
- .parser ⇒ Object
- .placeholder_line=(value) ⇒ Object
- .placeholder_line? ⇒ Boolean
- .reset ⇒ Object
Class Method Details
.format=(value) ⇒ Object
32 33 34 35 36 |
# File 'lib/changelog/config.rb', line 32 def format=(value) raise ArgumentError, "Invalid format: #{value}" unless Danger::Changelog::Parsers.valid?(value) @format = value end |
.ignore_files=(value) ⇒ Object
42 43 44 |
# File 'lib/changelog/config.rb', line 42 def ignore_files=(value) @ignore_files = Array(value) end |
.parser ⇒ Object
46 47 48 |
# File 'lib/changelog/config.rb', line 46 def parser Danger::Changelog::Parsers.lookup(format) end |
.placeholder_line=(value) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/changelog/config.rb', line 21 def placeholder_line=(value) if value new_value = value new_value = "* #{new_value}" unless new_value.start_with?('* ') new_value = "#{new_value}\n" unless new_value.end_with?("\n") @placeholder_line = new_value else @placeholder_line = nil end end |
.placeholder_line? ⇒ Boolean
38 39 40 |
# File 'lib/changelog/config.rb', line 38 def placeholder_line? !@placeholder_line.nil? end |
.reset ⇒ Object
50 51 52 53 54 55 |
# File 'lib/changelog/config.rb', line 50 def reset self.placeholder_line = "* Your contribution here.\n" self.filename = 'CHANGELOG.md' self.format = Danger::Changelog::Parsers.default_format self.ignore_files = ['README.md'] end |