fastlane-plugin-write_changelog_from_commits 0.1.0 → 3.0.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: 5707d97c28c877e78013eb1b8e5bf6757e064f6bf5d77e326a8abb1f052ed4a6
4
+ data.tar.gz: 24ca778219cfd443a9ae03fcfd28fd82e62f97787899c2a1ad453121635b5691
5
5
  SHA512:
6
- metadata.gz: 76e90f86ac0dc15d1097fec33486994fde5aa3fcae55dc4d8a331fb638ede1059d984ec7b703b0919c697699fc094456465cf636beb19320e50fcf54611d6c52
7
- data.tar.gz: 032fd1577b7ee7b1872f264a484e323b6d5a1efe7d810faa644266b2dfcec42fb9d18d0492acc128759d1cc75ccd98a46b15bffa77bfc1da060db05893784b51
6
+ metadata.gz: 10517b260337dc51802a33db747bcd9edcceecf79528b049ef6ec96843ade82c2e12c92690739b17cd4d1cb0cdc9c4054f89950f00c51605e2feeec2df6663d1
7
+ data.tar.gz: 243b911308f277f9292ee14ed08d3728aee6b160768f2370d4c55ee7e1d6ea33135824860a131bb4f5ead13d3ac156e3a23913924470d10a2ca678a04a97ef62
@@ -1,19 +1,21 @@
1
- require 'fastlane/action'
2
- require_relative '../helper/write_changelog_from_commits_helper'
1
+ require "fastlane/action"
2
+ require_relative "../helper/write_changelog_from_commits_helper"
3
3
 
4
4
  module Fastlane
5
5
  module Actions
6
6
  class WriteChangelogFromCommitsAction < Action
7
- OTHER_SECTION = "Other"
8
-
9
7
  def self.run(params)
8
+ if params[:additional_section_name].nil? && params[:commit_prefixes].nil?
9
+ raise "Please provide either 'additional_section_name' or 'commit_prefixes' to action"
10
+ end
11
+
10
12
  from = Actions.last_git_tag_name
11
13
  UI.verbose("Found the last Git tag: #{from}")
12
- to = 'HEAD'
14
+ to = "HEAD"
13
15
 
14
16
  if params[:path].nil?
15
17
  UI.message("No path provided, using default at '/'")
16
- params[:path] = './' unless params[:path]
18
+ params[:path] = "./" unless params[:path]
17
19
  end
18
20
 
19
21
  params[:commit_prefixes] ||= []
@@ -23,7 +25,7 @@ module Fastlane
23
25
  changelog = changelog.gsub("\n\n", "\n") if changelog # as there are duplicate newlines
24
26
  raise "No logs found since last tag" if changelog.strip.empty?
25
27
 
26
- raw_release_notes = create_raw_release_notes(changelog, params[:commit_prefixes])
28
+ raw_release_notes = create_raw_release_notes(changelog, params[:commit_prefixes], params[:additional_section_name])
27
29
 
28
30
  release_notes = create_release_notes(raw_release_notes)
29
31
  Actions.lane_context[SharedValues::FL_CHANGELOG] = release_notes
@@ -32,7 +34,7 @@ module Fastlane
32
34
  end
33
35
 
34
36
  if params[:version_code]
35
- write_release_notes(release_notes, params[:version_code], params[:changelog_dir])
37
+ write_release_notes(release_notes, params[:version_code], params[:changelog_dir]) unless params[:read_only]
36
38
  else
37
39
  UI.message("No version code provided, so could not write file")
38
40
  end
@@ -40,19 +42,21 @@ module Fastlane
40
42
  end
41
43
  end
42
44
 
43
- def self.create_raw_release_notes(changelog, commit_prefixes)
45
+ def self.create_raw_release_notes(changelog, commit_prefixes, additional_section_name)
44
46
  raw_release_notes = commit_prefixes.to_h { |p| [p.capitalize, []] }
45
- raw_release_notes[OTHER_SECTION] = []
47
+ raw_release_notes[additional_section_name.capitalize] = [] if additional_section_name
46
48
  changelog.each_line do |line|
47
49
  section_exists = false
48
50
  commit_prefixes.each do |prefix|
49
51
  next unless line.downcase.start_with?(prefix.downcase)
50
52
 
51
- raw_release_notes[prefix.capitalize] << line.slice(prefix.length..line.length).strip
53
+ raw_release_notes[prefix.capitalize] << line.slice(prefix.length..line.length).strip.capitalize
52
54
  section_exists = true
