fastlane-plugin-changelog 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -13
- data/lib/fastlane/plugin/changelog/actions/read_changelog.rb +9 -11
- data/lib/fastlane/plugin/changelog/actions/stamp_changelog.rb +2 -2
- data/lib/fastlane/plugin/changelog/actions/update_changelog.rb +3 -6
- data/lib/fastlane/plugin/changelog/version.rb +1 -1
- data/lib/fastlane/plugin/changelog.rb +48 -0
- 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: 8942aab0857114d3400eaa42bebba390d2a231c0
|
4
|
+
data.tar.gz: 4d46daef140989c1159640ec6a6a25eb1b7b6b85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfa381bc7b38b0b71e8179be0ae1a4123e7b9f552cb752b3b207e176d5a367cc622166bcf7c480b2bac5ef26a1d8999335341164849b31240b62fd74014da364
|
7
|
+
data.tar.gz: aa4431cabe2585de78c49a5164529780791cd25377e726b0003b386e07b890b8379d9178aa4a6eb7f0890b08eada155aa1dfe00931dc03993ba57c28dba49921
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# changelog plugin
|
2
2
|
|
3
|
-
[](https://rubygems.org/gems/fastlane-plugin-changelog)
|
3
|
+
[](https://rubygems.org/gems/fastlane-plugin-changelog)[](https://travis-ci.org/pajapro/fastlane-plugin-changelog) [](https://twitter.com/hello_paja)
|
4
4
|
|
5
5
|
## Getting Started
|
6
6
|
|
@@ -16,14 +16,6 @@ This plugin is inspired by and based on [Keep a CHANGELOG](http://keepachangelog
|
|
16
16
|
|
17
17
|
Since [Keep a CHANGELOG](http://keepachangelog.com/) project proposes a well-defined structure with _sections_ (e.g.: `[Unreleased]`, `0.3.0]`) and _subsections_ (`Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, `Security`) it opens up an opportunity to automate reading from/writing to `CHANGELOG.md` with [`fastlane`](https://fastlane.tools).
|
18
18
|
|
19
|
-
## Getting started
|
20
|
-
1. `cd` to your project folder
|
21
|
-
2. `touch CHANGELOG.md`
|
22
|
-
3. open `CHANGELOG.md` in your favourite text editor
|
23
|
-
4. paste in proposed structure from [What’s a change log?](http://keepachangelog.com/)
|
24
|
-
|
25
|
-
🤖 A feature request to automate this during installation has [been raised](https://github.com/fastlane/fastlane/issues/5736).
|
26
|
-
|
27
19
|
## Actions
|
28
20
|
`fastlane-plugin-changelog` consists of 3 actions enabling you to manipulate `CHANGELOG.md` from [`fastlane`](https://fastlane.tools).
|
29
21
|
|
@@ -49,8 +41,8 @@ read_changelog(
|
|
49
41
|
Updates section identifier of your project's `CHANGELOG.md` file.
|
50
42
|
``` ruby
|
51
43
|
update_changelog(
|
52
|
-
section_identifier:
|
53
|
-
updated_section_identifier:
|
44
|
+
section_identifier: '[Build 123]', # Specify what section to update
|
45
|
+
updated_section_identifier: 'Build 321' # Specify new section identifier
|
54
46
|
)
|
55
47
|
```
|
56
48
|
|
@@ -59,8 +51,8 @@ Stamps the _Unreleased_ (see [How can I minimize the effort required?](http://ke
|
|
59
51
|
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/).
|
60
52
|
``` ruby
|
61
53
|
stamp_changelog(
|
62
|
-
section_identifier:
|
63
|
-
git_tag:
|
54
|
+
section_identifier: 'Build XYZ', # Specify identifier to stamp the Unreleased section with
|
55
|
+
git_tag: 'bXYZ' # Specify reference to git tag associated with this section
|
64
56
|
)
|
65
57
|
```
|
66
58
|
|
@@ -8,7 +8,7 @@ module Fastlane
|
|
8
8
|
def self.run(params)
|
9
9
|
changelog_path = params[:changelog_path] unless params[:changelog_path].to_s.empty?
|
10
10
|
UI.error("CHANGELOG.md at path '#{changelog_path}' does not exist") unless File.exist?(changelog_path)
|
11
|
-
|
11
|
+
|
12
12
|
section_identifier = params[:section_identifier] unless params[:section_identifier].to_s.empty?
|
13
13
|
escaped_section_identifier = section_identifier[/\[(.*?)\]/, 1]
|
14
14
|
|
@@ -46,16 +46,14 @@ module Fastlane
|
|
46
46
|
def self.remove_markdown(line, excluded_markdown_elements)
|
47
47
|
markdownless_line = line
|
48
48
|
excluded_markdown_elements.each do |element|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
58
|
-
|
49
|
+
next unless line =~ /^#{element}/
|
50
|
+
index_of_element = line.index(element)
|
51
|
+
index_of_whitespace = index_of_element + element.to_s.length
|
52
|
+
|
53
|
+
if line[index_of_whitespace] == " " # 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, "")
|
59
57
|
end
|
60
58
|
end
|
61
59
|
|
@@ -12,11 +12,11 @@ module Fastlane
|
|
12
12
|
unreleased_section_content = Actions::ReadChangelogAction.run(changelog_path: changelog_path, section_identifier: UNRELEASED_IDENTIFIER)
|
13
13
|
if unreleased_section_content.eql?("\n")
|
14
14
|
UI.important("WARNING: No changes in [Unreleased] section to stamp!")
|
15
|
-
else
|
15
|
+
else
|
16
16
|
section_identifier = params[:section_identifier] unless params[:section_identifier].to_s.empty?
|
17
17
|
stamp_date = params[:stamp_date]
|
18
18
|
git_tag = params[:git_tag]
|
19
|
-
|
19
|
+
|
20
20
|
stamp(changelog_path, section_identifier, stamp_date, git_tag)
|
21
21
|
end
|
22
22
|
end
|
@@ -4,13 +4,12 @@ module Fastlane
|
|
4
4
|
def self.run(params)
|
5
5
|
changelog_path = params[:changelog_path] unless params[:changelog_path].to_s.empty?
|
6
6
|
UI.error("CHANGELOG.md at path '#{changelog_path}' does not exist") unless File.exist?(changelog_path)
|
7
|
-
|
7
|
+
|
8
8
|
section_identifier = params[:section_identifier] unless params[:section_identifier].to_s.empty?
|
9
9
|
escaped_section_identifier = section_identifier[/\[(.*?)\]/, 1]
|
10
10
|
|
11
11
|
new_section_identifier = params[:updated_section_identifier] unless params[:updated_section_identifier].to_s.empty?
|
12
|
-
|
13
|
-
|
12
|
+
|
14
13
|
UI.message "Starting to update #{section_identifier} section of '#{changelog_path}'"
|
15
14
|
|
16
15
|
# Read & update file content
|
@@ -32,12 +31,10 @@ module Fastlane
|
|
32
31
|
if params[:append_date]
|
33
32
|
now = Time.now.strftime("%Y-%m-%d")
|
34
33
|
line.concat(" - " + now)
|
35
|
-
line.delete!("\n")
|
34
|
+
line.delete!("\n") # remove line break, because concatenation adds line break between section identifer & date
|
36
35
|
line.concat("\n") # add line break to the end of the string, in order to start next line on the next line
|
37
36
|
end
|
38
37
|
|
39
|
-
found_identifying_section = false
|
40
|
-
|
41
38
|
UI.message "Old section identifier: #{line_old.delete!("\n")}"
|
42
39
|
UI.message "New section identifier: #{line.delete("\n")}"
|
43
40
|
|
@@ -2,10 +2,55 @@ require 'fastlane/plugin/changelog/version'
|
|
2
2
|
|
3
3
|
module Fastlane
|
4
4
|
module Changelog
|
5
|
+
CHANGELOG_PATH = './CHANGELOG.md'
|
6
|
+
DEFAULT_CHANGELOG = '# Change Log
|
7
|
+
All notable changes to this project will be documented in this file.
|
8
|
+
|
9
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
10
|
+
and this project adheres to [Semantic Versioning](http://semver.org/).
|
11
|
+
|
12
|
+
## [Unreleased]
|
13
|
+
### Added
|
14
|
+
- Your awesome new feature'
|
15
|
+
|
5
16
|
# Return all .rb files inside the "actions" and "helper" directory
|
6
17
|
def self.all_classes
|
7
18
|
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
|
8
19
|
end
|
20
|
+
|
21
|
+
# Offer user to setup CHANGELOG.md file in project folder (unless it already exists)
|
22
|
+
def self.setup_changelog
|
23
|
+
unless has_changelog?
|
24
|
+
if FastlaneCore::UI.confirm('Your project folder does not have CHANGELOG.md - do you want to create one now?')
|
25
|
+
create_changelog
|
26
|
+
|
27
|
+
FastlaneCore::UI.message('Changelog plugin can automaticaly create a link for comparison between two tags (see https://github.com/pajapro/fastlane-plugin-changelog#--stamp_changelog)')
|
28
|
+
if FastlaneCore::UI.confirm('Do you want to create links for comparing tags on Github?')
|
29
|
+
github_url = FastlaneCore::UI.input('Enter your Github URL (e.g.: https://github.com/fastlane/fastlane):')
|
30
|
+
output = DEFAULT_CHANGELOG + "\n\n[Unreleased]: #{github_url}/compare/master...HEAD"
|
31
|
+
write_to_changelog(output)
|
32
|
+
else
|
33
|
+
write_to_changelog(DEFAULT_CHANGELOG)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Does CHANGELOG.md exists in project folder?
|
40
|
+
def self.has_changelog?
|
41
|
+
File.exist?(CHANGELOG_PATH)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Create CHANGELOG.md file
|
45
|
+
def self.create_changelog
|
46
|
+
FileUtils.touch 'CHANGELOG.md'
|
47
|
+
end
|
48
|
+
|
49
|
+
# Write given content to CHANGELOG.md
|
50
|
+
def self.write_to_changelog(changelog)
|
51
|
+
File.open(CHANGELOG_PATH, 'w') { |f| f.write(changelog) }
|
52
|
+
FastlaneCore::UI.success('Successfuly created CHANGELOG.md')
|
53
|
+
end
|
9
54
|
end
|
10
55
|
end
|
11
56
|
|
@@ -14,3 +59,6 @@ end
|
|
14
59
|
Fastlane::Changelog.all_classes.each do |current|
|
15
60
|
require current
|
16
61
|
end
|
62
|
+
|
63
|
+
# By default we want to ensure CHANGELOG.md is present
|
64
|
+
Fastlane::Changelog.setup_changelog
|
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.5.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-
|
11
|
+
date: 2016-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|