jive 0.3.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/jive.gemspec +2 -1
- data/lib/jive.rb +4 -0
- data/lib/jive/cli.rb +8 -0
- data/lib/jive/pull_request.rb +32 -0
- data/lib/jive/repo.rb +46 -0
- data/lib/jive/shell.rb +1 -1
- data/lib/jive/templates/pull_request_template.md +51 -0
- data/lib/jive/version.rb +1 -1
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a034483cc87f821d9da5acd3205a179fbbcc28a9f91b8ef491e9e95802272d2f
|
4
|
+
data.tar.gz: 30712e04895db03f07c1ea07d784a7f0ca39f6ecd7e6b8cf8fcb455e97f6f23f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53f26b41d34b6e58f68aac53a4618daddba1380a7d8a0e1f5c1cf3b1f0ea9401d4d0ef04a66ea67c6e6d5ef924bf8aa75099f43f0a9c17002266d42e2384f385
|
7
|
+
data.tar.gz: 3815d23eb9aee2d09fda3784e7bd0f35f0721648b14a3e266f6c5606747efe21049425553f20017730d7eb345da3b5e507f882fae75fd4231251ad12f9d6a8ee
|
data/README.md
CHANGED
data/jive.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
"README.md",
|
21
21
|
"jive.gemspec",
|
22
22
|
"jive.sh"
|
23
|
-
]
|
23
|
+
] + Dir["lib/**/templates/*.md"]
|
24
24
|
spec.bindir = "exe"
|
25
25
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
26
26
|
spec.require_paths = ["lib"]
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
$ jive setup
|
31
31
|
MESSAGE
|
32
32
|
|
33
|
+
spec.add_dependency "rugged", "~> 1.1"
|
33
34
|
spec.add_dependency "thor", "~> 1.1"
|
34
35
|
spec.add_development_dependency "minitest", "~> 5.0"
|
35
36
|
spec.add_development_dependency "rake", "~> 13.0"
|
data/lib/jive.rb
CHANGED
@@ -2,12 +2,16 @@
|
|
2
2
|
|
3
3
|
require "fileutils"
|
4
4
|
require "open3"
|
5
|
+
require "rugged"
|
6
|
+
require "uri"
|
5
7
|
|
6
8
|
require "jive/batch_runner"
|
7
9
|
require "jive/docker"
|
8
10
|
require "jive/git"
|
9
11
|
require "jive/popen"
|
10
12
|
require "jive/project"
|
13
|
+
require "jive/pull_request"
|
14
|
+
require "jive/repo"
|
11
15
|
require "jive/runner"
|
12
16
|
require "jive/shell"
|
13
17
|
require "jive/version"
|
data/lib/jive/cli.rb
CHANGED
@@ -74,6 +74,14 @@ module Jive
|
|
74
74
|
.bootstrap(Jive.shell)
|
75
75
|
end
|
76
76
|
|
77
|
+
desc "pr URL", "pull request"
|
78
|
+
def pr(url = Repo.current.canonical_url)
|
79
|
+
return say("Invalid url") && exit(1) unless url
|
80
|
+
|
81
|
+
pr = PullRequest.new(url)
|
82
|
+
pr.edit(ENV["EDITOR"])
|
83
|
+
end
|
84
|
+
|
77
85
|
desc "setup", "provide instructions to integrate into shell"
|
78
86
|
def setup
|
79
87
|
print "source #{::Jive.root.join("jive.sh")}"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jive
|
4
|
+
class PullRequest
|
5
|
+
attr_reader :dir, :uri
|
6
|
+
|
7
|
+
def initialize(url)
|
8
|
+
@uri = URI.parse(url)
|
9
|
+
@dir = Pathname(Dir.home).join(".jive").join(uri.host).join(uri.path[1..-1])
|
10
|
+
Jive.shell.execute([:mkdir, "-p", @dir]) unless @dir.exist?
|
11
|
+
end
|
12
|
+
|
13
|
+
def edit(editor)
|
14
|
+
Jive.shell.execute([editor, readme.to_s])
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def template
|
20
|
+
Jive.root.join("lib/jive/templates/pull_request_template.md")
|
21
|
+
end
|
22
|
+
|
23
|
+
def readme
|
24
|
+
@readme ||=
|
25
|
+
begin
|
26
|
+
dir.join("README.md").tap do |readme|
|
27
|
+
readme.write(template.read) unless readme.exist?
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/jive/repo.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jive
|
4
|
+
class Repo
|
5
|
+
SSH_REGEX = %r{\Agit@(?<host>.+):(?<account>.+)/(?<repo>.+)\z}.freeze
|
6
|
+
|
7
|
+
def initialize(path)
|
8
|
+
@repo = Rugged::Repository.new(path.to_s)
|
9
|
+
end
|
10
|
+
|
11
|
+
def canonical_url
|
12
|
+
remote = @repo.remotes.find { |x| x.name == "origin" }
|
13
|
+
return if remote.nil?
|
14
|
+
|
15
|
+
ssh?(remote) ? url_for_ssh(remote) : url_for(remote)
|
16
|
+
end
|
17
|
+
|
18
|
+
class << self
|
19
|
+
def current
|
20
|
+
@current ||= new(Pathname.pwd)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def ssh?(remote)
|
27
|
+
remote.url.match?(SSH_REGEX)
|
28
|
+
end
|
29
|
+
|
30
|
+
def url_for_ssh(remote)
|
31
|
+
match = remote.url.match(SSH_REGEX)
|
32
|
+
[
|
33
|
+
"https:/",
|
34
|
+
match[:host],
|
35
|
+
match[:account],
|
36
|
+
match[:repo],
|
37
|
+
@repo.head.name
|
38
|
+
].join("/")
|
39
|
+
end
|
40
|
+
|
41
|
+
def url_for(remote)
|
42
|
+
uri = URI.parse(remote.url)
|
43
|
+
[uri.host, uri.path, @repo.head.name].join("/")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/jive/shell.rb
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
---
|
2
|
+
title: "Pull Request Template"
|
3
|
+
checklist:
|
4
|
+
- [ ] Clear description explaining the relevancy of the contribution.
|
5
|
+
- [ ] Unit, integration, and system tests.
|
6
|
+
- [ ] Regression and bugs are covered with tests.
|
7
|
+
- [ ] [Performance guidelines](https://docs.gitlab.com/ee/development/merge_request_performance_guidelines.html)
|
8
|
+
- [ ] [Secure coding guidelines](https://docs.gitlab.com/ee/development/secure_coding_guidelines.html)
|
9
|
+
- [ ] Documentation Updated
|
10
|
+
---
|
11
|
+
|
12
|
+
# Why is this needed?
|
13
|
+
|
14
|
+
## What does this do?
|
15
|
+
|
16
|
+
<!--
|
17
|
+
Include a summary of the change and which issue is fixed.
|
18
|
+
Include relevant motivation and context.
|
19
|
+
List any dependencies that are required for this change.
|
20
|
+
-->
|
21
|
+
|
22
|
+
Fixes # (issue)
|
23
|
+
|
24
|
+
### Screenshots
|
25
|
+
|
26
|
+
Before:
|
27
|
+
|
28
|
+
![Before][before]
|
29
|
+
|
30
|
+
After:
|
31
|
+
|
32
|
+
![After][after]
|
33
|
+
|
34
|
+
## Type of change
|
35
|
+
|
36
|
+
<!-- Delete options that are not relevant. -->
|
37
|
+
|
38
|
+
- [ ] Bug fix (non-breaking change which fixes an issue)
|
39
|
+
- [ ] New feature (non-breaking change which adds functionality)
|
40
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
41
|
+
- [ ] This change requires a documentation update
|
42
|
+
|
43
|
+
## Verification Plan
|
44
|
+
|
45
|
+
<!-- How are we going to verify this change? -->
|
46
|
+
|
47
|
+
- [ ] Step 1
|
48
|
+
- [ ] Step 2
|
49
|
+
|
50
|
+
[after]: https://user-images.githubusercontent.com/x/y.png
|
51
|
+
[before]: https://user-images.githubusercontent.com/x/y.png
|
data/lib/jive/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mo khan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rugged
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.1'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: thor
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,8 +128,11 @@ files:
|
|
114
128
|
- lib/jive/git.rb
|
115
129
|
- lib/jive/popen.rb
|
116
130
|
- lib/jive/project.rb
|
131
|
+
- lib/jive/pull_request.rb
|
132
|
+
- lib/jive/repo.rb
|
117
133
|
- lib/jive/runner.rb
|
118
134
|
- lib/jive/shell.rb
|
135
|
+
- lib/jive/templates/pull_request_template.md
|
119
136
|
- lib/jive/version.rb
|
120
137
|
homepage: https://rubygems.org/gems/jive
|
121
138
|
licenses:
|