fastlane-plugin-changelog 0.10.0 → 0.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 217045bc188429e310a1e0a6c5733c0ff8dcab0a
4
- data.tar.gz: b861687d566ac30feac7866f2b1273d09e6c891b
3
+ metadata.gz: ed97f77f8e92c6d2ebd8337d3ee0438043c701a3
4
+ data.tar.gz: 6ef8f3f6ed9088f5226e0405a264f2e1acb7bcbc
5
5
  SHA512:
6
- metadata.gz: 704b66ac13237ca0772114f88053978886e8e4960620bbf6b8e408efee3da2c58d836c63c01ba113d3403786f2420ba858b71f728b1024fbf6523e59d1d1fec6
7
- data.tar.gz: 8da58cd64910ec0d72bfdc15382469228088069c3cdc594290cc2253da89672e281581e281aa0d6a28062fceabd1b7a09e2321ab6545d9f879d104f9543f5a39
6
+ metadata.gz: 7db3e33068d51c4040fb524f324e1d8b17de94f31bf082ad3a306d83a3745f6a12526985eee2e6f3c311a61334b4e054b2678fe937c635678b275757fe3a1631
7
+ data.tar.gz: 7cc5e73f9d940def85ab869404aa6bf706f64805a08cab80acb554cb3d4065c21d46673e684632bec4b527a77f8a3a498626dfd7922a69c141ac3627979eb684
@@ -6,7 +6,6 @@ module Fastlane
6
6
  def self.all_classes
7
7
  Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
8
  end
9
-
10
9
  end
11
10
  end
12
11
 
@@ -43,10 +43,10 @@ module Fastlane
43
43
  # Insert placeholder line (if provided)
44
44
  if !placeholder_line.nil? && !placeholder_line.empty?
45
45
  line = "#{unreleased_section}\n#{placeholder_line}\n\n#{line}"
46
- else
46
+ else
47
47
  line = "#{unreleased_section}\n\n#{line}"
48
- end
49
-
48
+ end
49
+
50
50
  inserted_unreleased = true
51
51
 
52
52
  UI.message("Created [Unreleased] placeholder section")
@@ -61,10 +61,9 @@ module Fastlane
61
61
  end
62
62
  end
63
63
 
64
- # 3. Create link to Github tags diff
64
+ # 3. Create link to git tags diff
65
65
  if !git_tag.nil? && !git_tag.empty?
66
66
  last_line = file_content.lines.last
67
- previous_section_name = last_line[/\[(.*?)\]/, 1]
68
67
  previous_tag = ""
69
68
  previous_previous_tag = ""
70
69
 
@@ -76,9 +75,16 @@ module Fastlane
76
75
  previous_previous_tag = /(?<=\.{2})(.*)?/.match(last_line)
77
76
  end
78
77
 
79
- last_line.sub!(previous_tag.to_s, git_tag) # Replace previous tag with new
80
- last_line.sub!(previous_previous_tag.to_s, previous_tag.to_s) # Replace previous-previous tag with previous
81
- last_line.sub!(previous_section_name.to_s, section_identifier) # Replace section identifier
78
+ # 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}")
82
88
 
83
89
  UI.message("Created a link for comparison between #{previous_tag} and #{git_tag} tag")
84
90
 
@@ -20,15 +20,14 @@ module Fastlane
20
20
  File.open(changelog_path, "r") do |file|
21
21
  line_separator = Helper::ChangelogHelper.get_line_separator(changelog_path)
22
22
  file.each_line do |line|
23
-
24
23
  # 3. Ignore placeholder line (if provided) within the updated section
25
24
  if found_identifying_section && !excluded_placeholder_line.nil?
26
- if isSectionLine(line)
25
+ if is_section_line(line)
27
26
  found_identifying_section = false # Reached the end of section, hence stop reading
28
27
  else
29
28
  if line =~ /^#{excluded_placeholder_line}/
30
29
  next # Ignore placeholder line, don't output it
31
- else
30
+ else
32
31
  file_content.concat(line) # Output unmodified line
33
32
  next
34
33
  end
@@ -76,8 +75,8 @@ module Fastlane
76
75
  UI.success("Successfuly updated #{changelog_path}")
77
76
  end
78
77
 
79
- def self.isSectionLine(line)
80
- line =~ /\#{2}\s?\[.*\]/
78
+ def self.is_section_line(line)
79
+ line =~ /\#{2}\s?\[.*\]/
81
80
  end
82
81
 
83
82
  #####################################################
@@ -11,10 +11,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
11
11
  ### Added
12
12
  - Your awesome new feature'
13
13
 
14
- # TODO: ❗️ Add unit tests for methods in this class
14
+ # TODO: Add unit tests for methods in this class
15
15
  class ChangelogHelper
16
-
17
- # Ensures CHANGELOG.md exists at given path. If not, offers to create a default one.
16
+ # Ensures CHANGELOG.md exists at given path. If not, offers to create a default one.
18
17
  # Returns path to CHANGELOG.md to be used
19
18
  def self.ensure_changelog_exists(path)
20
19
  if File.exist?(path)
@@ -30,15 +29,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
30
29
  # Generates CHANGELOG.md in project root
31
30
  def self.generate_changelog
32
31
  if FastlaneCore::UI.confirm('Do you want to generate default CHANGELOG.md in the project root?')
33
- FileUtils.touch 'CHANGELOG.md'
34
- generate_comparison_link
35
- else
36
- FastlaneCore::UI.error("Cannot continue without CHANGELOG.md file")
32
+ FileUtils.touch 'CHANGELOG.md'
33
+ generate_comparison_link
34
+ else
35
+ FastlaneCore::UI.error("Cannot continue without CHANGELOG.md file")
37
36
  end
38
37
  end
39
38
 
40
39
  # Generates link for tag comparison
41
- def self.generate_comparison_link
40
+ def self.generate_comparison_link
42
41
  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)')
43
42
  if FastlaneCore::UI.confirm('Do you want to create links for comparing tags?')
44
43
  repo_url = FastlaneCore::UI.input('Enter your GitHub or Bitbucket repository URL (e.g.: https://github.com/owner/project or https://bitbucket.org/owner/project):')
@@ -68,7 +67,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
68
67
  File.open(CHANGELOG_PATH, 'w') { |f| f.write(changelog) }
69
68
  FastlaneCore::UI.success('Successfuly created CHANGELOG.md')
70
69
  end
71
-
70
+
72
71
  def self.get_line_separator(file_path)
73
72
  f = File.open(file_path)
74
73
  enum = f.each_char
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Changelog
3
- VERSION = "0.10.0"
3
+ VERSION = "0.11.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.10.0
4
+ version: 0.11.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-11 00:00:00.000000000 Z
11
+ date: 2018-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler