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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 711e55d8a2646d8d36c9c12f738e2fb8ac0d40897550f1c418bc63717da9fce7
4
- data.tar.gz: 2e146ec8502c0c2761a278ed1e676913b5388e6f9fc81350d9ee8c0b711c2f47
3
+ metadata.gz: 343540acbeacfef7c91c9ea3fd6cf28f155ec3e10d404ef73268c1c8bc8392ed
4
+ data.tar.gz: e8da9f720588d0a272473874ed92960a27836bd053c758d221caf976d9cb3a91
5
5
  SHA512:
6
- metadata.gz: 8ccc53136675957cbbabe277ae0865a169bbc536edd3babe9a0a66bebfc093a45bfd5786ec65942deedd5dda6f6f00de4600fc865298ff4d41e4ec4dd2363707
7
- data.tar.gz: 85a0a331109ee21bf30f2d60e659c8d52f857f8c204b1910a371a306332d06f175523b2f37b2001b24321876e5ae8d2f22899dd5f80bae0c98f1606bab94545d
6
+ metadata.gz: 6b42bdc63a57697ff35fe2809cb40034ffaacb7e292c5d0e2570eeac2f7df1ac9552bccb8b393cda6c59c4e65d296ecb3c4a6dbe4180c59e6dca1274934f58d2
7
+ data.tar.gz: fca2cdac29bbe59951617d9b3bae3aead7a9768e2a5a6d95cfb4582df286640e4455e9cbb1074f73c52c94279ebc4bf0cc5ab93a3f3cbabfc1ea9bfb9c08ca4c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- conventional_commits (0.2.15)
4
+ conventional_commits (0.2.17)
5
5
  open3
6
6
  thor
7
7
  yaml
@@ -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.should_try_to_parse_msg_from_file(source:)
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
- def should_try_to_parse_msg_from_file(source: "")
43
- skippable_sources.include?(source)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ConventionalCommits
4
- VERSION = "0.2.16"
4
+ VERSION = "0.2.18"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conventional_commits
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.16
4
+ version: 0.2.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Swift-Gurus