Class: Fastlane::Helper::UnreleasedChangelogHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/unreleased_changelog/helper/unreleased_changelog_helper.rb

Class Method Summary collapse

Class Method Details

.changelog_file_path(changelog_file_name) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/fastlane/plugin/unreleased_changelog/helper/unreleased_changelog_helper.rb', line 17

def self.changelog_file_path(changelog_file_name)
  # finding the git repo root path
  repo_path = Fastlane::Actions::sh("git rev-parse --show-toplevel").strip

  # finding the release-notes changelog file path
  changelog_file_paths = Dir[File.expand_path(File.join(repo_path, "**/#{changelog_file_name}"))]

  # no changelog found: error
  if changelog_file_paths.count == 0
    UI.user_error!("Could not find a #{changelog_file_name} 🛑")
  end

  # too many changelog found: error
  if changelog_file_paths.count > 1
    UI.message("Found #{changelog_file_name} files at path: #{changelog_file_paths} 🙈")
    UI.user_error!("Found multiple #{changelog_file_name} 🛑")
  end

  UI.success("Found #{changelog_file_name} file at path: #{changelog_file_paths.first} 💪🏻")

  return changelog_file_paths.first
end

.changelog_typesObject



13
14
15
# File 'lib/fastlane/plugin/unreleased_changelog/helper/unreleased_changelog_helper.rb', line 13

def self.changelog_types
  return ['Added', 'Changed', 'Deprecated', 'Removed', 'Fixed', 'Security']
end

.unreleased_section_nameObject



9
10
11
# File 'lib/fastlane/plugin/unreleased_changelog/helper/unreleased_changelog_helper.rb', line 9

def self.unreleased_section_name
  return 'Unreleased'
end