Class: Jive::Git
- Inherits:
-
Object
- Object
- Jive::Git
- Defined in:
- lib/jive/git.rb
Instance Attribute Summary collapse
-
#shell ⇒ Object
readonly
Returns the value of attribute shell.
Instance Method Summary collapse
- #cd(slug, host: "github.com") ⇒ Object
- #clone(slug, host: "github.com") ⇒ Object
-
#initialize(shell = ::Jive.shell) ⇒ Git
constructor
A new instance of Git.
- #semantic_help ⇒ Object
Constructor Details
#initialize(shell = ::Jive.shell) ⇒ Git
7 8 9 |
# File 'lib/jive/git.rb', line 7 def initialize(shell = ::Jive.shell) @shell = shell end |
Instance Attribute Details
#shell ⇒ Object (readonly)
Returns the value of attribute shell.
5 6 7 |
# File 'lib/jive/git.rb', line 5 def shell @shell end |
Instance Method Details
#cd(slug, host: "github.com") ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# 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") ⇒ Object
11 12 13 14 15 16 17 18 |
# 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 ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/jive/git.rb', line 33 def semantic_help " Format: <type>(<scope>): <subject>\n\n <scope> is optional\n\n feat: add hat wobble\n ^--^ ^------------^\n | |\n | +-> Summary in present tense.\n |\n +-------> Type: chore, docs, feat, fix, refactor, style, or test.\n\n chore: updating grunt tasks etc; no production code change\n docs: changes to the documentation\n feat: new feature for the user, not a new feature for build script\n fix: bug fix for the user, not a fix to a build script\n refactor: refactoring production code, eg. renaming a variable\n style: formatting, missing semi colons, etc; no production code change\n test: adding missing tests, refactoring tests; no production code change\n MESSAGE\nend\n" |