fastlane-plugin-changelog 0.6.2 → 0.7.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: e26d9ddcfd339ec08587d0a1d27bc87003692bb9
4
- data.tar.gz: 582915e842fa69e643db3124392f6a0468b2bad6
3
+ metadata.gz: bcf3d31f700f597163a76c226762b026a09f079f
4
+ data.tar.gz: 8ab8cdca0df9c74d348e216a66daf49a2373ac8b
5
5
  SHA512:
6
- metadata.gz: e07875125ca14a092ecae235265191ee7ebfdef575b74476b5629537aaea5087234f205a5531f5e2b2e6f7cf41e645a6dbe3cd535bd83f8afb61ff14515766e8
7
- data.tar.gz: a3be5458dc7ac6666497b41a4073633c0adc286187e4600298430ee3e80a96c962ae80209e0815d6adf535242042b6c71a08fdd0fda260b2730e6317ae5a24bc
6
+ metadata.gz: b2981cb1bbd7c291babbc5d7537360f74dbca6171b2e2572a199d638a67d2102939a77821901bd05ef25aaae88ad4893c025c6ef7a08109f9f357584912ea10f
7
+ data.tar.gz: 7ccc9c0708eac69ab5415a1cff6f564d94f6a3fab272cf1edf614f27c8641937784fcc798457123d743e5df06a01ff7e2cac33f72d1ae0836f9eea80210af123
data/README.md CHANGED
@@ -48,7 +48,7 @@ update_changelog(
48
48
 
49
49
  ### 🔖 stamp_changelog
50
50
  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.
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/).
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 or Bitbucket. This will enable you to quickly get to [comparison between two tags](https://help.github.com/articles/comparing-commits-across-time/).
52
52
  ``` ruby
53
53
  stamp_changelog(
54
54
  section_identifier: 'Build XYZ', # Specify identifier to stamp the Unreleased section with
@@ -25,10 +25,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
25
25
  create_changelog
26
26
 
27
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)
28
+ if FastlaneCore::UI.confirm('Do you want to create links for comparing tags?')
29
+ 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):')
30
+ create_comparison_link(repo_url)
32
31
  else
33
32
  write_to_changelog(DEFAULT_CHANGELOG)
34
33
  end
@@ -46,6 +45,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
46
45
  FileUtils.touch 'CHANGELOG.md'
47
46
  end
48
47
 
48
+ # Create a link for tag comparison
49
+ def self.create_comparison_link(repo_url)
50
+ if repo_url.start_with?('https://github.com')
51
+ output = DEFAULT_CHANGELOG + "\n\n[Unreleased]: #{repo_url}/compare/master...HEAD"
52
+ write_to_changelog(output)
53
+ elsif repo_url.start_with?('https://bitbucket.org')
54
+ output = DEFAULT_CHANGELOG + "\n\n[Unreleased]: #{repo_url}/compare/master..HEAD"
55
+ write_to_changelog(output)
56
+ else
57
+ FastlaneCore::UI.error('Unknown repository host')
58
+ FastlaneCore::UI.message('Creating CHANGELOG.md without links for comparing tags')
59
+ write_to_changelog(DEFAULT_CHANGELOG)
60
+ end
61
+ end
62
+
49
63
  # Write given content to CHANGELOG.md
50
64
  def self.write_to_changelog(changelog)
51
65
  File.open(CHANGELOG_PATH, 'w') { |f| f.write(changelog) }
@@ -56,14 +56,22 @@ module Fastlane
56
56
  if !git_tag.nil? && !git_tag.empty?
57
57
  last_line = file_content.lines.last
58
58
  previous_section_name = last_line[/\[(.*?)\]/, 1]
59
- previous_previous_tag = %r{(?<=compare\/)(.*)?(?=\.{3})}.match(last_line)
60
- previous_tag = /(?<=\.{3})(.*)?/.match(last_line)
59
+ previous_tag = ""
60
+ previous_previous_tag = ""
61
+
62
+ if last_line.include? 'https://github.com' # GitHub uses compare/olderTag...newerTag structure
63
+ previous_previous_tag = %r{(?<=compare\/)(.*)?(?=\.{3})}.match(last_line)
64
+ previous_tag = /(?<=\.{3})(.*)?/.match(last_line)
65
+ elsif last_line.include? 'https://bitbucket.org' # Bitbucket uses compare/newerTag..olderTag structure
66
+ previous_tag = %r{(?<=compare\/)(.*)?(?=\.{2})}.match(last_line)
67
+ previous_previous_tag = /(?<=\.{2})(.*)?/.match(last_line)
68
+ end
61
69
 
62
70
  last_line.sub!(previous_tag.to_s, git_tag) # Replace previous tag with new
63
71
  last_line.sub!(previous_previous_tag.to_s, previous_tag.to_s) # Replace previous-previous tag with previous
64
72
  last_line.sub!(previous_section_name.to_s, section_identifier) # Replace section identifier
65
73
 
66
- UI.message("Created link to Github tags diff")
74
+ UI.message("Created a link for comparison between #{previous_tag} and #{git_tag} tag")
67
75
 
68
76
  file_content.concat(last_line)
69
77
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Changelog
3
- VERSION = "0.6.2"
3
+ VERSION = "0.7.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.6.2
4
+ version: 0.7.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-02-12 00:00:00.000000000 Z
11
+ date: 2017-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry