sem_ver_components 0.1.2 → 0.2.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/bin/sem_ver_git +7 -1
- data/lib/sem_ver_components/git_hosting.rb +8 -0
- data/lib/sem_ver_components/git_hostings/bitbucket.rb +30 -0
- data/lib/sem_ver_components/git_hostings/github.rb +30 -0
- data/lib/sem_ver_components/output.rb +4 -1
- data/lib/sem_ver_components/outputs/semantic_release_generate_notes.rb +2 -2
- data/lib/sem_ver_components/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c769d2f50e4b9b47d7244d596c497781797539059ae577b3922221a0b55fdfb4
|
4
|
+
data.tar.gz: c265fe89c722f6092b0f8061ea556244131f1d3ce13de0ba24c2fb0714e05d04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc08045f4e3552af8deefe3e4086b8d9e4e80c39bfe65a2c00a8ab25b7eeccbcf089207adcdcb5832308abaa3a2008343c393a124dba4948f8a49b0e161e82d6
|
7
|
+
data.tar.gz: 021e88d06a2ce6fc31cb5d146e211c9436db6ec4da7eaafd151ce16df08347f179cd286782d42e4f10cfeb89f668bac14420a91786e449d757c51205f2b70905
|
data/bin/sem_ver_git
CHANGED
@@ -4,18 +4,24 @@ require 'sem_ver_components/plugins'
|
|
4
4
|
require 'sem_ver_components/local_git'
|
5
5
|
require 'sem_ver_components/version'
|
6
6
|
require 'sem_ver_components/output'
|
7
|
+
require 'sem_ver_components/git_hosting'
|
7
8
|
|
8
9
|
# Default values
|
9
10
|
git_repo = '.'
|
10
11
|
git_from = nil
|
11
12
|
git_to = 'HEAD'
|
13
|
+
git_hosting = :github
|
12
14
|
output = :info
|
13
15
|
output_plugins = SemVerComponents::Plugins.new(:outputs)
|
16
|
+
git_hosting_plugins = SemVerComponents::Plugins.new(:git_hostings)
|
14
17
|
OptionParser.new do |opts|
|
15
18
|
opts.banner = "Usage: #{File.basename($0)} [options]"
|
16
19
|
opts.on('-f', '--from GIT_REF', 'Git reference from which commits are to be analyzed (defaults to first commit)') do |git_ref|
|
17
20
|
git_from = git_ref
|
18
21
|
end
|
22
|
+
opts.on('-g', '--git_hosting GIT_HOSTING', "Specify which kind of git hosting is used. Used to format URLs to commits and comparisons. Possible values are #{git_hosting_plugins.list.sort.join(', ')}. (defaults to #{git_hosting})") do |git_hosting_str|
|
23
|
+
git_hosting = git_hosting_str.to_sym
|
24
|
+
end
|
19
25
|
opts.on('-h', '--help', 'Display this help') do
|
20
26
|
puts opts
|
21
27
|
exit 0
|
@@ -40,4 +46,4 @@ raise "Unknown parameters: #{ARGV.join(' ')}" unless ARGV.empty?
|
|
40
46
|
local_git = SemVerComponents::LocalGit.new(git_repo, git_from, git_to)
|
41
47
|
commits_info = local_git.analyze_commits
|
42
48
|
|
43
|
-
output_plugins[output].new(local_git).process(commits_info)
|
49
|
+
output_plugins[output].new(local_git, git_hosting_plugins[git_hosting].new).process(commits_info)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module SemVerComponents
|
2
|
+
|
3
|
+
module GitHostings
|
4
|
+
|
5
|
+
class Bitbucket < GitHosting
|
6
|
+
|
7
|
+
# Get the URL to a given commit sha
|
8
|
+
#
|
9
|
+
# Parameters::
|
10
|
+
# * *git_url* (String): The git URL
|
11
|
+
# * *commit_sha* (String): The commit sha
|
12
|
+
def commit_url(git_url, commit_sha)
|
13
|
+
"#{git_url}/commits/#{commit_sha}"
|
14
|
+
end
|
15
|
+
|
16
|
+
# Get the URL to compare 2 tags
|
17
|
+
#
|
18
|
+
# Parameters::
|
19
|
+
# * *git_url* (String): The git URL
|
20
|
+
# * *tag_1* (String): The first tag
|
21
|
+
# * *tag_2* (String): The second tag
|
22
|
+
def compare_url(git_url, tag_1, tag_2)
|
23
|
+
"#{git_url}/compare/commits?targetBranch=refs%2Ftags%2F#{tag_2}&sourceBranch=refs%2Ftags%2F#{tag_1}"
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module SemVerComponents
|
2
|
+
|
3
|
+
module GitHostings
|
4
|
+
|
5
|
+
class Github < GitHosting
|
6
|
+
|
7
|
+
# Get the URL to a given commit sha
|
8
|
+
#
|
9
|
+
# Parameters::
|
10
|
+
# * *git_url* (String): The git URL
|
11
|
+
# * *commit_sha* (String): The commit sha
|
12
|
+
def commit_url(git_url, commit_sha)
|
13
|
+
"#{git_url}/commit/#{commit_sha}"
|
14
|
+
end
|
15
|
+
|
16
|
+
# Get the URL to compare 2 tags
|
17
|
+
#
|
18
|
+
# Parameters::
|
19
|
+
# * *git_url* (String): The git URL
|
20
|
+
# * *tag_1* (String): The first tag
|
21
|
+
# * *tag_2* (String): The second tag
|
22
|
+
def compare_url(git_url, tag_1, tag_2)
|
23
|
+
"#{git_url}/compare/#{tag_1}...#{tag_2}"
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -1,13 +1,16 @@
|
|
1
1
|
module SemVerComponents
|
2
2
|
|
3
|
+
# Base class for all output plugins
|
3
4
|
class Output
|
4
5
|
|
5
6
|
# Constructor
|
6
7
|
#
|
7
8
|
# Parameters::
|
8
9
|
# * *local_git* (LocalGit): The git repository
|
9
|
-
|
10
|
+
# * *git_hosting* (GitHosting): The git hosting to be used for URLs
|
11
|
+
def initialize(local_git, git_hosting)
|
10
12
|
@local_git = local_git
|
13
|
+
@git_hosting = git_hosting
|
11
14
|
end
|
12
15
|
|
13
16
|
end
|
@@ -80,7 +80,7 @@ module SemVerComponents
|
|
80
80
|
commits_per_component[component][bump_level] << git_commit
|
81
81
|
end
|
82
82
|
end
|
83
|
-
puts "# [v#{new_version}](#{git_url
|
83
|
+
puts "# [v#{new_version}](#{@git_hosting.compare_url(git_url, @local_git.git_from, new_version)}) (#{Time.now.utc.strftime('%F %T')})"
|
84
84
|
puts
|
85
85
|
commits_per_component.sort_by { |component, _component_info| component || '' }.each do |(component, component_info)|
|
86
86
|
puts "## #{component.nil? ? 'Global changes' : "Changes for #{component}"}\n" if commits_per_component.size > 1 || !component.nil?
|
@@ -112,7 +112,7 @@ module SemVerComponents
|
|
112
112
|
commit_lines[commit_line] = commit.sha
|
113
113
|
end
|
114
114
|
commit_lines.each do |commit_line, commit_sha|
|
115
|
-
puts "* [#{commit_line}](#{git_url
|
115
|
+
puts "* [#{commit_line}](#{@git_hosting.commit_url(git_url, commit_sha)})"
|
116
116
|
end
|
117
117
|
puts
|
118
118
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sem_ver_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Muriel Salvan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -62,6 +62,9 @@ extensions: []
|
|
62
62
|
extra_rdoc_files: []
|
63
63
|
files:
|
64
64
|
- bin/sem_ver_git
|
65
|
+
- lib/sem_ver_components/git_hosting.rb
|
66
|
+
- lib/sem_ver_components/git_hostings/bitbucket.rb
|
67
|
+
- lib/sem_ver_components/git_hostings/github.rb
|
65
68
|
- lib/sem_ver_components/local_git.rb
|
66
69
|
- lib/sem_ver_components/output.rb
|
67
70
|
- lib/sem_ver_components/outputs/info.rb
|