pr-with-params 1.0.1 → 1.1.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/.rubocop.yml +1 -2
- data/Gemfile.lock +1 -1
- data/exe/pr-with-params +7 -4
- data/lib/pr/with/params/config_parser.rb +1 -1
- data/lib/pr/with/params/version.rb +1 -1
- data/lib/pr/with/params.rb +3 -3
- data/pr-with-params.gemspec +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 205374a47996232c17343492935e3fb4a66ced497e2c0dbf2bbfce278e67a9de
|
4
|
+
data.tar.gz: 3d5a35b0957a4c9b101756164d39a2bfdf85cb98b1e9d30795ba21a814f06046
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8efbfa3dcb16a892718c9e60b0a6093512b05c4226b7ecd990ba7aa46b99368ad7c9b944a02949a704fa583a56173ef21b9c5c269bd3f36fc899452202f3434f
|
7
|
+
data.tar.gz: 4b21a5705d4e3bfa8046a020656ffc25d92c4466652e213074bcd0fbb08b092d53fe9939905dfebeee6ea3e862a0efe0404c7ce19b8ebf0203833f919f1d122e
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
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
|
|
@@ -72,7 +75,7 @@ begin
|
|
72
75
|
push_message = "\nPushing your local branch to origin/#{branch_name}..."
|
73
76
|
puts "\e[32m#{push_message}\e[0m"
|
74
77
|
`sleep 1`
|
75
|
-
system("git push -u origin #{branch_name}")
|
78
|
+
system("git push -u origin #{branch_name}", exception: true)
|
76
79
|
|
77
80
|
open_url_message = "\nOpening pull request browser window..."
|
78
81
|
puts "\e[32m#{open_url_message}\e[0m"
|
@@ -85,6 +88,6 @@ rescue StandardError => e
|
|
85
88
|
backtrace: e.backtrace&.last(10)
|
86
89
|
}.to_json
|
87
90
|
|
88
|
-
|
91
|
+
warn "\e[31mERROR\e[0m: " + error_message + "\n"
|
89
92
|
exit 1
|
90
93
|
end
|
@@ -36,8 +36,8 @@ module PR
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def validate_file_type!
|
39
|
-
raise ArgumentError.new('Config file path is invalid or file does not exist.') unless file_exists?
|
40
39
|
raise TypeError.new('Config file type must be YAML (.yaml or .yml)') unless yaml_file?
|
40
|
+
raise ArgumentError.new("Config file path is invalid or file does not exist: #{config_file_path}") unless file_exists?
|
41
41
|
end
|
42
42
|
|
43
43
|
def yaml_file?
|
data/lib/pr/with/params.rb
CHANGED
@@ -20,7 +20,7 @@ module PR
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def parse_config(file_path, scope)
|
23
|
-
|
23
|
+
file_path.empty? ? {} : ConfigParser.new(config_file_path: file_path, scope: scope).parse!
|
24
24
|
rescue StandardError => e
|
25
25
|
error_message = {
|
26
26
|
message: "Error parsing config file. Using defaults",
|
@@ -28,8 +28,8 @@ module PR
|
|
28
28
|
backtrace: e.backtrace&.last(10)
|
29
29
|
}.to_json
|
30
30
|
|
31
|
-
|
32
|
-
|
31
|
+
warn "\e[35mWARNING\e[0m: " + error_message + "\n"
|
32
|
+
|
33
33
|
{}
|
34
34
|
end
|
35
35
|
end
|
data/pr-with-params.gemspec
CHANGED
@@ -10,6 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
|
11
11
|
spec.summary = "Pushes current local branch to remote with upstream at origin/[local-branch-name]. It also opens a new pull request browser window at a URL with customized query params, based on specified options, which pre-populates certain fields in the pull request. This is especially useful when supporting multiple PR templates within a code base."
|
12
12
|
spec.homepage = "https://github.com/2k-joker/pr-with-params"
|
13
|
+
spec.licenses = ["MIT"]
|
13
14
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
15
|
|
15
16
|
spec.metadata["homepage_uri"] = spec.homepage
|
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
|
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
|
+
date: 2022-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -35,7 +35,8 @@ files:
|
|
35
35
|
- lib/pr/with/params/version.rb
|
36
36
|
- pr-with-params.gemspec
|
37
37
|
homepage: https://github.com/2k-joker/pr-with-params
|
38
|
-
licenses:
|
38
|
+
licenses:
|
39
|
+
- MIT
|
39
40
|
metadata:
|
40
41
|
homepage_uri: https://github.com/2k-joker/pr-with-params
|
41
42
|
post_install_message:
|