pull-request 0.6.1 → 0.6.3
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/README.md +29 -0
- data/exe/pr +16 -7
- data/pullrequest.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01ed19f44671d055a29145c6f6c5b240c2dcb84e4cba73b5994e43c7927089aa
|
4
|
+
data.tar.gz: cb019b9929a65728475f17e0621ac5fd9ad5f942144738cacf5d3c145423e632
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 076fd4a8d39afd3ed4b2d57c485710099f3b078888e9e0051cf6f0dce03c51ebbef91a50be76479beffef94d4517e8804705476745fe81b69bc61bd4f76cc2be
|
7
|
+
data.tar.gz: b0635de9ac9e82b53f3802849ad0a6eb5fe483ba87eacccb5915915c1f0786d8ebd167415feb6ede90121b8f4fc898c40096762c61fc17e2b8097dbd051d1173
|
data/README.md
CHANGED
@@ -59,6 +59,24 @@ Creates a branch named `feature/create_clients_endpoint` and open a pull-request
|
|
59
59
|
The quotes are optional, but allow `:` and other characters to be a part of the name (otherwise interpreted by the
|
60
60
|
shell).
|
61
61
|
|
62
|
+
### Additional options
|
63
|
+
|
64
|
+
#### Skip PR creation
|
65
|
+
|
66
|
+
Use the `--no-pr` (or `-n`) option to create the branch and push it without creating a pull request:
|
67
|
+
|
68
|
+
```bash
|
69
|
+
pr -n "Create clients endpoint"
|
70
|
+
```
|
71
|
+
|
72
|
+
#### Specify remote
|
73
|
+
|
74
|
+
Use the `--remote` (or `-r`) option to specify a different git remote (defaults to 'origin'):
|
75
|
+
|
76
|
+
```bash
|
77
|
+
pr -r upstream "Create clients endpoint"
|
78
|
+
```
|
79
|
+
|
62
80
|
## Development
|
63
81
|
|
64
82
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -69,6 +87,17 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
69
87
|
|
70
88
|
Bug reports and pull requests are welcome on GitHub at https://github.com/Jens Ravens/pullrequest. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
71
89
|
|
90
|
+
## Troubleshooting
|
91
|
+
|
92
|
+
**No such file or directory**
|
93
|
+
|
94
|
+
```
|
95
|
+
pr -i 210
|
96
|
+
pr: cannot open 210, No such file or directory
|
97
|
+
```
|
98
|
+
|
99
|
+
`pr` is already a command on the OS, until we override it with our GEM. If encountering this error it means that the gem has not been installed successfully for this Ruby version.
|
100
|
+
|
72
101
|
## License
|
73
102
|
|
74
103
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/exe/pr
CHANGED
@@ -2,9 +2,12 @@
|
|
2
2
|
require "optionparser"
|
3
3
|
require "active_support"
|
4
4
|
require "active_support/all"
|
5
|
+
require "shellwords"
|
5
6
|
|
6
7
|
@simulate = false
|
7
8
|
@issue_number = nil
|
9
|
+
@skip_pr = false
|
10
|
+
@remote = "origin"
|
8
11
|
|
9
12
|
def error(title)
|
10
13
|
STDERR.puts title
|
@@ -49,6 +52,12 @@ OptionParser.new do |opts|
|
|
49
52
|
opts.on("-i", "--issue ISSUE_NUMBER", Integer, "Create a pull-request fixing an issue with the provided number.") do |i|
|
50
53
|
@issue_number = i
|
51
54
|
end
|
55
|
+
opts.on("-n", "--no-pr", "Skip creating the pull request on GitHub") do
|
56
|
+
@skip_pr = true
|
57
|
+
end
|
58
|
+
opts.on("-r", "--remote REMOTE_NAME", "Specify the git remote name (default: origin)") do |remote|
|
59
|
+
@remote = remote
|
60
|
+
end
|
52
61
|
end.parse!
|
53
62
|
|
54
63
|
name = @issue_number ? issue_json["title"] : ARGV.join(" ")
|
@@ -64,7 +73,6 @@ body_lines = []
|
|
64
73
|
path = ".github/pull_request_template.md"
|
65
74
|
body_lines.push File.read(path) if File.exist?(path)
|
66
75
|
body_lines.push "fixes ##{@issue_number}" if @issue_number
|
67
|
-
body = body_lines.join("\n\n")
|
68
76
|
|
69
77
|
base_branch = current_branch
|
70
78
|
exit 1 unless ["master", "main", "develop"].include?(base_branch) || confirm("Your base branch #{base_branch} doesn't seem to be a common base branch name. Do you want to continue?")
|
@@ -77,11 +85,12 @@ sh "git checkout -b #{branch}"
|
|
77
85
|
puts "Creating empty commit"
|
78
86
|
commit_message = "initial commit for #{title}"
|
79
87
|
commit_message += ", fixes ##{@issue_number}" if @issue_number
|
80
|
-
sh "git commit -m
|
88
|
+
sh "git commit -m #{Shellwords.escape(commit_message)} --allow-empty"
|
81
89
|
|
82
|
-
puts "Pushing to
|
83
|
-
sh "git push -u
|
90
|
+
puts "Pushing to #{@remote}"
|
91
|
+
sh "git push -u #{@remote} #{branch}"
|
84
92
|
|
85
|
-
|
86
|
-
|
87
|
-
sh "gh pr create --draft --title
|
93
|
+
unless @skip_pr
|
94
|
+
puts "Creating pull request"
|
95
|
+
sh "gh pr create --draft --title #{Shellwords.escape(title)} --body #{Shellwords.escape(body_lines.join("\n"))} --base #{base_branch}"
|
96
|
+
end
|
data/pullrequest.gemspec
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pull-request
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Ravens
|
8
8
|
- David Dufour-Boivin
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-04-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
|
-
description:
|
56
|
+
description:
|
57
57
|
email:
|
58
58
|
- jens@nerdgeschoss.de
|
59
59
|
- david@nerdgeschoss.de
|
@@ -79,7 +79,7 @@ homepage: https://nerdgeschoss.de
|
|
79
79
|
licenses:
|
80
80
|
- MIT
|
81
81
|
metadata: {}
|
82
|
-
post_install_message:
|
82
|
+
post_install_message:
|
83
83
|
rdoc_options: []
|
84
84
|
require_paths:
|
85
85
|
- lib
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
97
|
rubygems_version: 3.3.7
|
98
|
-
signing_key:
|
98
|
+
signing_key:
|
99
99
|
specification_version: 4
|
100
100
|
summary: Automatically create PRs for GitHub Flow
|
101
101
|
test_files: []
|