Class: Semmy::Tasks::ChangelogSections

Inherits:
Base
  • Object
show all
Defined in:
lib/semmy/tasks/changelog_sections.rb

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Semmy::Tasks::Base

Instance Method Details

#defineObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/semmy/tasks/changelog_sections.rb', line 4

def define
  namespace 'changelog' do
    task 'close_section' do
      new_version = Project.version
      old_version = VersionString.previous_minor(new_version)
      homepage = Gemspec.homepage

      Shell.info("Inserting #{new_version} section " \
                 "in #{config.changelog_path}.")

      Files.rewrite(config.changelog_path,
                    Changelog::CloseSection.new(config,
                                                new_version: new_version,
                                                old_version: old_version,
                                                homepage: homepage,
                                                date: Date.today))
    end

    task 'add_unreleased_section' do
      Shell.info('Inserting unreleased section ' \
                 "in #{config.changelog_path}.")

      Files.rewrite(config.changelog_path,
                    Changelog::InsertUnreleasedSection.new(config,
                                                           homepage: Gemspec.homepage))
    end
  end
end