fastlane-plugin-changelog 0.11.0 → 0.16.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
  SHA1:
3
- metadata.gz: ed97f77f8e92c6d2ebd8337d3ee0438043c701a3
4
- data.tar.gz: 6ef8f3f6ed9088f5226e0405a264f2e1acb7bcbc
3
+ metadata.gz: 88dc3f6cc69c73c660b54513b941382eda0f8866
4
+ data.tar.gz: bc40d6fe17cebb7a3ae63ffac3a2fe1f8a9a9a12
5
5
  SHA512:
6
- metadata.gz: 7db3e33068d51c4040fb524f324e1d8b17de94f31bf082ad3a306d83a3745f6a12526985eee2e6f3c311a61334b4e054b2678fe937c635678b275757fe3a1631
7
- data.tar.gz: 7cc5e73f9d940def85ab869404aa6bf706f64805a08cab80acb554cb3d4065c21d46673e684632bec4b527a77f8a3a498626dfd7922a69c141ac3627979eb684
6
+ metadata.gz: 691abf1f00864a292359498499cf6af7b1fb308373f268ba7ac440e04ef73016af2ccb575190fa5b7c294c549be53e4806790a97809778d233cd65814e166033
7
+ data.tar.gz: 5ee732505ba076fd8bff381ade7e0ff6041f78edad5cb9a2160aca477e1c2d241102b07029086e65c51fc611f09afdd5dc7e6ae35cede277195bca694583d745
data/README.md CHANGED
@@ -14,7 +14,7 @@ fastlane add_plugin changelog
14
14
 
15
15
  This plugin is inspired by and based on [Keep a CHANGELOG](http://keepachangelog.com/) project. [Keep a CHANGELOG](http://keepachangelog.com/) proposes a standardised format for keeping change log of your project repository in `CHANGELOG.md` file. This file contains a curated, chronologically ordered list of notable changes for each version of a project in human readable format.
16
16
 
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).
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
19
  ## Actions
20
20
  `fastlane-plugin-changelog` consists of 3 actions enabling you to manipulate `CHANGELOG.md` from [`fastlane`](https://fastlane.tools).
@@ -52,7 +52,8 @@ Additionally, you can provide an optional `git_tag` param, specifing git tag ass
52
52
  ``` ruby
53
53
  stamp_changelog(
54
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
55
+ git_tag: 'bXYZ', # Specify reference to git tag associated with this section
56
+ stamp_date: true # Specify whether current date should be appended to stamped section line (default is `true`)
56
57
  )
57
58
  ```
58
59
 
@@ -87,26 +88,26 @@ Deprecated:
87
88
  emojifies into:
88
89
 
89
90
  ```
90
- Added 🎁:
91
- - New awesome feature
91
+ *Added* 🎁:
92
+ New awesome feature
92
93
 
93
- Changed ↔️:
94
- - Onboarding flow UI
94
+ *Changed* ↔️:
95
+ Onboarding flow UI
95
96
 
96
- Fixed ✅:
97
- - Fix Markdown links
97
+ *Fixed* ✅:
98
+ Fix Markdown links
98
99
 
99
- Removed 🚫:
100
- - User tracking
100
+ *Removed* 🚫:
101
+ User tracking
101
102
 
102
- Work In Progress 🚧:
103
- - Sales screen
103
+ *Work In Progress* 🚧:
104
+ Sales screen
104
105
 
105
- Security 🔒:
106
- - Enable SSL pinning
106
+ *Security* 🔒:
107
+ Enable SSL pinning
107
108
 
108
- Deprecated 💨:
109
- - Obsolete contact screen
109
+ *Deprecated* 💨:
110
+ Obsolete contact screen
110
111
  ```
111
112
 
112
113
  Example of use:
@@ -28,14 +28,14 @@ module Fastlane
28
28
 
29
29
  if SUBSECTION_IDENTIFIERS.include?(stripped)
30
30
  emojified_string = case stripped
31
- when 'Added' then 'Added 🎁'
32
- when 'Changed' then 'Changed ↔️'
33
- when 'Fixed' then 'Fixed ✅'
34
- when 'Removed' then 'Removed 🚫'
35
- when 'Work In Progress' then 'Work In Progress 🚧'
36
- when 'Security' then 'Security 🔒'
37
- when 'Deprecated' then 'Deprecated 💨'
38
- end
31
+ when 'Added' then '*Added* 🎁'
32
+ when 'Changed' then '*Changed* ↔️'
33
+ when 'Fixed' then '*Fixed* ✅'
34
+ when 'Removed' then '*Removed* 🚫'
35
+ when 'Work In Progress' then '*Work In Progress* 🚧'
36
+ when 'Security' then '*Security* 🔒'
37
+ when 'Deprecated' then '*Deprecated* 💨'
38
+ end
39
39
 
40
40
  # Add back trailing colon, if previously removed
41
41
  if chopped_colon
@@ -49,11 +49,15 @@ module Fastlane
49
49
  emojified_content.concat(emojified_string)
50
50
  else
51
51
  # Output updated line
52
+ # Replace '-' with '*'
53
+ if line.start_with?('-')
54
+ line[0] = '•'
55
+ end
52
56
  emojified_content.concat(line)
53
57
  end
54
58
  end
55
59
 
56
- UI.success("Successfuly emojified output of read_changelog action")
60
+ UI.success("Successfully emojified output of read_changelog action")
57
61
 
58
62
  Actions.lane_context[SharedValues::EMOJIFY_CHANGELOG_CONTENT] = emojified_content
59
63
  end
@@ -74,6 +78,12 @@ module Fastlane
74
78
  []
75
79
  end
76
80
 
81
+ def self.output
82
+ [
83
+ ['EMOJIFY_CHANGELOG_CONTENT', 'Contains the emojified content of the last read_changelog action'],
84
+ ]
85
+ end
86
+
77
87
  def self.authors
78
88
  ["pajapro"]
79
89
  end
@@ -103,7 +103,8 @@ module Fastlane
103
103
 
104
104
  def self.output
105
105
  [
106
- ['READ_CHANGELOG_SECTION_CONTENT', 'Contains text from a section of your CHANGELOG.md file']
106
+ ['READ_CHANGELOG_SECTION_CONTENT', 'Contains text from a section of your CHANGELOG.md file'],
107
+ ['READ_CHANGELOG_CHANGELOG_PATH', 'Contains the path to the CHANGELOG.md file']
107
108
  ]
108
109
  end
109
110
 
@@ -14,20 +14,22 @@ module Fastlane
14
14
  UI.important("WARNING: No changes in [Unreleased] section to stamp!")
15
15
  else
16
16
  section_identifier = params[:section_identifier] unless params[:section_identifier].to_s.empty?
17
- stamp_date = params[:stamp_date]
17
+ should_stamp_date = params[:should_stamp_date]
18
+ stamp_datetime_format = params[:stamp_datetime_format]
18
19
  git_tag = params[:git_tag]
19
20
  placeholder_line = params[:placeholder_line]
20
21
 
21
- stamp(changelog_path, section_identifier, stamp_date, git_tag, placeholder_line)
22
+ stamp(changelog_path, section_identifier, should_stamp_date, stamp_datetime_format, git_tag, placeholder_line)
22
23
  end
23
24
  end
24
25
 
25
- def self.stamp(changelog_path, section_identifier, stamp_date, git_tag, placeholder_line)
26
+ def self.stamp(changelog_path, section_identifier, should_stamp_date, stamp_datetime_format, git_tag, placeholder_line)
26
27
  # 1. Update [Unreleased] section with given identifier
27
28
  Actions::UpdateChangelogAction.run(changelog_path: changelog_path,
28
29
  section_identifier: UNRELEASED_IDENTIFIER,
29
30
  updated_section_identifier: section_identifier,
30
- append_date: stamp_date,
31
+ should_append_date: should_stamp_date,
32
+ append_datetime_format: stamp_datetime_format,
31
33
  excluded_placeholder_line: placeholder_line)
32
34
 
33
35
  file_content = ""
@@ -64,27 +66,33 @@ module Fastlane
64
66
  # 3. Create link to git tags diff
65
67
  if !git_tag.nil? && !git_tag.empty?
66
68
  last_line = file_content.lines.last
67
- previous_tag = ""
68
- previous_previous_tag = ""
69
+ previous_tag = ''
70
+ previous_previous_tag = ''
71
+ reversed_tags = false
69
72
 
70
73
  if last_line.include? 'https://github.com' # GitHub uses compare/olderTag...newerTag structure
71
74
  previous_previous_tag = %r{(?<=compare\/)(.*)?(?=\.{3})}.match(last_line)
72
75
  previous_tag = /(?<=\.{3})(.*)?/.match(last_line)
73
76
  elsif last_line.include? 'https://bitbucket.org' # Bitbucket uses compare/newerTag..olderTag structure
77
+ reversed_tags = true
74
78
  previous_tag = %r{(?<=compare\/)(.*)?(?=\.{2})}.match(last_line)
75
79
  previous_previous_tag = /(?<=\.{2})(.*)?/.match(last_line)
76
80
  end
77
81
 
78
82
  # Replace section identifier
79
- cleared_git_tag = git_tag.delete('[a-z]')
80
- cleared_previous_git_tag = previous_tag.to_s.delete('[a-z]')
81
- last_line.sub!("[#{cleared_previous_git_tag}]", "[#{cleared_git_tag}]")
82
-
83
- # Replace previous-previous tag with previous
84
- last_line.sub!(previous_previous_tag.to_s, previous_tag.to_s)
85
-
86
- # Replace previous tag with new
87
- last_line.sub!("..#{previous_tag}", "..#{git_tag}")
83
+ previous_section_identifier = /(?<=\[)[^\]]+(?=\]:)/.match(last_line)
84
+ last_line.sub!("[#{previous_section_identifier}]:", "[#{section_identifier}]:")
85
+
86
+ # Replace first tag
87
+ last_line.sub!(
88
+ reversed_tags ? previous_tag.to_s : previous_previous_tag.to_s,
89
+ reversed_tags ? git_tag.to_s : previous_tag.to_s
90
+ )
91
+ # Replace second tag
92
+ last_line.sub!(
93
+ "..#{reversed_tags ? previous_previous_tag : previous_tag}",
94
+ "..#{reversed_tags ? previous_tag : git_tag}"
95
+ )
88
96
 
