jive 0.3.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5961fce0c728aa39eab542b868af002e6c42dd96f9d998ed74ac27b73400c1d8
4
- data.tar.gz: 6098d75167c508beba3eea6067caa5ada3d161d08bc328cfef0bf7d48400c8d0
3
+ metadata.gz: 55a6067dfc91fe18fb853a027e5a28aa0a909bc7cbd1dc453c56ddb307ab8411
4
+ data.tar.gz: a0f68946959c4ae2943d4d44b39b716aa1ec38862c6f0abce5b05aec66f14597
5
5
  SHA512:
6
- metadata.gz: 5ce9925f98dead85a9e9e2b05fd21983afca43ff2b238d429f8ba1d04151faa2010aa1d22297ad9c9a7c1325f702048ac8895ce166f0d7caadf1f21bb8003e70
7
- data.tar.gz: 20afe1c128dd85aa8476995aff3c0a794fd57ebbdfd06e4ef5b40a0fc01cf5577d29e1ab2b699123281ca082d59d74f5d61effa4d2b8060bfdff1f612fc08e52
6
+ metadata.gz: 5d50d52dee2df5ea73c53bcf966add65945e5b52fb4e0deec97cf3536c0681099338dc301a53042597a4c0a902eb0514b1d546a49f2b31744a0e571a2f262668
7
+ data.tar.gz: 85f476b26a46f30f9335a2cadbc03af39b598f82a26504aaa83f82cf6dabc9231d30d7502b9f2747a0d9e8becdfb6a939ba2be1a648e2c3be410b3e1aa9b1ec8
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Build Status](https://github.com/xlgmokha/jive/workflows/ci/badge.svg)](https://github.com/xlgmokha/jive/actions)
4
4
 
5
- Hi!
5
+ 🐕 Woof!
6
6
 
7
7
  ## Installation
8
8
 
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"]
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 <<~MESSAGE
45
- Format: <type>(<scope>): <subject>
46
-
47
- <scope> is optional
48
-
49
- feat: add hat wobble
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.run_each([
15
- [:mkdir, "-p", dir.parent.to_s],
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/github.com/#{slug}")
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jive
4
- VERSION = "0.3.1"
4
+ VERSION = "0.4.2"
5
5
  end
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.3.1
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-07 00:00:00.000000000 Z
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: