pr-with-params 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d4ad8c0505135845906a907642802d1e6426610e114cfd33be9c090a4866713
4
- data.tar.gz: 71b40495173262b6ef5cf9ce0ea85f160e677d95505cc2cded45036831e86a90
3
+ metadata.gz: e73e0d7cdcfe3e16d632105a2a54564b94e04b0fe523a7faa3449e11e6ad7edb
4
+ data.tar.gz: 3260ff8eec71435baf10bbce8ba8633b37077e8d8e26dad28c6ee729a23e6783
5
5
  SHA512:
6
- metadata.gz: c592f1a860463ae680e56dc919d91a1e575c0beead05bfc0f64d759fc509b28cd06e2bc42ddd4240a38e85ee40c7d74c9b64b87157cf740579b2fe63c6632fff
7
- data.tar.gz: 2dd182433b8815efe50dd0405232c9319d2d0795f61479a54dc9c80e4f4be6e51feeb832789ab73286c1c7c3bed1f81513469ab4d2feb8292ca1fb2538f6889e
6
+ metadata.gz: 4039bc9e0d935d8355899f6b71c34b958d7900c447e710c6fccfe12dea0e4172279207cd8bd559226da2e4e33c1cd90961f9d1221d21ddc2349a6748aae457e5
7
+ data.tar.gz: 0ead5bf501b295bf8892600773872c9132a8857de609d78146636de50d4447cdf37e0ad746b0f81d765b4c2b5e859ece057d74d310defb3859decd6c85a2c3ed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pr-with-params (1.2.0)
4
+ pr-with-params (1.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -52,7 +52,7 @@ bug_fix:
52
52
  * Only fields defined in another scope will override the defaults. In the example above, the final list of configs will be:
53
53
 
54
54
  ```ruby
55
- { base_branch: 'main', template: 'bug_fix_template.md', assignees: '2k-joker', labels: 'bug,urgent' }
55
+ { validators: ['conventional_commits'], base_branch: 'main', template: 'bug_fix_template.md', assignees: '2k-joker', labels: 'bug,urgent' }
56
56
  ```
57
57
 
58
58
  **Supported configs**
data/exe/pr-with-params CHANGED
@@ -6,7 +6,7 @@ require 'json'
6
6
  require 'optparse'
7
7
  require 'open3'
8
8
 
9
- options = { expand: 1 }
9
+ options = { expand: 1, validators: [] }
10
10
  config_file_path = ''
11
11
  config_scope = nil
12
12
 
@@ -90,12 +90,11 @@ begin
90
90
  `sleep 1`
91
91
  PR::With::Params.open(host: uri_host, path: uri_path, query: options)
92
92
  rescue StandardError => e
93
- error_message = {
94
- message: 'An error occurred while building or opening your custom pull request URL',
95
- reason: e.message,
96
- backtrace: e.backtrace&.last(10)
97
- }.to_json
93
+ message = "\e[31mERROR\e[0m: An error occurred while building or opening your custom pull request URL"
94
+ reason = "reason: #{e.message}"
95
+ backtrace = "backtrace: #{e.backtrace&.last(10)&.join("\n")}"
96
+ error_message = [message, reason, backtrace, "\n\n"].join("\n")
98
97
 
99
- warn "\e[31mERROR\e[0m: " + error_message + "\n"
98
+ warn error_message
100
99
  exit 1
101
100
  end
@@ -25,7 +25,7 @@ module PR
25
25
  end
26
26
 
27
27
  class ConventionalCommitValidator
28
- CONVENTIONAL_COMMIT_REGEX = /^((build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(\w+\))?(!)?(: (.*\s*)*))|(^Merge (.*\s*)*)|(^Initial commit$)/.freeze
28
+ CONVENTIONAL_COMMIT_REGEX = /^((build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.*\))?(!)?(: (.*\s*)*))|(^Merge (.*\s*)*)|(^Initial commit$)/.freeze
29
29
 
30
30
  def initialize(options)
31
31
  @commit_message = options[:title]
@@ -3,7 +3,7 @@
3
3
  module PR
4
4
  module With
5
5
  module Params
6
- VERSION = "1.2.0"
6
+ VERSION = "1.3.0"
7
7
  end
8
8
  end
9
9
  end
@@ -21,15 +21,16 @@ module PR
21
21
  end
22
22
 
23
23
  def parse_config(file_path, scope)
24
+ ConfigParser.new(config_file_path: file_path, scope: scope).parse!
25
+
24
26
  file_path.empty? ? {} : ConfigParser.new(config_file_path: file_path, scope: scope).parse!
25
27
  rescue StandardError => e
26
- error_message = {
27
- message: "Error parsing config file. Using defaults",
28
- reason: e.message,
29
- backtrace: e.backtrace&.last(10)
30
- }.to_json
28
+ message = "\e[35mWARNING\e[0m: Error parsing config file. Using defaults"
29
+ reason = "reason: #{e.message}"
30
+ backtrace = "backtrace: #{e.backtrace&.last(10)&.join("\n")}"
31
+ error_message = [message, reason, backtrace, "\n\n"].join("\n")
31
32
 
32
- warn "\e[35mWARNING\e[0m: " + error_message + "\n"
33
+ warn error_message
33
34
 
34
35
  {}
35
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pr-with-params
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 2k-joker
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-06 00:00:00.000000000 Z
11
+ date: 2022-10-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: