jive 0.3.1 → 0.4.2
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 +1 -1
- data/jive.gemspec +1 -1
- data/lib/jive.rb +2 -0
- data/lib/jive/cli.rb +14 -25
- data/lib/jive/git.rb +33 -12
- data/lib/jive/pull_request.rb +32 -0
- data/lib/jive/templates/pull_request_template.md +51 -0
- data/lib/jive/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55a6067dfc91fe18fb853a027e5a28aa0a909bc7cbd1dc453c56ddb307ab8411
|
4
|
+
data.tar.gz: a0f68946959c4ae2943d4d44b39b716aa1ec38862c6f0abce5b05aec66f14597
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d50d52dee2df5ea73c53bcf966add65945e5b52fb4e0deec97cf3536c0681099338dc301a53042597a4c0a902eb0514b1d546a49f2b31744a0e571a2f262668
|
7
|
+
data.tar.gz: 85f476b26a46f30f9335a2cadbc03af39b598f82a26504aaa83f82cf6dabc9231d30d7502b9f2747a0d9e8becdfb6a939ba2be1a648e2c3be410b3e1aa9b1ec8
|
data/README.md
CHANGED
data/jive.gemspec
CHANGED
data/lib/jive.rb
CHANGED
@@ -2,12 +2,14 @@
|
|
2
2
|
|
3
3
|
require "fileutils"
|
4
4
|
require "open3"
|
5
|
+
require "uri"
|
5
6
|
|
6
7
|
require "jive/batch_runner"
|
7
8
|
require "jive/docker"
|
8
9
|
require "jive/git"
|
9
10
|
require "jive/popen"
|
10
11
|
require "jive/project"
|
12
|
+
require "jive/pull_request"
|
11
13
|
require "jive/runner"
|
12
14
|
require "jive/shell"
|
13
15
|
require "jive/version"
|
data/lib/jive/cli.rb
CHANGED
@@ -41,26 +41,14 @@ module Jive
|
|
41
41
|
subcommand "git", (Class.new(Thor) do
|
42
42
|
desc "semantic", "Print help for semantic commit messages"
|
43
43
|
def semantic
|
44
|
-
say
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
| +-> Summary in present tense.
|
53
|
-
|
|
54
|
-
+-------> Type: chore, docs, feat, fix, refactor, style, or test.
|
55
|
-
|
56
|
-
chore: updating grunt tasks etc; no production code change
|
57
|
-
docs: changes to the documentation
|
58
|
-
feat: new feature for the user, not a new feature for build script
|
59
|
-
fix: bug fix for the user, not a fix to a build script
|
60
|
-
refactor: refactoring production code, eg. renaming a variable
|
61
|
-
style: formatting, missing semi colons, etc; no production code change
|
62
|
-
test: adding missing tests, refactoring tests; no production code change
|
63
|
-
MESSAGE
|
44
|
+
say Git.new.semantic_help
|
45
|
+
end
|
46
|
+
|
47
|
+
method_option :host, type: :string, default: "github.com"
|
48
|
+
desc "clone <org>/<project>", "git clone to ~/src/github.com/<org>/<project>"
|
49
|
+
def clone(slug)
|
50
|
+
host = options[:host]
|
51
|
+
Jive.shell.run_safely { Git.new(Jive.shell).clone(slug, host: host) }
|
64
52
|
end
|
65
53
|
end)
|
66
54
|
|
@@ -69,11 +57,6 @@ module Jive
|
|
69
57
|
Jive.shell.run_safely { Git.new(Jive.shell).cd(slug) }
|
70
58
|
end
|
71
59
|
|
72
|
-
desc "clone <org>/<project>", "git clone to ~/src/github.com/<org>/<project>"
|
73
|
-
def clone(slug)
|
74
|
-
Jive.shell.run_safely { Git.new(Jive.shell).clone(slug) }
|
75
|
-
end
|
76
|
-
|
77
60
|
desc "exec <command>", "run command from jive.yml"
|
78
61
|
def exec(command)
|
79
62
|
path = Pathname.pwd.join("jive.yml")
|
@@ -91,6 +74,12 @@ module Jive
|
|
91
74
|
.bootstrap(Jive.shell)
|
92
75
|
end
|
93
76
|
|
77
|
+
desc "pr URL", "pull request"
|
78
|
+
def pr(url)
|
79
|
+
pr = PullRequest.new(url)
|
80
|
+
pr.edit(ENV["EDITOR"])
|
81
|
+
end
|
82
|
+
|
94
83
|
desc "setup", "provide instructions to integrate into shell"
|
95
84
|
def setup
|
96
85
|
print "source #{::Jive.root.join("jive.sh")}"
|
data/lib/jive/git.rb
CHANGED
@@ -4,23 +4,21 @@ module Jive
|
|
4
4
|
class Git
|
5
5
|
attr_reader :shell
|
6
6
|
|
7
|
-
def initialize(shell)
|
7
|
+
def initialize(shell = ::Jive.shell)
|
8
8
|
@shell = shell
|
9
9
|
end
|
10
10
|
|
11
|
-
def clone(slug)
|
12
|
-
dir = target_dir_for(slug)
|
11
|
+
def clone(slug, host: "github.com")
|
12
|
+
dir = target_dir_for(slug, host: host)
|
13
13
|
unless dir.exist?
|
14
|
-
shell.
|
15
|
-
|
16
|
-
[:git, "clone", "git@github.com:#{slug}.git", dir]
|
17
|
-
])
|
14
|
+
shell.execute([:mkdir, "-p", dir.parent.to_s])
|
15
|
+
shell.execute([:git, "clone", "git@#{host}:#{slug}", dir])
|
18
16
|
end
|
19
|
-
cd(slug)
|
17
|
+
cd(slug, host: host) if dir.exist?
|
20
18
|
end
|
21
19
|
|
22
|
-
def cd(slug)
|
23
|
-
dir = target_dir_for(slug)
|
20
|
+
def cd(slug, host: "github.com")
|
21
|
+
dir = target_dir_for(slug, host: host)
|
24
22
|
if dir.exist?
|
25
23
|
shell.after_run([
|
26
24
|
["cd", dir],
|
@@ -31,10 +29,33 @@ module Jive
|
|
31
29
|
end
|
32
30
|
end
|
33
31
|
|
32
|
+
def semantic_help
|
33
|
+
<<~MESSAGE
|
34
|
+
Format: <type>(<scope>): <subject>
|
35
|
+
|
36
|
+
<scope> is optional
|
37
|
+
|
38
|
+
feat: add hat wobble
|
39
|
+
^--^ ^------------^
|
40
|
+
| |
|
41
|
+
| +-> Summary in present tense.
|
42
|
+
|
|
43
|
+
+-------> Type: chore, docs, feat, fix, refactor, style, or test.
|
44
|
+
|
45
|
+
chore: updating grunt tasks etc; no production code change
|
46
|
+
docs: changes to the documentation
|
47
|
+
feat: new feature for the user, not a new feature for build script
|
48
|
+
fix: bug fix for the user, not a fix to a build script
|
49
|
+
refactor: refactoring production code, eg. renaming a variable
|
50
|
+
style: formatting, missing semi colons, etc; no production code change
|
51
|
+
test: adding missing tests, refactoring tests; no production code change
|
52
|
+
MESSAGE
|
53
|
+
end
|
54
|
+
|
34
55
|
private
|
35
56
|
|
36
|
-
def target_dir_for(slug)
|
37
|
-
Pathname.new(Dir.home).join("src
|
57
|
+
def target_dir_for(slug, host:)
|
58
|
+
Pathname.new(Dir.home).join("src/#{host}/#{slug}")
|
38
59
|
end
|
39
60
|
end
|
40
61
|
end
|
@@ -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
|
@@ -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,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.2
|
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-02-
|
11
|
+
date: 2021-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -114,8 +114,10 @@ files:
|
|
114
114
|
- lib/jive/git.rb
|
115
115
|
- lib/jive/popen.rb
|
116
116
|
- lib/jive/project.rb
|
117
|
+
- lib/jive/pull_request.rb
|
117
118
|
- lib/jive/runner.rb
|
118
119
|
- lib/jive/shell.rb
|
120
|
+
- lib/jive/templates/pull_request_template.md
|
119
121
|
- lib/jive/version.rb
|
120
122
|
homepage: https://rubygems.org/gems/jive
|
121
123
|
licenses:
|