fastlane-plugin-changelog 0.8.0 → 0.9.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: 9156865d370699bcd9e4ee56e6c2c919c7ab61f1
4
- data.tar.gz: 3d25f7e9595777e7808b855ed142b1d5a3914874
3
+ metadata.gz: 57b4471d6ae10ef7b6da62051f240fb79d9e427f
4
+ data.tar.gz: 2b694ab107d07ad643185320131bf20590b04707
5
5
  SHA512:
6
- metadata.gz: 26c8b5983a3354e62a3afad98c03b20bd6f8e1f1a08d1f1fa8a7f1bad4b7e487e24760932f9fdf60a3b01a565703a1bfb51d5e02036e6297a42f96ba423c5b00
7
- data.tar.gz: 55442dc03b622176772e3d6aba159cf1bc5154405132635d8d100501e11661d98e4d6688c65056f1884710c2c93e8d3944930d17019f73fa17257990e1a7de3c
6
+ metadata.gz: f00afaa4410d6b32a8ba12974983f7f5e3c7a53486d58f07a7f5a4bec44dbcddf9b6e055e96c8d2e5afd298d0f5624de02e156a07fa1da6b8bdfb74991d410d8
7
+ data.tar.gz: 01ef33dd468b606a62c224381fb68745fbea6743729fdb129fcc7eb9aaa4bb5e07696ce94684d75e721c81b97ea17065e104812ba47f79627792505af1bfdaf4
data/README.md CHANGED
@@ -56,6 +56,8 @@ stamp_changelog(
56
56
  )
57
57
  ```
58
58
 
59
+ 🤖 Moreover, if you are using [danger-changelog](https://github.com/dblock/danger-changelog) plugin, you can leverage `placeholder_line` string paramater. `placeholder_line` string will be ignored when stamping an existing section _and_ copied into `[Unreleased]` section. This will help contributors to your project to see where changelog changes should be added (see [feature request](https://github.com/pajapro/fastlane-plugin-changelog/issues/22)).
60
+
59
61
  ### 😁 emojify_changelog
60
62
  Emojifies the output of `read_changelog` action. When you share changelog with the rest of your team on e.g.: Slack channel, it's nice to sprinkle your subsections with a bit of visuals so it immediately catches eyes of your teammates. `emojify_changelog` uses the output of `read_changelog` action to append an emoji to known subsections, for example:
61
63
 
@@ -16,17 +16,19 @@ module Fastlane
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
+ placeholder_line = params[:placeholder_line]
19
20
 
20
- stamp(changelog_path, section_identifier, stamp_date, git_tag)
21
+ stamp(changelog_path, section_identifier, stamp_date, git_tag, placeholder_line)
21
22
  end
22
23
  end
23
24
 
24
- def self.stamp(changelog_path, section_identifier, stamp_date, git_tag)
25
+ def self.stamp(changelog_path, section_identifier, stamp_date, git_tag, placeholder_line)
25
26
  # 1. Update [Unreleased] section with given identifier
26
27
  Actions::UpdateChangelogAction.run(changelog_path: changelog_path,
27
28
  section_identifier: UNRELEASED_IDENTIFIER,
28
29
  updated_section_identifier: section_identifier,
29
- append_date: stamp_date)
30
+ append_date: stamp_date,
31
+ excluded_placeholder_line: placeholder_line)
30
32
 
31
33
  file_content = ""
32
34
 
@@ -37,7 +39,14 @@ module Fastlane
37
39
  # Find the first section identifier
38
40
  if !inserted_unreleased && line =~ /\#{2}\s?\[(.*?)\]/
39
41
  unreleased_section = "## [Unreleased]"
40
- line = "#{unreleased_section}\n\n#{line}"
42
+
43
+ # Insert placeholder line (if provided)
44
+ if !placeholder_line.nil? && !placeholder_line.empty?
45
+ line = "#{unreleased_section}\n#{placeholder_line}\n\n#{line}"
46
+ else
47
+ line = "#{unreleased_section}\n\n#{line}"
48
+ end
49
+
41
50
  inserted_unreleased = true
42
51
 
43
52
  UI.message("Created [Unreleased] placeholder section")
@@ -117,6 +126,11 @@ module Fastlane
117
126
  env_name: "FL_STAMP_CHANGELOG_GIT_TAG",
118
127
  description: "The git tag associated with this section",
119
128
  is_string: true,
129
+ optional: true),
130
+ FastlaneCore::ConfigItem.new(key: :placeholder_line,
131
+ env_name: "FL_STAMP_CHANGELOG_PLACEHOLDER_LINE",
132
+ description: "The placeholder line to be excluded in stamped section and added to [Unreleased] section",
133
+ is_string: true,
120
134
  optional: true)
121
135
  ]
122
136
  end
@@ -9,20 +9,40 @@ module Fastlane
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
+ excluded_placeholder_line = params[:excluded_placeholder_line] unless params[:excluded_placeholder_line].to_s.empty?
12
13
 
13
14
  UI.message "Starting to update #{section_identifier} section of '#{changelog_path}'"
14
15
 
15
16
  # Read & update file content
16
17
  file_content = ""
18
+ found_identifying_section = false
19
+
17
20
  File.open(changelog_path, "r") do |file|
18
21
  line_separator = Helper::ChangelogHelper.get_line_separator(changelog_path)
19
22
  file.each_line do |line|
20
- # Find line matching section identifier
23
+
24
+ # 3. Ignore placeholder line (if provided) within the updated section
25
+ if found_identifying_section && !excluded_placeholder_line.nil?
26
+ if isSectionLine(line)
27
+ found_identifying_section = false # Reached the end of section, hence stop reading
28
+ else
29
+ if line =~ /^#{excluded_placeholder_line}/
30
+ next # Ignore placeholder line, don't output it
31
+ else
32
+ file_content.concat(line) # Output unmodified line
33
+ next
34
+ end
35
+ end
36
+ end
37
+
38
+ # 1. Find line matching section identifier
21
39
  if line =~ /\#{2}\s?\[#{escaped_section_identifier}\]/
22
40
  found_identifying_section = true
41
+ else
42
+ found_identifying_section = false
23
43
  end
24
44
 
25
- # Update section identifier (if found)
45
+ # 2. Update section identifier (if found)
26
46
  if !new_section_identifier.empty? && found_identifying_section
27
47
  section_name = section_identifier[/\[(.*?)\]/, 1]
28
48
 
@@ -44,8 +64,6 @@ module Fastlane
44
64
  next
45
65
  end
46
66
 
47
- # TODO: implement updating of section content
48
-
49
67
  # Output read line
50
68
  file_content.concat(line)
51
69
  end
@@ -58,6 +76,10 @@ module Fastlane
58
76
  UI.success("Successfuly updated #{changelog_path}")
59
77
  end
60
78
 
79
+ def self.isSectionLine(line)
80
+ line =~ /\#{2}\s?\[.*\]/
81
+ end
82
+
61
83
  #####################################################
62
84
  # @!group Documentation
63
85
  #####################################################
@@ -97,6 +119,11 @@ module Fastlane
97
119
  env_name: "FL_UPDATE_CHANGELOG_APPEND_DATE",
98
120
  description: "Appends the current date in YYYY-MM-DD format after the section identifier",
99
121
  default_value: true,
122
+ optional: true),
123
+ FastlaneCore::ConfigItem.new(key: :excluded_placeholder_line,
124
+ env_name: "FL_UPDATE_CHANGELOG_EXCLUDED_PLACEHOLDER_LINE",
125
+ description: "Placeholder string to be ignored in updated section",
126
+ is_string: true,
100
127
  optional: true)
101
128
  # FastlaneCore::ConfigItem.new(key: :updated_section_content,
102
129
  # env_name: "FL_UPDATE_CHANGELOG_UPDATED_SECTION_CONTENT",
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Changelog
3
- VERSION = "0.8.0"
3
+ VERSION = "0.9.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.8.0
4
+ version: 0.9.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: 2017-11-11 00:00:00.000000000 Z
11
+ date: 2017-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler