fastlane-plugin-write_changelog_from_commits 0.1.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73e69f7387e4b8d41ea6eb23607fd00bef32236c59d7953124357ccaa97f0424
4
- data.tar.gz: abe9aa127f6cc3db8c92133a928157fae94c0fb3fa1f986dc8d487da50f4369e
3
+ metadata.gz: 611dd8a25518c6b4f3dc41d3e04283d31be81160d5a947b75c36e6c334eb08de
4
+ data.tar.gz: bc68014ed00794e028b9d03f2459816397c26642c187461932f6e65495ff4683
5
5
  SHA512:
6
- metadata.gz: 76e90f86ac0dc15d1097fec33486994fde5aa3fcae55dc4d8a331fb638ede1059d984ec7b703b0919c697699fc094456465cf636beb19320e50fcf54611d6c52
7
- data.tar.gz: 032fd1577b7ee7b1872f264a484e323b6d5a1efe7d810faa644266b2dfcec42fb9d18d0492acc128759d1cc75ccd98a46b15bffa77bfc1da060db05893784b51
6
+ metadata.gz: 2d45038790cfead4ee75949da6667beabd4b4dfa6acb413978ab2799f521d1b784f1486690b55cf28eda454033da1b9a61f472353a87b2cc52b4099dbb04107e
7
+ data.tar.gz: 0d5378f8073266c983bd3d920894c853548506fd5d713209e965c61534545fa9dd55b34ad04942298eb612173fbca435566e26bd808500f88b6b0e4732139dd0
@@ -4,9 +4,12 @@ require_relative '../helper/write_changelog_from_commits_helper'
4
4
  module Fastlane
5
5
  module Actions
6
6
  class WriteChangelogFromCommitsAction < Action
7
- OTHER_SECTION = "Other"
8
7
 
9
8
  def self.run(params)
9
+ if params[:additional_section_name].nil? && params[:commit_prefixes].nil?
10
+ raise "Please provide either 'additional_section_name' or 'commit_prefixes' to action"
11
+ end
12
+
10
13
  from = Actions.last_git_tag_name
11
14
  UI.verbose("Found the last Git tag: #{from}")
12
15
  to = 'HEAD'
@@ -23,7 +26,7 @@ module Fastlane
23
26
  changelog = changelog.gsub("\n\n", "\n") if changelog # as there are duplicate newlines
24
27
  raise "No logs found since last tag" if changelog.strip.empty?
25
28
 
26
- raw_release_notes = create_raw_release_notes(changelog, params[:commit_prefixes])
29
+ raw_release_notes = create_raw_release_notes(changelog, params[:commit_prefixes], params[:additional_section_name])
27
30
 
28
31
  release_notes = create_release_notes(raw_release_notes)
29
32
  Actions.lane_context[SharedValues::FL_CHANGELOG] = release_notes
@@ -40,19 +43,21 @@ module Fastlane
40
43
  end
41
44
  end
42
45
 
43
- def self.create_raw_release_notes(changelog, commit_prefixes)
46
+ def self.create_raw_release_notes(changelog, commit_prefixes, additional_section_name)
44
47
  raw_release_notes = commit_prefixes.to_h { |p| [p.capitalize, []] }
45
- raw_release_notes[OTHER_SECTION] = []
48
+ raw_release_notes[additional_section_name.capitalize] = [] if additional_section_name
46
49
  changelog.each_line do |line|
47
50
  section_exists = false
48
51
  commit_prefixes.each do |prefix|
49
52
  next unless line.downcase.start_with?(prefix.downcase)
50
53
 
51
- raw_release_notes[prefix.capitalize] << line.slice(prefix.length..line.length).strip
54
+ raw_release_notes[prefix.capitalize] << line.slice(prefix.length..line.length).strip.capitalize
52
55
  section_exists = true
53
56
  break
54
57
  end
55
- raw_release_notes[OTHER_SECTION] << line.strip unless section_exists
58
+ if additional_section_name && !section_exists
59
+ raw_release_notes[additional_section_name.capitalize] << line.strip.capitalize
60
+ end
56
61
  end
57
62
  raw_release_notes
58
63
  end
@@ -95,14 +100,14 @@ module Fastlane
95
100
  [
96
101
  FastlaneCore::ConfigItem.new(
97
102
  key: :path,
98
- env_name: 'write_changelog_from_commits_PATH',
103
+ env_name: 'WRITE_CHANGELOG_FROM_COMMITS_PATH',
99
104
  description: 'Path of the git repository',
100
105
  optional: true,
101
106
  default_value: './'
102
107
  ),
103
108
  FastlaneCore::ConfigItem.new(
104
109
  key: :quiet,
105
- env_name: 'write_changelog_from_commits_TAG_QUIET',
110
+ env_name: 'WRITE_CHANGELOG_FROM_COMMITS_TAG_QUIET',
106
111
  description: 'Whether or not to disable changelog output',
107
112
  optional: true,
108
113
  default_value: false,
@@ -110,20 +115,26 @@ module Fastlane
110
115
  ),
111
116
  FastlaneCore::ConfigItem.new(
112
117
  key: :changelog_dir,
113
- env_name: 'write_changelog_from_commits_CHANGELOG_DIR',
118
+ env_name: 'WRITE_CHANGELOG_FROM_COMMITS_CHANGELOG_DIR',
114
119
  description: 'Path to write new changelogs',
115
120
  optional: false
116
121
  ),
117
122
  FastlaneCore::ConfigItem.new(
118
123
  key: :commit_prefixes,
119
- env_name: "write_changelog_from_commits_PREFIXES",
120
- description: "List of prefixes to group in the changelog",
124
+ env_name: "WRITE_CHANGELOG_FROM_COMMITS_PREFIXES",
125
+ description: "List of prefixes to group in the changelog (omit to place all lines under additional_section_name)",
121
126
  type: Array,
122
127
  optional: true
123
128
  ),
129
+ FastlaneCore::ConfigItem.new(
130
+ key: :additional_section_name,
131
+ env_name: "WRITE_CHANGELOG_FROM_COMMITS_ADDITIONAL_SECTION",
132
+ description: "Section to contain all other commit lines (omit if you only want to log lines beginning with prefixes)",
133
+ optional: true
134
+ ),
124
135
  FastlaneCore::ConfigItem.new(
125
136
  key: :version_code,
126
- env_name: "write_changelog_from_commits_VERSION_CODE",
137
+ env_name: "WRITE_CHANGELOG_FROM_COMMITS_VERSION_CODE",
127
138
  description: "Version code used to create file",
128
139
  optional: true
129
140
  )
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module WriteChangelogFromCommits
3
- VERSION = "0.1.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-write_changelog_from_commits
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lewis Bright