jive 0.4.1 → 0.6.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/exe/jive +10 -1
- data/jive.gemspec +2 -0
- data/jive.sh +4 -0
- data/lib/jive.rb +17 -0
- data/lib/jive/cli.rb +20 -3
- data/lib/jive/git.rb +1 -0
- data/lib/jive/issue.rb +67 -0
- data/lib/jive/pull_request.rb +3 -4
- data/lib/jive/repo.rb +59 -0
- data/lib/jive/shell.rb +1 -1
- data/lib/jive/templates/bug.md +45 -0
- data/lib/jive/templates/feature.md +49 -0
- data/lib/jive/templates/{pull_request_template.md → pull_request.md} +17 -17
- data/lib/jive/version.rb +1 -1
- metadata +36 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e2c1ab6f78c5ed071fde65c73d5f6237de8563e07ed5be37553ad12481d0d3e
|
4
|
+
data.tar.gz: 7b7dfb21f093ef2d822100f3e4b678f1b1483043e7777658eb3049d6833fade0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2411bbb13f2a29c6b6491e2a8424426f1406df40761fd82394f13a06f225a1406eb060e889fb11fdd6573dd7df49c74a0237b76b5186f42b884faed54a70e786
|
7
|
+
data.tar.gz: 3a9ccc541687fe4da594ea0ea421d76b4524203d246c8cf6b5ba8654189a082a980ac39001c12206f42a94ed7a2caf2af65ed1a922c330c430035ee1eb4728a2
|
data/exe/jive
CHANGED
data/jive.gemspec
CHANGED
@@ -30,6 +30,8 @@ Gem::Specification.new do |spec|
|
|
30
30
|
$ jive setup
|
31
31
|
MESSAGE
|
32
32
|
|
33
|
+
spec.add_dependency "cli-ui", "~> 1.5"
|
34
|
+
spec.add_dependency "rugged", "~> 1.1"
|
33
35
|
spec.add_dependency "thor", "~> 1.1"
|
34
36
|
spec.add_development_dependency "minitest", "~> 5.0"
|
35
37
|
spec.add_development_dependency "rake", "~> 13.0"
|
data/jive.sh
CHANGED
data/lib/jive.rb
CHANGED
@@ -2,14 +2,17 @@
|
|
2
2
|
|
3
3
|
require "fileutils"
|
4
4
|
require "open3"
|
5
|
+
require "rugged"
|
5
6
|
require "uri"
|
6
7
|
|
7
8
|
require "jive/batch_runner"
|
8
9
|
require "jive/docker"
|
9
10
|
require "jive/git"
|
11
|
+
require "jive/issue"
|
10
12
|
require "jive/popen"
|
11
13
|
require "jive/project"
|
12
14
|
require "jive/pull_request"
|
15
|
+
require "jive/repo"
|
13
16
|
require "jive/runner"
|
14
17
|
require "jive/shell"
|
15
18
|
require "jive/version"
|
@@ -28,4 +31,18 @@ module Jive
|
|
28
31
|
def self.shell
|
29
32
|
@shell ||= ::Jive::Shell.new
|
30
33
|
end
|
34
|
+
|
35
|
+
def self.home
|
36
|
+
@home ||= Pathname(Dir.home).join(".jive")
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.prompt?(items, display: ->(x) { x })
|
40
|
+
CLI::UI::Prompt.ask("Choose?") do |handler|
|
41
|
+
items.each do |item|
|
42
|
+
handler.option(display.call(item)) do |_selection|
|
43
|
+
return item
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
31
48
|
end
|
data/lib/jive/cli.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "cli/ui"
|
3
4
|
require "pathname"
|
4
5
|
require "thor"
|
5
6
|
require "yaml"
|
@@ -52,6 +53,22 @@ module Jive
|
|
52
53
|
end
|
53
54
|
end)
|
54
55
|
|
56
|
+
desc "issue SUBCOMMAND ...ARGS", "issue things"
|
57
|
+
subcommand "issue", (Class.new(Thor) do
|
58
|
+
desc "list <type>", "List the issues"
|
59
|
+
def list(type = Issue.what_type?)
|
60
|
+
issues = Issue.for(type)
|
61
|
+
issue = Jive.prompt?(issues, display: ->(x) { x.file_name })
|
62
|
+
issue.edit
|
63
|
+
end
|
64
|
+
|
65
|
+
desc "create <type>", "Create a new issue"
|
66
|
+
def create(type = Issue.what_type?)
|
67
|
+
issue = Issue.create!(name: ask("Name:"), type: type)
|
68
|
+
issue.edit
|
69
|
+
end
|
70
|
+
end)
|
71
|
+
|
55
72
|
desc "cd <org>/<project>", "cd to ~/src/github.com/<org>/<project>"
|
56
73
|
def cd(slug)
|
57
74
|
Jive.shell.run_safely { Git.new(Jive.shell).cd(slug) }
|
@@ -74,9 +91,9 @@ module Jive
|
|
74
91
|
.bootstrap(Jive.shell)
|
75
92
|
end
|
76
93
|
|
77
|
-
desc "pr
|
78
|
-
def pr
|
79
|
-
pr = PullRequest.new(
|
94
|
+
desc "pr", "pull request"
|
95
|
+
def pr
|
96
|
+
pr = PullRequest.new(repo: Repo.current)
|
80
97
|
pr.edit(ENV["EDITOR"])
|
81
98
|
end
|
82
99
|
|
data/lib/jive/git.rb
CHANGED
data/lib/jive/issue.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jive
|
4
|
+
class Issue
|
5
|
+
class << self
|
6
|
+
def what_type?
|
7
|
+
Jive.prompt?(
|
8
|
+
Jive.root
|
9
|
+
.join("lib/jive/templates")
|
10
|
+
.glob("*.md")
|
11
|
+
.map { |x| x.basename.to_s.gsub(".md", "") }
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
def create!(name:, type:, repo: Repo.current)
|
16
|
+
new(repo: repo, name: name, type: type)
|
17
|
+
end
|
18
|
+
|
19
|
+
def for(type, repo: Repo.current)
|
20
|
+
dir_for(type, repo: repo).glob("*.md").map do |x|
|
21
|
+
name = x.basename.to_s.gsub(".md", "")
|
22
|
+
new(repo: repo, name: name, type: type)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def dir_for(type, repo: Repo.current)
|
27
|
+
Jive.home
|
28
|
+
.join(repo.uri.host)
|
29
|
+
.join(repo.nwo)
|
30
|
+
.join(type)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def initialize(name:, type:, repo: Repo.current)
|
35
|
+
@repo = repo
|
36
|
+
@type = type
|
37
|
+
@name = name
|
38
|
+
end
|
39
|
+
|
40
|
+
def file_name
|
41
|
+
"#{name.gsub(/[^a-z0-9\-_]+/i, "-").downcase}.md"
|
42
|
+
end
|
43
|
+
|
44
|
+
def edit(editor: ENV["EDITOR"])
|
45
|
+
Jive.shell.execute([editor, issue.to_s])
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
attr_reader :repo, :name, :type
|
51
|
+
|
52
|
+
def issue
|
53
|
+
@issue ||=
|
54
|
+
begin
|
55
|
+
dir = self.class.dir_for(type, repo: repo)
|
56
|
+
Jive.shell.execute([:mkdir, "-p", dir])
|
57
|
+
dir.join(file_name).tap do |file|
|
58
|
+
file.write(template_for(type).read) unless file.exist?
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def template_for(type)
|
64
|
+
Jive.root.join("lib/jive/templates/#{type}.md")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/lib/jive/pull_request.rb
CHANGED
@@ -4,9 +4,8 @@ module Jive
|
|
4
4
|
class PullRequest
|
5
5
|
attr_reader :dir, :uri
|
6
6
|
|
7
|
-
def initialize(
|
8
|
-
@
|
9
|
-
@dir = Pathname(Dir.home).join(".jive").join(uri.host).join(uri.path[1..-1])
|
7
|
+
def initialize(repo: Repo.current)
|
8
|
+
@dir = Jive.home.join(repo.uri.host).join(repo.branch)
|
10
9
|
Jive.shell.execute([:mkdir, "-p", @dir]) unless @dir.exist?
|
11
10
|
end
|
12
11
|
|
@@ -17,7 +16,7 @@ module Jive
|
|
17
16
|
private
|
18
17
|
|
19
18
|
def template
|
20
|
-
Jive.root.join("lib/jive/templates/
|
19
|
+
Jive.root.join("lib/jive/templates/pull_request.md")
|
21
20
|
end
|
22
21
|
|
23
22
|
def readme
|
data/lib/jive/repo.rb
ADDED
@@ -0,0 +1,59 @@
|
|
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 uri
|
12
|
+
@uri ||= URI.parse(canonical_url)
|
13
|
+
end
|
14
|
+
|
15
|
+
def canonical_url
|
16
|
+
remote = @repo.remotes.find { |x| x.name == "origin" }
|
17
|
+
return if remote.nil?
|
18
|
+
|
19
|
+
ssh?(remote) ? url_for_ssh(remote) : url_for(remote)
|
20
|
+
end
|
21
|
+
|
22
|
+
def nwo
|
23
|
+
segments = uri.path.split("/")
|
24
|
+
"#{segments[1]}/#{segments[2].gsub(".git", "")}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def branch
|
28
|
+
uri.path[1..-1]
|
29
|
+
end
|
30
|
+
|
31
|
+
class << self
|
32
|
+
def current
|
33
|
+
@current ||= new(Pathname.pwd)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def ssh?(remote)
|
40
|
+
remote.url.match?(SSH_REGEX)
|
41
|
+
end
|
42
|
+
|
43
|
+
def url_for_ssh(remote)
|
44
|
+
match = remote.url.match(SSH_REGEX)
|
45
|
+
[
|
46
|
+
"https:/",
|
47
|
+
match[:host],
|
48
|
+
match[:account],
|
49
|
+
match[:repo],
|
50
|
+
@repo.head.name
|
51
|
+
].join("/")
|
52
|
+
end
|
53
|
+
|
54
|
+
def url_for(remote)
|
55
|
+
uri = URI.parse(remote.url)
|
56
|
+
[uri.host, uri.path, @repo.head.name].join("/")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/jive/shell.rb
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
title: "Defect Template"
|
3
|
+
description: |
|
4
|
+
---
|
5
|
+
|
6
|
+
### Summary
|
7
|
+
|
8
|
+
<!-- Summarize the defect encountered concisely. -->
|
9
|
+
|
10
|
+
### Steps to reproduce
|
11
|
+
|
12
|
+
<!--
|
13
|
+
Describe how one can reproduce the issue - this is very important.
|
14
|
+
Please use an ordered list.
|
15
|
+
-->
|
16
|
+
|
17
|
+
### Example Project
|
18
|
+
|
19
|
+
<!--
|
20
|
+
Please create an example project here on GitHub.com that exhibits the problematic
|
21
|
+
behavior, and link to it here in the bug report.
|
22
|
+
|
23
|
+
If you are using an older version of GitHub.com,
|
24
|
+
this will also determine whether the bug is fixed
|
25
|
+
in a more recent version.
|
26
|
+
-->
|
27
|
+
|
28
|
+
### What is the current *bug* behavior?
|
29
|
+
|
30
|
+
<!-- Describe what actually happens. -->
|
31
|
+
|
32
|
+
### What is the expected *correct* behavior?
|
33
|
+
|
34
|
+
<!-- Describe what you should see instead. -->
|
35
|
+
|
36
|
+
### Relevant logs and/or screenshots
|
37
|
+
|
38
|
+
<!--
|
39
|
+
Paste any relevant logs - please use code blocks (```) to format console output,
|
40
|
+
logs, and code.
|
41
|
+
-->
|
42
|
+
|
43
|
+
### Possible fixes
|
44
|
+
|
45
|
+
<!-- If you can, link to the line of code that might be responsible for the problem. -->
|
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
title: "Feature Template"
|
3
|
+
description: |
|
4
|
+
This is used to break-up a large piece of work into smaller,
|
5
|
+
discrete tasks that can move independently through the build workflow steps.
|
6
|
+
---
|
7
|
+
|
8
|
+
As a `[persona]`, I `[want to]`, so that `[goal]`.
|
9
|
+
|
10
|
+
# Why are we doing this work?
|
11
|
+
|
12
|
+
<!--
|
13
|
+
A brief explanation of the why, not the what or how.
|
14
|
+
Assume the reader doesn't know the background and won't have time to dig-up
|
15
|
+
information from comment threads.
|
16
|
+
-->
|
17
|
+
|
18
|
+
# Tasks
|
19
|
+
|
20
|
+
<!--
|
21
|
+
Steps and the parts of the code that will need to get updated.
|
22
|
+
The plan can also call-out responsibilities for other team members or teams.
|
23
|
+
|
24
|
+
e.g.:
|
25
|
+
|
26
|
+
- [ ] ~frontend Step 1
|
27
|
+
- [ ] `@person` Step 1a
|
28
|
+
- [ ] ~frontend Step 2
|
29
|
+
- [ ] ~backend Step 3
|
30
|
+
-->
|
31
|
+
|
32
|
+
# Relevant links
|
33
|
+
|
34
|
+
<!--
|
35
|
+
Information that developers might need to refer to when implementing the issue.
|
36
|
+
|
37
|
+
- [Design Issue](https://github.com/xlgmokha/project/issues/<id>)
|
38
|
+
- [Similar implementation](https://github.com/xlgmokha/project/pull/<id>)
|
39
|
+
-->
|
40
|
+
|
41
|
+
# Non-functional requirements
|
42
|
+
|
43
|
+
<!-- Add details for required items and delete others. -->
|
44
|
+
|
45
|
+
- [ ] Documentation:
|
46
|
+
- [ ] Feature flag:
|
47
|
+
- [ ] Observability:
|
48
|
+
- [ ] Performance:
|
49
|
+
- [ ] Testing:
|
@@ -1,6 +1,15 @@
|
|
1
|
-
|
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
|
+
---
|
2
11
|
|
3
|
-
|
12
|
+
# Why is this needed?
|
4
13
|
|
5
14
|
## What does this do?
|
6
15
|
|
@@ -16,15 +25,15 @@ Fixes # (issue)
|
|
16
25
|
|
17
26
|
Before:
|
18
27
|
|
19
|
-
![before]
|
28
|
+
![Before][before]
|
20
29
|
|
21
30
|
After:
|
22
31
|
|
23
|
-
![after]
|
32
|
+
![After][after]
|
24
33
|
|
25
34
|
## Type of change
|
26
35
|
|
27
|
-
Delete options that are not relevant.
|
36
|
+
<!-- Delete options that are not relevant. -->
|
28
37
|
|
29
38
|
- [ ] Bug fix (non-breaking change which fixes an issue)
|
30
39
|
- [ ] New feature (non-breaking change which adds functionality)
|
@@ -33,19 +42,10 @@ Delete options that are not relevant.
|
|
33
42
|
|
34
43
|
## Verification Plan
|
35
44
|
|
36
|
-
How are we going to verify this change?
|
45
|
+
<!-- How are we going to verify this change? -->
|
37
46
|
|
38
47
|
- [ ] Step 1
|
39
48
|
- [ ] Step 2
|
40
49
|
|
41
|
-
|
42
|
-
|
43
|
-
- [ ] Clear description explaining the relevancy of the contribution.
|
44
|
-
- [ ] Unit, integration, and system tests.
|
45
|
-
- [ ] Regression and bugs are covered with tests.
|
46
|
-
- [ ] [Performance guidelines][performance]
|
47
|
-
- [ ] [Secure coding guidelines][secure]
|
48
|
-
- [ ] Documentation Updated
|
49
|
-
|
50
|
-
[performance]: https://docs.gitlab.com/ee/development/merge_request_performance_guidelines.html
|
51
|
-
[secure]: https://docs.gitlab.com/ee/development/secure_coding_guidelines.html
|
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,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
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-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: cli-ui
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rugged
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.1'
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: thor
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,12 +140,16 @@ files:
|
|
112
140
|
- lib/jive/cli.rb
|
113
141
|
- lib/jive/docker.rb
|
114
142
|
- lib/jive/git.rb
|
143
|
+
- lib/jive/issue.rb
|
115
144
|
- lib/jive/popen.rb
|
116
145
|
- lib/jive/project.rb
|
117
146
|
- lib/jive/pull_request.rb
|
147
|
+
- lib/jive/repo.rb
|
118
148
|
- lib/jive/runner.rb
|
119
149
|
- lib/jive/shell.rb
|
120
|
-
- lib/jive/templates/
|
150
|
+
- lib/jive/templates/bug.md
|
151
|
+
- lib/jive/templates/feature.md
|
152
|
+
- lib/jive/templates/pull_request.md
|
121
153
|
- lib/jive/version.rb
|
122
154
|
homepage: https://rubygems.org/gems/jive
|
123
155
|
licenses:
|
@@ -142,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
174
|
- !ruby/object:Gem::Version
|
143
175
|
version: '0'
|
144
176
|
requirements: []
|
145
|
-
rubygems_version: 3.2.
|
177
|
+
rubygems_version: 3.2.18
|
146
178
|
signing_key:
|
147
179
|
specification_version: 4
|
148
180
|
summary: The art just comes.
|