89
97
  UI.message("Created a link for comparison between #{previous_tag} and #{git_tag} tag")
90
98
 
@@ -95,7 +103,7 @@ module Fastlane
95
103
  changelog = File.open(changelog_path, "w")
96
104
  changelog.puts(file_content)
97
105
  changelog.close
98
- UI.success("Successfuly stamped #{section_identifier} in #{changelog_path}")
106
+ UI.success("Successfully stamped #{section_identifier} in #{changelog_path}")
99
107
  end
100
108
 
101
109
  #####################################################
@@ -123,10 +131,17 @@ module Fastlane
123
131
  env_name: "FL_STAMP_CHANGELOG_SECTION_IDENTIFIER",
124
132
  description: "The unique section identifier to stamp the [Unreleased] section with",
125
133
  is_string: true),
126
- FastlaneCore::ConfigItem.new(key: :stamp_date,
127
- env_name: "FL_STAMP_CHANGELOG_SECTION_STAMP_DATE",
128
- description: "Specifies whether the current date should be appended to section identifier",
134
+ FastlaneCore::ConfigItem.new(key: :should_stamp_date,
135
+ env_name: "FL_STAMP_CHANGELOG_SHOULD_STAMP_DATE",
136
+ description: "Specifies whether the current date as per the stamp_datetime_format should be stamped to the section identifier",
129
137
  default_value: true,
138
+ is_string: false,
139
+ optional: true),
140
+ FastlaneCore::ConfigItem.new(key: :stamp_datetime_format,
141
+ env_name: "FL_STAMP_CHANGELOG_DATETIME_FORMAT",
142
+ description: "The strftime format string to use for the date in the stamped section",
143
+ default_value: '%FZ',
144
+ is_string: true,
130
145
  optional: true),
131
146
  FastlaneCore::ConfigItem.new(key: :git_tag,
132
147
  env_name: "FL_STAMP_CHANGELOG_GIT_TAG",
@@ -48,8 +48,14 @@ module Fastlane
48
48
  line_old = line.dup
49
49
  line.sub!(section_name, new_section_identifier)
50
50
 
51
- if params[:append_date]
52
- now = Time.now.strftime("%Y-%m-%d")
51
+ should_append_date = params[:should_append_date]
52
+
53
+ if should_append_date
54
+ append_datetime_format = params[:append_datetime_format]
55
+
56
+ now = Time.now.utc.strftime(append_datetime_format)
57
+ ENV["FL_UPDATE_APPEND_DATETIME_VAL"] = now
58
+
53
59
  line.concat(" - " + now)
54
60
  line.delete!(line_separator) # remove line break, because concatenation adds line break between section identifer & date
55
61
  line.concat(line_separator) # add line break to the end of the string, in order to start next line on the next line
@@ -72,7 +78,7 @@ module Fastlane
72
78
  changelog = File.open(changelog_path, "w")
73
79
  changelog.puts(file_content)
74
80
  changelog.close
75
- UI.success("Successfuly updated #{changelog_path}")
81
+ UI.success("Successfully updated #{changelog_path}")
76
82
  end
77
83
 
78
84
  def self.is_section_line(line)
@@ -114,10 +120,17 @@ module Fastlane
114
120
  description: "The updated unique section identifier (without square brackets)",
115
121
  is_string: true,
116
122
  optional: true),
117
- FastlaneCore::ConfigItem.new(key: :append_date,
118
- env_name: "FL_UPDATE_CHANGELOG_APPEND_DATE",
119
- description: "Appends the current date in YYYY-MM-DD format after the section identifier",
123
+ FastlaneCore::ConfigItem.new(key: :should_append_date,
124
+ env_name: "FL_UPDATE_CHANGELOG_SHOULD_APPEND_DATE",
125
+ description: "Specifies whether the current date as per the append_datetime_format should be appended to section identifier",
120
126
  default_value: true,
127
+ is_string: false,
128
+ optional: true),
129
+ FastlaneCore::ConfigItem.new(key: :append_datetime_format,
130
+ env_name: "FL_UPDATE_CHANGELOG_APPEND_DATETIME_FORMAT",
131
+ description: "The strftime format string to use for the date after the section identifier",
132
+ default_value: '%FZ',
133
+ is_string: true,
121
134
  optional: true),
122
135
  FastlaneCore::ConfigItem.new(key: :excluded_placeholder_line,
123
136
  env_name: "FL_UPDATE_CHANGELOG_EXCLUDED_PLACEHOLDER_LINE",
@@ -65,7 +65,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
65
65
  # Writes given content to CHANGELOG.md in project root
66
66
  def self.write_to_changelog(changelog)
67
67
  File.open(CHANGELOG_PATH, 'w') { |f| f.write(changelog) }
68
- FastlaneCore::UI.success('Successfuly created CHANGELOG.md')
68
+ FastlaneCore::UI.success('Successfully created CHANGELOG.md')
69
69
  end
70
70
 
71
71
  def self.get_line_separator(file_path)
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Changelog
3
- VERSION = "0.11.0"
3
+ VERSION = "0.16.0"
4
4
  end
5
5
  end
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.11.0
4
+ version: 0.16.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: 2018-11-16 00:00:00.000000000 Z
11
+ date: 2021-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  version: '0'
130
130
  requirements: []
131
131
  rubyforge_project:
132
- rubygems_version: 2.5.1
132
+ rubygems_version: 2.6.13
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: Automate changes to your project CHANGELOG.md