jive 0.3.1 → 0.3.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: a1a0eb369a76682bb73ee520c153849ae1f5ff78f8c84abf0fe23080b8caac7b
4
+ data.tar.gz: 183fd8c860a0954e653068edb23ebfc671b3972f0d5c25bfb163d2654e3d922a
5
5
  SHA512:
6
- metadata.gz: 5ce9925f98dead85a9e9e2b05fd21983afca43ff2b238d429f8ba1d04151faa2010aa1d22297ad9c9a7c1325f702048ac8895ce166f0d7caadf1f21bb8003e70
7
- data.tar.gz: 20afe1c128dd85aa8476995aff3c0a794fd57ebbdfd06e4ef5b40a0fc01cf5577d29e1ab2b699123281ca082d59d74f5d61effa4d2b8060bfdff1f612fc08e52
6
+ metadata.gz: e8dd33702a370ee56601a4a214069c3e174fbaad4d69982c8f47a426f9f9a462035fd978220ff874a7372f98482a6530ef7dd04ea1eeb556918aca508bff834b
7
+ data.tar.gz: f5c561f300d13bd795690240365f51468ed0d2e1d2ab2f42733b026a19fc319f919d33aeaaa8e18a9b83dc547677f06952ffbca79dcf0e404bca15bf1d68e529
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.
44
+ say Git.new.semantic_help
45
+ end
55
46
 
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
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")
data/lib/jive/git.rb CHANGED
@@ -4,23 +4,23 @@ 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
14
  shell.run_each([
15
15
  [:mkdir, "-p", dir.parent.to_s],
16
- [:git, "clone", "git@github.com:#{slug}.git", dir]
16
+ [:git, "clone", "git@#{host}:#{slug}", dir]
17
17
  ])
18
18
  end
19
- cd(slug)
19
+ cd(slug, host: host)
20
20
  end
21
21
 
22
- def cd(slug)
23
- dir = target_dir_for(slug)
22
+ def cd(slug, host: "github.com")
23
+ dir = target_dir_for(slug, host: host)
24
24
  if dir.exist?
25
25
  shell.after_run([
26
26
  ["cd", dir],
@@ -31,10 +31,33 @@ module Jive
31
31
  end
32
32
  end
33
33
 
34
+ def semantic_help
35
+ <<~MESSAGE
36
+ Format: <type>(<scope>): <subject>
37
+
38
+ <scope> is optional
39
+
40
+ feat: add hat wobble
41
+ ^--^ ^------------^
42
+ | |
43
+ | +-> Summary in present tense.
44
+ |
45
+ +-------> Type: chore, docs, feat, fix, refactor, style, or test.
46
+
47
+ chore: updating grunt tasks etc; no production code change
48
+ docs: changes to the documentation
49
+ feat: new feature for the user, not a new feature for build script
50
+ fix: bug fix for the user, not a fix to a build script
51
+ refactor: refactoring production code, eg. renaming a variable
52
+ style: formatting, missing semi colons, etc; no production code change
53
+ test: adding missing tests, refactoring tests; no production code change
54
+ MESSAGE
55
+ end
56
+
34
57
  private
35
58
 
36
- def target_dir_for(slug)
37
- Pathname.new(Dir.home).join("src/github.com/#{slug}")
59
+ def target_dir_for(slug, host:)
60
+ Pathname.new(Dir.home).join("src/#{host}/#{slug}")
38
61
  end
39
62
  end
40
63
  end
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.3.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo khan