pull-request 0.3.0 → 0.4.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/exe/pr +15 -2
  3. data/pullrequest.gemspec +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a24bfa9cadb0ef0ede06d5e1c94ae69f6eb15d765a64c7ab3c6ad9af28eee44
4
- data.tar.gz: d91143af59fdeb21f53827bbea50b48237fadeb7b0d31a3f24d714d3901b5fe3
3
+ metadata.gz: 47ba8b480d14f0f71f0042798a035228d44c4d9bf7f446555f4af5f092b0747c
4
+ data.tar.gz: d33393ceb042ef7c29625712902252091c38b38986dfbe9ddc9b64effc35d7d0
5
5
  SHA512:
6
- metadata.gz: 1418f787d24cfca340f6bfaf477277b80ad1f081068abdb685ed70a8c94997f21e9d113f8fd04b85d911d787363834be46232d2bfafe08bb48d1ac882f0e72f0
7
- data.tar.gz: f0c48a452e439ca7791b412253e59d6a66714c6c6c08f089e2391fa6af3a032f9845fd490681b4b2a88ff6ecb7f3d3e50046c65e99577d487df0fe44b0eb9c16
6
+ metadata.gz: ed68a9afa54c9a0bccde8b6b28a6fa75b506d28e0ca1d8ae3664a1e0b6f7aaab5357c6781bf6f9c55ab7f38a2d72f92ce3b9a5bc0dbb6157f0c9df971c35d899
7
+ data.tar.gz: ae80c14c3c83c29b03175d237c0f7856b3b00fd8488dc33bbcdf9191fb7fbcf8c89535ccfb435537896d906df5e88db98775ffdadd4d01fcc13b837d49033bfe
data/exe/pr CHANGED
@@ -12,6 +12,12 @@ def error(title)
12
12
  exit 1
13
13
  end
14
14
 
15
+ def confirm(title)
16
+ printf "#{title}\npress 'y' to continue: "
17
+ prompt = STDIN.gets.chomp
18
+ prompt == 'y'
19
+ end
20
+
15
21
  def sh(command)
16
22
  return puts "▶️ #{command}" if @simulate
17
23
 
@@ -22,7 +28,11 @@ def sh_get(command)
22
28
  value = `#{command}`
23
29
  error "could not execute '#{command}'" unless $? == 0
24
30
 
25
- value
31
+ value.strip
32
+ end
33
+
34
+ def current_branch
35
+ sh_get "git rev-parse --abbrev-ref HEAD"
26
36
  end
27
37
 
28
38
  OptionParser.new do |opts|
@@ -53,6 +63,9 @@ title += "\n\nfixes ##{@issue_number}" if @issue_number
53
63
  branch = "feature/"
54
64
  branch += "#{@issue_number}_" if @issue_number
55
65
  branch += name.parameterize.underscore
66
+ base_branch = current_branch
67
+
68
+ 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?")
56
69
 
57
70
  puts "Creating new PR for feature '#{title}'"
58
71
 
@@ -66,4 +79,4 @@ puts "Pushing to origin"
66
79
  sh "git push -u origin #{branch}"
67
80
 
68
81
  puts "Creating pull request"
69
- sh "hub pull-request -d -m '#{title}'"
82
+ sh "hub pull-request -d -m '#{title}' -b #{base_branch}"
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "pull-request"
4
- spec.version = "0.3.0"
4
+ spec.version = "0.4.0"
5
5
  spec.authors = ["Jens Ravens", "David Dufour-Boivin"]
6
6
  spec.email = ["jens@nerdgeschoss.de", "david@nerdgeschoss.de"]
7
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pull-request
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Ravens
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-08-10 00:00:00.000000000 Z
12
+ date: 2020-09-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport