pull-request 0.1.0 → 0.3.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 +5 -5
- data/.rubocop.yml +67 -0
- data/README.md +43 -8
- data/exe/pr +38 -8
- data/pullrequest.gemspec +5 -5
- metadata +14 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1a24bfa9cadb0ef0ede06d5e1c94ae69f6eb15d765a64c7ab3c6ad9af28eee44
|
4
|
+
data.tar.gz: d91143af59fdeb21f53827bbea50b48237fadeb7b0d31a3f24d714d3901b5fe3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1418f787d24cfca340f6bfaf477277b80ad1f081068abdb685ed70a8c94997f21e9d113f8fd04b85d911d787363834be46232d2bfafe08bb48d1ac882f0e72f0
|
7
|
+
data.tar.gz: f0c48a452e439ca7791b412253e59d6a66714c6c6c08f089e2391fa6af3a032f9845fd490681b4b2a88ff6ecb7f3d3e50046c65e99577d487df0fe44b0eb9c16
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.6.3
|
3
|
+
DisplayCopNames: true
|
4
|
+
DisplayStyleGuide: true
|
5
|
+
|
6
|
+
Style/SpecialGlobalVars:
|
7
|
+
Enabled: false
|
8
|
+
|
9
|
+
Bundler/OrderedGems:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
Layout/AlignParameters:
|
13
|
+
EnforcedStyle: with_fixed_indentation
|
14
|
+
|
15
|
+
Layout/IndentArray:
|
16
|
+
EnforcedStyle: consistent
|
17
|
+
|
18
|
+
Style/ConditionalAssignment:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Style/Documentation:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Style/EmptyMethod:
|
25
|
+
EnforcedStyle: expanded
|
26
|
+
|
27
|
+
Style/FrozenStringLiteralComment:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Style/MultilineBlockChain:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Layout/MultilineMethodCallIndentation:
|
34
|
+
EnforcedStyle: indented
|
35
|
+
|
36
|
+
Style/NilComparison:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Style/ClassAndModuleChildren:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
Style/NumericLiterals:
|
43
|
+
MinDigits: 15
|
44
|
+
|
45
|
+
Style/NumericPredicate:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Style/WordArray:
|
49
|
+
EnforcedStyle: brackets
|
50
|
+
|
51
|
+
Style/SymbolArray:
|
52
|
+
EnforcedStyle: brackets
|
53
|
+
|
54
|
+
Style/RescueModifier:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
Style/Lambda:
|
58
|
+
EnforcedStyle: literal
|
59
|
+
|
60
|
+
Style/RegexpLiteral:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Style/StringLiterals:
|
64
|
+
EnforcedStyle: double_quotes
|
65
|
+
|
66
|
+
Metrics:
|
67
|
+
Enabled: false
|
data/README.md
CHANGED
@@ -1,28 +1,63 @@
|
|
1
1
|
# Pullrequest
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Automatically branch and create an empty pull request, automating an early-review workflow.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
7
|
+
### Requirements
|
8
|
+
|
9
|
+
#### hub
|
10
|
+
|
11
|
+
[GitHub's `hub`](https://hub.github.com/) CLI tool is required. On macOS, simply install it through _HomeBrew_
|
12
|
+
|
13
|
+
```bash
|
14
|
+
brew install hub
|
15
|
+
```
|
16
|
+
|
17
|
+
### Installing pr (pull-request) as part of your application
|
18
|
+
|
9
19
|
Add this line to your application's Gemfile:
|
10
20
|
|
11
21
|
```ruby
|
12
|
-
gem '
|
22
|
+
gem 'pull-request'
|
13
23
|
```
|
14
24
|
|
15
25
|
And then execute:
|
16
26
|
|
17
|
-
|
27
|
+
```bash
|
28
|
+
bundle
|
29
|
+
```
|
30
|
+
|
31
|
+
### Installing pr (pull-request) standalone
|
18
32
|
|
19
|
-
|
33
|
+
Install it yourself as:
|
20
34
|
|
21
|
-
|
35
|
+
```bash
|
36
|
+
gem install pull-request
|
37
|
+
````
|
22
38
|
|
23
39
|
## Usage
|
24
40
|
|
25
|
-
|
41
|
+
### Create pull request to fix an issue
|
42
|
+
|
43
|
+
Assuming an issue #42 entitled `Create Clients Endpoint` exists.
|
44
|
+
|
45
|
+
```bash
|
46
|
+
pr -i 42
|
47
|
+
```
|
48
|
+
|
49
|
+
Creates a branch `feature/42_create_clients_endpoint` and opens a pull request for issue #42 named `Create clients endpoint`, including `fixes #42` in its description (linking the PR to the issue).
|
50
|
+
|
51
|
+
### Create custom pull request
|
52
|
+
|
53
|
+
```bash
|
54
|
+
pr "Create clients endpoint"
|
55
|
+
```
|
56
|
+
|
57
|
+
Creates a branch named `feature/create_clients_endpoint` and open a pull-request named `Create clients endpoint`.
|
58
|
+
|
59
|
+
The quotes are optional, but allow `:` and other characters to be a part of the name (otherwise interpreted by the
|
60
|
+
shell).
|
26
61
|
|
27
62
|
## Development
|
28
63
|
|
data/exe/pr
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
#!/usr/bin/env ruby
|
3
2
|
require "optionparser"
|
4
3
|
require "active_support"
|
5
4
|
require "active_support/all"
|
6
5
|
|
7
|
-
estimation = nil
|
6
|
+
@estimation = nil
|
7
|
+
@simulate = false
|
8
|
+
@issue_number = nil
|
8
9
|
|
9
10
|
def error(title)
|
10
11
|
STDERR.puts title
|
@@ -12,28 +13,57 @@ def error(title)
|
|
12
13
|
end
|
13
14
|
|
14
15
|
def sh(command)
|
16
|
+
return puts "▶️ #{command}" if @simulate
|
17
|
+
|
15
18
|
error "could not execute '#{command}'" unless system(command)
|
16
19
|
end
|
17
20
|
|
21
|
+
def sh_get(command)
|
22
|
+
value = `#{command}`
|
23
|
+
error "could not execute '#{command}'" unless $? == 0
|
24
|
+
|
25
|
+
value
|
26
|
+
end
|
27
|
+
|
18
28
|
OptionParser.new do |opts|
|
19
29
|
opts.banner = "Usage: pr [options] [name]\nDefaults: pr" + File::SEPARATOR
|
20
|
-
opts.on("-e", "--estimation ESTIMATION", Integer, "Estimated time in hours") do |e|
|
21
|
-
estimation = e.presence
|
30
|
+
opts.on("-e", "--estimation ESTIMATION", Integer, "Estimated time in hours.") do |e|
|
31
|
+
@estimation = e.presence
|
32
|
+
end
|
33
|
+
opts.on("-s", "--simulate", "Simulate the actions: prints out the write-commands instead of executing them, prefixed with ▶️ .") do
|
34
|
+
@simulate = true
|
35
|
+
end
|
36
|
+
opts.on("-i", "--issue ISSUE_NUMBER", Integer, "Create a pull-request fixing an issue with the provided number.") do |i|
|
37
|
+
@issue_number = i
|
22
38
|
end
|
23
39
|
end.parse!
|
24
40
|
|
25
|
-
name =
|
41
|
+
name =
|
42
|
+
if @issue_number
|
43
|
+
sh_get("hub issue show #{@issue_number} -f %t")
|
44
|
+
else
|
45
|
+
ARGV.join(" ")
|
46
|
+
end
|
26
47
|
error "Please specify a name for your Pull Request" if name.blank?
|
27
48
|
|
28
49
|
title = name
|
29
|
-
title += " [#{estimation}]" if estimation
|
30
|
-
|
50
|
+
title += " [#{@estimation}]" if @estimation
|
51
|
+
title += "\n\nfixes ##{@issue_number}" if @issue_number
|
52
|
+
|
53
|
+
branch = "feature/"
|
54
|
+
branch += "#{@issue_number}_" if @issue_number
|
55
|
+
branch += name.parameterize.underscore
|
56
|
+
|
31
57
|
puts "Creating new PR for feature '#{title}'"
|
58
|
+
|
32
59
|
puts "Creating branch #{branch}"
|
33
60
|
sh "git checkout -b #{branch}"
|
61
|
+
|
34
62
|
puts "Creating empty commit"
|
35
63
|
sh "git commit -m 'initial commit for #{name}' --allow-empty"
|
64
|
+
|
36
65
|
puts "Pushing to origin"
|
37
66
|
sh "git push -u origin #{branch}"
|
67
|
+
|
38
68
|
puts "Creating pull request"
|
39
|
-
sh "hub pull-request -m '#{title}'"
|
69
|
+
sh "hub pull-request -d -m '#{title}'"
|
data/pullrequest.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
Gem::Specification.new do |spec|
|
3
3
|
spec.name = "pull-request"
|
4
|
-
spec.version = "0.
|
5
|
-
spec.authors = ["Jens Ravens"]
|
6
|
-
spec.email = ["jens@nerdgeschoss.de"]
|
4
|
+
spec.version = "0.3.0"
|
5
|
+
spec.authors = ["Jens Ravens", "David Dufour-Boivin"]
|
6
|
+
spec.email = ["jens@nerdgeschoss.de", "david@nerdgeschoss.de"]
|
7
7
|
|
8
8
|
spec.summary = "Automatically create PRs for GitHub Flow"
|
9
9
|
spec.homepage = "https://nerdgeschoss.de"
|
@@ -17,6 +17,6 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
19
|
spec.add_dependency "activesupport", "~> 5.1"
|
20
|
-
spec.add_development_dependency "bundler"
|
21
|
-
spec.add_development_dependency "rake"
|
20
|
+
spec.add_development_dependency "bundler"
|
21
|
+
spec.add_development_dependency "rake"
|
22
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pull-request
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Ravens
|
8
|
+
- David Dufour-Boivin
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2020-08-10 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: activesupport
|
@@ -28,39 +29,41 @@ dependencies:
|
|
28
29
|
name: bundler
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
30
31
|
requirements:
|
31
|
-
- - "
|
32
|
+
- - ">="
|
32
33
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
+
version: '0'
|
34
35
|
type: :development
|
35
36
|
prerelease: false
|
36
37
|
version_requirements: !ruby/object:Gem::Requirement
|
37
38
|
requirements:
|
38
|
-
- - "
|
39
|
+
- - ">="
|
39
40
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
41
|
+
version: '0'
|
41
42
|
- !ruby/object:Gem::Dependency
|
42
43
|
name: rake
|
43
44
|
requirement: !ruby/object:Gem::Requirement
|
44
45
|
requirements:
|
45
|
-
- - "
|
46
|
+
- - ">="
|
46
47
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
+
version: '0'
|
48
49
|
type: :development
|
49
50
|
prerelease: false
|
50
51
|
version_requirements: !ruby/object:Gem::Requirement
|
51
52
|
requirements:
|
52
|
-
- - "
|
53
|
+
- - ">="
|
53
54
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
55
|
+
version: '0'
|
55
56
|
description:
|
56
57
|
email:
|
57
58
|
- jens@nerdgeschoss.de
|
59
|
+
- david@nerdgeschoss.de
|
58
60
|
executables:
|
59
61
|
- pr
|
60
62
|
extensions: []
|
61
63
|
extra_rdoc_files: []
|
62
64
|
files:
|
63
65
|
- ".gitignore"
|
66
|
+
- ".rubocop.yml"
|
64
67
|
- CODE_OF_CONDUCT.md
|
65
68
|
- Gemfile
|
66
69
|
- LICENSE.txt
|
@@ -89,8 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
92
|
- !ruby/object:Gem::Version
|
90
93
|
version: '0'
|
91
94
|
requirements: []
|
92
|
-
|
93
|
-
rubygems_version: 2.6.8
|
95
|
+
rubygems_version: 3.0.6
|
94
96
|
signing_key:
|
95
97
|
specification_version: 4
|
96
98
|
summary: Automatically create PRs for GitHub Flow
|