53
55
  break
54
56
  end
55
- raw_release_notes[OTHER_SECTION] << line.strip unless section_exists
57
+ if additional_section_name && !section_exists
58
+ raw_release_notes[additional_section_name.capitalize] << line.strip.capitalize
59
+ end
56
60
  end
57
61
  raw_release_notes
58
62
  end
@@ -95,38 +99,52 @@ module Fastlane
95
99
  [
96
100
  FastlaneCore::ConfigItem.new(
97
101
  key: :path,
98
- env_name: 'write_changelog_from_commits_PATH',
99
- description: 'Path of the git repository',
102
+ env_name: "WRITE_CHANGELOG_FROM_COMMITS_PATH",
103
+ description: "Path of the git repository",
100
104
  optional: true,
101
- default_value: './'
105
+ default_value: "./",
102
106
  ),
103
107
  FastlaneCore::ConfigItem.new(
104
108
  key: :quiet,
105
- env_name: 'write_changelog_from_commits_TAG_QUIET',
106
- description: 'Whether or not to disable changelog output',
109
+ env_name: "WRITE_CHANGELOG_FROM_COMMITS_TAG_QUIET",
110
+ description: "Whether or not to disable changelog output",
107
111
  optional: true,
108
112
  default_value: false,
109
- is_string: false
113
+ is_string: false,
110
114
  ),
111
115
  FastlaneCore::ConfigItem.new(
112
116
  key: :changelog_dir,
113
- env_name: 'write_changelog_from_commits_CHANGELOG_DIR',
114
- description: 'Path to write new changelogs',
115
- optional: false
117
+ env_name: "WRITE_CHANGELOG_FROM_COMMITS_CHANGELOG_DIR",
118
+ description: "Path to write new changelogs",
119
+ optional: false,
116
120
  ),
117
121
  FastlaneCore::ConfigItem.new(
118
122
  key: :commit_prefixes,
119
- env_name: "write_changelog_from_commits_PREFIXES",
120
- description: "List of prefixes to group in the changelog",
123
+ env_name: "WRITE_CHANGELOG_FROM_COMMITS_PREFIXES",
124
+ description: "List of prefixes to group in the changelog (omit to place all lines under additional_section_name)",
121
125
  type: Array,
122
- optional: true
126
+ optional: true,
127
+ ),
128
+ FastlaneCore::ConfigItem.new(
129
+ key: :additional_section_name,
130
+ env_name: "WRITE_CHANGELOG_FROM_COMMITS_ADDITIONAL_SECTION",
131
+ description: "Section to contain all other commit lines (omit if you only want to log lines beginning with prefixes)",
132
+ optional: true,
123
133
  ),
124
134
  FastlaneCore::ConfigItem.new(
125
135
  key: :version_code,
126
- env_name: "write_changelog_from_commits_VERSION_CODE",
136
+ env_name: "WRITE_CHANGELOG_FROM_COMMITS_VERSION_CODE",
127
137
  description: "Version code used to create file",
128
- optional: true
129
- )
138
+ optional: true,
139
+ ),
140
+ FastlaneCore::ConfigItem.new(
141
+ key: :read_only,
142
+ env_name: "WRITE_CHANGELOG_FROM_COMMITS_READ_ONLY",
143
+ description: "If true will simply return the changelog rather than writing it",
144
+ optional: true,
145
+ default_value: false,
146
+ is_string: false,
147
+ ),
130
148
  ]
131
149
  end
132
150
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module WriteChangelogFromCommits
3
- VERSION = "0.1.0"
3
+ VERSION = "3.0.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lewis Bright
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-25 00:00:00.000000000 Z
11
+ date: 2021-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: rubocop
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 0.49.1
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 0.49.1
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rubocop-require_tools
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,34 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
111
139
  - !ruby/object:Gem::Dependency
112
140
  name: simplecov
113
141
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +156,14 @@ dependencies:
128
156
  requirements:
129
157
  - - ">="
130
158
  - !ruby/object:Gem::Version
131
- version: 2.168.0
159
+ version: '0'
132
160
  type: :development
133
161
  prerelease: false
134
162
  version_requirements: !ruby/object:Gem::Requirement
135
163
  requirements:
136
164
  - - ">="
137
165
  - !ruby/object:Gem::Version
138
- version: 2.168.0
166
+ version: '0'
139
167
  description:
140
168
  email: lewis_bright@yahoo.com
141
169
  executables: []