conventional_commits 0.2.16 → 0.2.18
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/Gemfile.lock +1 -1
- data/lib/cli/branch_name_cli.rb +7 -1
- data/lib/commit/commit_message_generator.rb +11 -3
- data/lib/conventional_commits/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 343540acbeacfef7c91c9ea3fd6cf28f155ec3e10d404ef73268c1c8bc8392ed
|
4
|
+
data.tar.gz: e8da9f720588d0a272473874ed92960a27836bd053c758d221caf976d9cb3a91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b42bdc63a57697ff35fe2809cb40034ffaacb7e292c5d0e2570eeac2f7df1ac9552bccb8b393cda6c59c4e65d296ecb3c4a6dbe4180c59e6dca1274934f58d2
|
7
|
+
data.tar.gz: fca2cdac29bbe59951617d9b3bae3aead7a9768e2a5a6d95cfb4582df286640e4455e9cbb1074f73c52c94279ebc4bf0cc5ab93a3f3cbabfc1ea9bfb9c08ca4c
|
data/Gemfile.lock
CHANGED
data/lib/cli/branch_name_cli.rb
CHANGED
@@ -30,7 +30,7 @@ module ConventionalCommits
|
|
30
30
|
cfg_path = options["cfg_path"] || Configuration::DEFAULT_CONFIGURATION_PATH
|
31
31
|
|
32
32
|
generator = ConventionalCommits::CommitMessageGenerator.new
|
33
|
-
unless generator.
|
33
|
+
unless generator.should_preserve_original_message(source:)
|
34
34
|
puts "Generating message"
|
35
35
|
name = generator.prepare_message_template_for_type(type: source, cfg_path:, msg_file_path: msg_path)
|
36
36
|
File.write_to_file(msg_path, name)
|
@@ -55,10 +55,16 @@ module ConventionalCommits
|
|
55
55
|
option :msg_path, type: :string, required: false
|
56
56
|
option :msg, type: :string, required: false
|
57
57
|
option :cfg_path, type: :string, required: false
|
58
|
+
option :source, type: :string, required: false
|
58
59
|
def validate_commit_msg
|
60
|
+
generator = ConventionalCommits::CommitMessageGenerator.new
|
61
|
+
src = options["source"] || ""
|
62
|
+
return if generator.should_preserve_original_message(source: src)
|
63
|
+
|
59
64
|
msg_path = options["msg_path"] || Configuration::DEFAULT_COMMIT_MSG_PATH
|
60
65
|
cfg_path = options["cfg_path"] || Configuration::DEFAULT_CONFIGURATION_PATH
|
61
66
|
validator = ConventionalCommits::CommitMessageValidator.new
|
67
|
+
|
62
68
|
validator.validate_commit_msg_from_file(commit_msg_path: msg_path, cfg_path:)
|
63
69
|
rescue StandardError => e
|
64
70
|
raise Thor::Error, e.message
|
@@ -39,16 +39,24 @@ module ConventionalCommits
|
|
39
39
|
data = File.read_file(msg_file_path).to_s
|
40
40
|
prepare_template_message(custom_body: data, cfg_path:)
|
41
41
|
end
|
42
|
-
|
43
|
-
|
42
|
+
|
43
|
+
def should_preserve_original_message(source: "")
|
44
|
+
preserving_message.include?(source)
|
44
45
|
end
|
45
46
|
|
46
|
-
private
|
47
47
|
|
48
|
+
private
|
49
|
+
def should_try_to_parse_msg_from_file(source: "")
|
50
|
+
skippable_sources.include?(source)
|
51
|
+
end
|
48
52
|
def skippable_sources
|
49
53
|
%w[message merge squash]
|
50
54
|
end
|
51
55
|
|
56
|
+
def preserving_message
|
57
|
+
%w[rebase merge squash]
|
58
|
+
end
|
59
|
+
|
52
60
|
def sanitize(string)
|
53
61
|
string.gsub(/-/, " ").gsub(/_/, " ")
|
54
62
|
end
|