fastlane-plugin-changelog 0.3.0 β 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -4
- data/lib/fastlane/plugin/changelog/actions/read_changelog.rb +9 -1
- data/lib/fastlane/plugin/changelog/actions/stamp_changelog.rb +22 -6
- data/lib/fastlane/plugin/changelog/actions/update_changelog.rb +1 -1
- data/lib/fastlane/plugin/changelog/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b3f23e18421455b7d1d85d01f42ad3417021681
|
4
|
+
data.tar.gz: ef0b316111c36cc87147d033378960f40282ee5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eec2930f9df64e9cc1dd80247568650d81185363922f4d48ad5dae45bfeeaef79434b3f01866ac55e77c4f9a269570fb90c45ce8ae1584e1e3d097bddcf8bb63
|
7
|
+
data.tar.gz: 287e063b596c7cc2b0a18e92397d770f92ac7fc4bdc4a0860be8f6b261e6e0ee49212418e9a55ff562eb0c7f1fb6db7a7a4ddf6fc1ed8a7884c77f3650374d99
|
data/README.md
CHANGED
@@ -22,10 +22,12 @@ Since [Keep a CHANGELOG](http://keepachangelog.com/) project proposes a well-def
|
|
22
22
|
3. open `CHANGELOG.md` in your favourite text editor
|
23
23
|
4. paste in proposed structure from [Whatβs a change log?](http://keepachangelog.com/)
|
24
24
|
|
25
|
+
π€ A feature request to automate this during installation has [been raised](https://github.com/fastlane/fastlane/issues/5736).
|
26
|
+
|
25
27
|
## Actions
|
26
28
|
`fastlane-plugin-changelog` consists of 3 actions enabling you to manipulate `CHANGELOG.md` from [`fastlane`](https://fastlane.tools).
|
27
29
|
|
28
|
-
### read_changelog
|
30
|
+
### π read_changelog
|
29
31
|
|
30
32
|
Reads the content of a section from your project's `CHANGELOG.md` file. `CHANGELOG.md` must follow structure proposed by [Keep a CHANGELOG](http://keepachangelog.com/) project.
|
31
33
|
|
@@ -43,7 +45,7 @@ read_changelog(
|
|
43
45
|
|
44
46
|
Use the output of this action in conjunction with for example [`pilot`](https://github.com/fastlane/fastlane/tree/master/pilot#uploading-builds) to upload your change log to TestFlight or with [`github_release`](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md#github-releases) to create a new release on Github.
|
45
47
|
|
46
|
-
### update_changelog
|
48
|
+
### π update_changelog
|
47
49
|
Updates section identifier of your project's `CHANGELOG.md` file.
|
48
50
|
``` ruby
|
49
51
|
update_changelog(
|
@@ -52,9 +54,9 @@ update_changelog(
|
|
52
54
|
)
|
53
55
|
```
|
54
56
|
|
55
|
-
### stamp_changelog
|
57
|
+
### π stamp_changelog
|
56
58
|
Stamps the _Unreleased_ (see [How can I minimize the effort required?](http://keepachangelog.com/)) section with provided identifier in your project `CHANGELOG.md` file and sets up a new _Unreleased_ section above it.
|
57
|
-
Additionally, you can provide git tag associated with this section. `stamp_changelog` will then create a link to diff between this and previous section's tag on Github. This will enable you to quickly get to [comparison between two tags](https://help.github.com/articles/comparing-commits-across-time/).
|
59
|
+
Additionally, you can provide an optional `git_tag` param, specifing git tag associated with this section. `stamp_changelog` will then create a link to diff between this and previous section's tag on Github. This will enable you to quickly get to [comparison between two tags](https://help.github.com/articles/comparing-commits-across-time/).
|
58
60
|
``` ruby
|
59
61
|
stamp_changelog(
|
60
62
|
section_identifier: "Build XYZ", # Specify identifier to stamp the Unreleased section with
|
@@ -47,7 +47,15 @@ module Fastlane
|
|
47
47
|
markdownless_line = line
|
48
48
|
excluded_markdown_elements.each do |element|
|
49
49
|
if line =~ /^#{element}/
|
50
|
-
|
50
|
+
indexOfElement = line.index(element)
|
51
|
+
indexOfWhitespace = indexOfElement + element.to_s.length
|
52
|
+
|
53
|
+
if line[indexOfWhitespace] == " " # remove white space (if any) following the markdown element
|
54
|
+
markdownless_line = markdownless_line.gsub(element.to_s + " ", "")
|
55
|
+
else
|
56
|
+
markdownless_line = markdownless_line.gsub(element.to_s, "")
|
57
|
+
end
|
58
|
+
|
51
59
|
end
|
52
60
|
end
|
53
61
|
|
@@ -1,16 +1,32 @@
|
|
1
1
|
module Fastlane
|
2
2
|
module Actions
|
3
3
|
class StampChangelogAction < Action
|
4
|
+
UNRELEASED_IDENTIFIER = '[Unreleased]'
|
5
|
+
|
4
6
|
def self.run(params)
|
7
|
+
# 1. Ensure CHANGELOG.md exists
|
5
8
|
changelog_path = params[:changelog_path] unless params[:changelog_path].to_s.empty?
|
6
9
|
UI.error("CHANGELOG.md at path '#{changelog_path}' does not exist") unless File.exist?(changelog_path)
|
7
10
|
|
8
|
-
#
|
9
|
-
|
11
|
+
# 2. Ensure there are changes in [Unreleased] section
|
12
|
+
unreleased_section_content = Actions::ReadChangelogAction.run(changelog_path: changelog_path, section_identifier: UNRELEASED_IDENTIFIER)
|
13
|
+
if unreleased_section_content.eql?("\n")
|
14
|
+
UI.important("WARNING: No changes in [Unreleased] section to stamp!")
|
15
|
+
else
|
16
|
+
section_identifier = params[:section_identifier] unless params[:section_identifier].to_s.empty?
|
17
|
+
stamp_date = params[:stamp_date]
|
18
|
+
git_tag = params[:git_tag]
|
19
|
+
|
20
|
+
stamp(changelog_path, section_identifier, stamp_date, git_tag)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.stamp(changelog_path, section_identifier, stamp_date, git_tag)
|
25
|
+
# 1. Update [Unreleased] section with given identifier
|
10
26
|
Actions::UpdateChangelogAction.run(changelog_path: changelog_path,
|
11
|
-
section_identifier:
|
27
|
+
section_identifier: UNRELEASED_IDENTIFIER,
|
12
28
|
updated_section_identifier: section_identifier,
|
13
|
-
append_date:
|
29
|
+
append_date: stamp_date)
|
14
30
|
|
15
31
|
file_content = ""
|
16
32
|
|
@@ -37,13 +53,13 @@ module Fastlane
|
|
37
53
|
end
|
38
54
|
|
39
55
|
# 3. Create link to Github tags diff
|
40
|
-
if
|
56
|
+
if !git_tag.nil? && !git_tag.empty?
|
41
57
|
last_line = file_content.lines.last
|
42
58
|
previous_section_name = last_line[/\[(.*?)\]/, 1]
|
43
59
|
previous_previous_tag = %r{(?<=compare\/)(.*)?(?=\.{3})}.match(last_line)
|
44
60
|
previous_tag = /(?<=\.{3})(.*)?/.match(last_line)
|
45
61
|
|
46
|
-
last_line.sub!(previous_tag.to_s,
|
62
|
+
last_line.sub!(previous_tag.to_s, git_tag) # Replace previous tag with new
|
47
63
|
last_line.sub!(previous_previous_tag.to_s, previous_tag.to_s) # Replace previous-previous tag with previous
|
48
64
|
last_line.sub!(previous_section_name.to_s, section_identifier) # Replace section identifier
|
49
65
|
|
@@ -92,7 +92,7 @@ module Fastlane
|
|
92
92
|
end),
|
93
93
|
FastlaneCore::ConfigItem.new(key: :updated_section_identifier,
|
94
94
|
env_name: "FL_UPDATE_CHANGELOG_UPDATED_SECTION_IDENTIFIER",
|
95
|
-
description: "The updated unique section identifier",
|
95
|
+
description: "The updated unique section identifier (without square brackets)",
|
96
96
|
is_string: true,
|
97
97
|
optional: true),
|
98
98
|
FastlaneCore::ConfigItem.new(key: :append_date,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-changelog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Prochazka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|