jive 0.3.0 → 0.4.1

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: bb4eb9f7fb9d9ff62d257c2ed146acd462cb2c4db1b07a4a3cc0a43399ce1073
4
- data.tar.gz: bb87b75d4635bc12169def9878ab89c7822df1497cd2a39a7aa209c8d8e01489
3
+ metadata.gz: fddf38d8a9e9a26f7e44618178a02bcdb40c23653b89be08bc25ddc1ba32171e
4
+ data.tar.gz: 0f1bf89c4f67e8ff776473384802de77548ad675dc4b305552ecc62b0ce3cd6c
5
5
  SHA512:
6
- metadata.gz: 7d72ccd8285b0726e1465f6caec69dfddec99b0a9b60594da5de94e4dc898356e009d4e924ec9ae863396e2f4fa2cefa2b912793ae69424c345443de16406ed2
7
- data.tar.gz: 625c5dc105d2b53c9d9d7a6173761523439ea506dee48dc895252e4392b399a1c5b7d274a5f4bac1cffbdf72661f8c663f561c3ab4b5790f82d3c2b5df81b10c
6
+ metadata.gz: 113ec6a22efdae9d7ca05c1d4aee4d25f8e368e5aa94a1607cd7edbdd9ff1c5cb1acfb0cdcdaa393837cb8f0f236d28c06ed49e3276e188e4f41ede3fb7a3153
7
+ data.tar.gz: 1515f6c8a46c26465f3315c2082adbc5d4c973d2146e73eb854208ca9564e832ef481bc5b037f570bdc6f14915c62a319beb6e1d873bcd1635be1b0634a55914
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,11 +2,14 @@
2
2
 
3
3
  require "fileutils"
4
4
  require "open3"
5
+ require "uri"
5
6
 
6
7
  require "jive/batch_runner"
8
+ require "jive/docker"
7
9
  require "jive/git"
8
10
  require "jive/popen"
9
11
  require "jive/project"
12
+ require "jive/pull_request"
10
13
  require "jive/runner"
11
14
  require "jive/shell"
12
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
+ # Pull Request Template
2
+
3
+ ## Why is this needed?
4
+
5
+ ## What does this do?
6
+
7
+ <!--
8
+ Include a summary of the change and which issue is fixed.
9
+ Include relevant motivation and context.
10
+ List any dependencies that are required for this change.
11
+ -->
12
+
13
+ Fixes # (issue)
14
+
15
+ ### Screenshots
16
+
17
+ Before:
18
+
19
+ ![before]()
20
+
21
+ After:
22
+
23
+ ![after]()
24
+
25
+ ## Type of change
26
+
27
+ Delete options that are not relevant.
28
+
29
+ - [ ] Bug fix (non-breaking change which fixes an issue)
30
+ - [ ] New feature (non-breaking change which adds functionality)
31
+ - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
32
+ - [ ] This change requires a documentation update
33
+
34
+ ## Verification Plan
35
+
36
+ How are we going to verify this change?
37
+
38
+ - [ ] Step 1
39
+ - [ ] Step 2
40
+
41
+ ## Checklist
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
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.0"
4
+ VERSION = "0.4.1"
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.0
4
+ version: 0.4.1
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: