class Jive::Git
Attributes
shell[R]
Public Class Methods
new(shell = ::Jive.shell)
click to toggle source
# File lib/jive/git.rb, line 7 def initialize(shell = ::Jive.shell) @shell = shell end
Public Instance Methods
cd(slug, host: "github.com")
click to toggle source
# File lib/jive/git.rb, line 20 def cd(slug, host: "github.com") dir = target_dir_for(slug, host: host) if dir.exist? shell.after_run([ ["cd", dir], ["ctags", dir], ["setenv", "JIVE_LAST_RUN=#{Time.now.to_i}"] ]) else clone(slug) end end
clone(slug, host: "github.com")
click to toggle source
# File lib/jive/git.rb, line 11 def clone(slug, host: "github.com") dir = target_dir_for(slug, host: host) unless dir.exist? shell.execute([:mkdir, "-p", dir.parent.to_s]) shell.execute([:git, "clone", "git@#{host}:#{slug}", dir]) end cd(slug, host: host) if dir.exist? end
semantic_help()
click to toggle source
# File lib/jive/git.rb, line 33 def semantic_help <<~MESSAGE Format: <type>(<scope>): <subject> <scope> is optional feat: add hat wobble ^--^ ^------------^ | | | +-> Summary in present tense. | +-------> Type: chore, docs, feat, fix, refactor, style, or test. chore: updating grunt tasks etc; no production code change docs: changes to the documentation feat: new feature for the user, not a new feature for build script fix: bug fix for the user, not a fix to a build script refactor: refactoring production code, eg. renaming a variable style: formatting, missing semi colons, etc; no production code change test: adding missing tests, refactoring tests; no production code change MESSAGE end
Private Instance Methods
target_dir_for(slug, host:)
click to toggle source
# File lib/jive/git.rb, line 58 def target_dir_for(slug, host:) Pathname.new(Dir.home).join("src/#{host}/#{slug}") end