Class: Changi::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/changi/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#changelog_pathObject

Returns the value of attribute changelog_path.



3
4
5
# File 'lib/changi/configuration.rb', line 3

def changelog_path
  @changelog_path
end

#changelog_templateObject

Returns the value of attribute changelog_template.



7
8
9
# File 'lib/changi/configuration.rb', line 7

def changelog_template
  @changelog_template
end

#default_categoriesObject

Returns the value of attribute default_categories.



5
6
7
# File 'lib/changi/configuration.rb', line 5

def default_categories
  @default_categories
end

#entries_pathObject

Returns the value of attribute entries_path.



4
5
6
# File 'lib/changi/configuration.rb', line 4

def entries_path
  @entries_path
end

#updaterObject

Returns the value of attribute updater.



6
7
8
# File 'lib/changi/configuration.rb', line 6

def updater
  @updater
end

Class Method Details

.defaultObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/changi/configuration.rb', line 9

def self.default
  new.tap do |config|
    config.changelog_path     = File.join Dir.pwd, 'changelog.md'
    config.entries_path       = File.join Dir.pwd, 'changelog'
    config.default_categories = []
    config.updater            = Updater::PrependUpdater
    config.changelog_template = <<-eod
# <%= release.version %>, <%= Time.now.strftime('%Y-%m-%d') %><%= release.notes and ", \#{release.notes}" %>
<% entry_set.entries.group_by(&:category).each do |category, entries| %>
## <%= category %>

<%=
  entries.map do |e|
if e.text.is_a?(Array)
  e.text.map.with_index { |l, i| i == 0 ? "* \#{l}" : "  \#{l}" }.join("\n")
else
  "* \#{e.text.gsub("\n", ' ')}"
end
  end.join("\n")
%>
<% end %>
eod
  end
end