Class: StructuredChangelog

Inherits:
Object
  • Object
show all
Defined in:
lib/structured_changelog.rb,
lib/structured_changelog/release.rb,
lib/structured_changelog/roadmap.rb,
lib/structured_changelog/version.rb,
lib/structured_changelog/core_ext/gem.rb,
lib/structured_changelog/core_ext/string.rb,
lib/structured_changelog/release_filters.rb,
lib/structured_changelog/release_preview.rb,
lib/structured_changelog/version_pattern.rb,
lib/structured_changelog/release_filters/base.rb,
lib/structured_changelog/release_filters/matches_all_versions.rb,
lib/structured_changelog/release_filters/matches_single_version.rb,
lib/structured_changelog/release_filters/matches_current_version.rb,
lib/structured_changelog/release_filters/matches_versions_between.rb,
lib/structured_changelog/release_filters/matches_versions_less_than_or_equal_to.rb,
lib/structured_changelog/release_filters/matches_versions_greater_than_or_equal_to.rb

Defined Under Namespace

Modules: ReleaseFilters, StringInstanceMethods, VersionInstanceMethods Classes: IllegalQuery, Release, ReleasePreview, Roadmap

Constant Summary collapse

VERSION =
"0.11.2"
VersionPattern =
/(?<version>\d+\.\d+\.\d+[^\s\"\']*)/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ StructuredChangelog

Returns a new instance of StructuredChangelog.



10
11
12
13
14
15
16
17
# File 'lib/structured_changelog.rb', line 10

def initialize(path)
  @path = Pathname.new(path)

  @releases = Set.new([])
  @roadmaps = Set.new([])

  parse
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



8
9
10
# File 'lib/structured_changelog.rb', line 8

def path
  @path
end

#releasesObject (readonly)

Returns the value of attribute releases.



8
9
10
# File 'lib/structured_changelog.rb', line 8

def releases
  @releases
end

#roadmapsObject (readonly)

Returns the value of attribute roadmaps.



8
9
10
# File 'lib/structured_changelog.rb', line 8

def roadmaps
  @roadmaps
end

Instance Method Details

#find_releases(query) ⇒ Object



37
38
39
40
41
# File 'lib/structured_changelog.rb', line 37

def find_releases(query)
  ReleaseFilters
    .filter_for(query)
    .filter_releases(releases)
end

#validateObject



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/structured_changelog.rb', line 23

def validate
  notifications = []

  if latest_release.nil?
    notifications << "No RELEASE blocks"
  else
    notifications += latest_release.validate
  end

  notifications.each(&method(:puts))

  notifications.empty?
end

#versionObject



19
20
21
# File 'lib/structured_changelog.rb', line 19

def version
  latest_release.version
end