pr-with-params 1.0.3 → 1.1.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: 445be6f9d1bb4ce51a180ab2461e571f9493fe99a0449513368ebec0af97a452
4
- data.tar.gz: f1f45b9f921973258461cdb61b61f058bf9ad7e60e3fe79043bff02804189e60
3
+ metadata.gz: 205374a47996232c17343492935e3fb4a66ced497e2c0dbf2bbfce278e67a9de
4
+ data.tar.gz: 3d5a35b0957a4c9b101756164d39a2bfdf85cb98b1e9d30795ba21a814f06046
5
5
  SHA512:
6
- metadata.gz: d2b60aa172d6def35082fee5ac9826a6e155eaae786b1a2aa8a2eacde81448417a42883672f08b5defaaac41be40c725fba0d0084860b8b96df6d1b703a403d0
7
- data.tar.gz: 4d651b5b57042e4d25daadabeb4088863cabf38d3106b0d12b10226973bfc0eb736b52223744fe8218cecb37963631ca6bf1d71bd5d5e06073fe27d39a67733c
6
+ metadata.gz: 8efbfa3dcb16a892718c9e60b0a6093512b05c4226b7ecd990ba7aa46b99368ad7c9b944a02949a704fa583a56173ef21b9c5c269bd3f36fc899452202f3434f
7
+ data.tar.gz: 4b21a5705d4e3bfa8046a020656ffc25d92c4466652e213074bcd0fbb08b092d53fe9939905dfebeee6ea3e862a0efe0404c7ce19b8ebf0203833f919f1d122e
data/.rubocop.yml CHANGED
@@ -1,6 +1,5 @@
1
1
  Style/StringLiterals:
2
- Enabled: true
3
- EnforcedStyle: double_quotes
2
+ Enabled: false
4
3
 
5
4
  Style/StringLiteralsInInterpolation:
6
5
  Enabled: true
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pr-with-params (1.0.3)
4
+ pr-with-params (1.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/exe/pr-with-params CHANGED
@@ -39,7 +39,7 @@ parser = OptionParser.new do |opt|
39
39
  options[:template] = pr_template
40
40
  end
41
41
 
42
- opt.on('-d', '--description DESC', 'Specify a custom PR title') do |pr_description|
42
+ opt.on('-d', '--description DESC', 'Specify a custom PR title. Will use the first branch commit message otherwise.') do |pr_description|
43
43
  options[:title] = pr_description
44
44
  end
45
45
 
@@ -60,8 +60,11 @@ begin
60
60
 
61
61
  branch_name = `git rev-parse --abbrev-ref HEAD`.chomp
62
62
  base_branch = options.delete(:base_branch) || `git remote show origin | grep "HEAD branch" | sed 's/.*: //'`.chomp
63
- remote_git_uri = `git config --get remote.origin.url`.sub('git@github.com:', '').sub('.git', '').chomp
64
63
 
64
+ default_title = `git show-branch --no-name $(git log #{base_branch}..#{branch_name} --pretty=format:"%h" | tail -1)`.chomp
65
+ options[:title] ||= default_title
66
+
67
+ remote_git_uri = `git config --get remote.origin.url`.sub('git@github.com:', '').sub('.git', '').chomp
65
68
  uri_host = 'www.github.com'
66
69
  uri_path = "/#{remote_git_uri}/compare/#{base_branch}...#{branch_name}"
67
70
 
@@ -85,6 +88,6 @@ rescue StandardError => e
85
88
  backtrace: e.backtrace&.last(10)
86
89
  }.to_json
87
90
 
88
- STDERR.puts "\n" + "\e[31mERROR:\e[0m " + error_message + "\n"
91
+ warn "\e[31mERROR\e[0m: " + error_message + "\n"
89
92
  exit 1
90
93
  end
@@ -3,7 +3,7 @@
3
3
  module PR
4
4
  module With
5
5
  module Params
6
- VERSION = "1.0.3"
6
+ VERSION = "1.1.0"
7
7
  end
8
8
  end
9
9
  end
@@ -20,9 +20,7 @@ module PR
20
20
  end
21
21
 
22
22
  def parse_config(file_path, scope)
23
- return {} if file_path.empty?
24
-
25
- ConfigParser.new(config_file_path: file_path, scope: scope).parse!
23
+ file_path.empty? ? {} : ConfigParser.new(config_file_path: file_path, scope: scope).parse!
26
24
  rescue StandardError => e
27
25
  error_message = {
28
26
  message: "Error parsing config file. Using defaults",
@@ -30,8 +28,8 @@ module PR
30
28
  backtrace: e.backtrace&.last(10)
31
29
  }.to_json
32
30
 
33
- STDERR.puts "\e[35mWARNING\e[0m: " + error_message + "\n"
34
-
31
+ warn "\e[35mWARNING\e[0m: " + error_message + "\n"
32
+
35
33
  {}
36
34
  end
37
35
  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.0.3
4
+ version: 1.1.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-08-11 00:00:00.000000000 Z
11
+ date: 2022-08-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: