Module: Jumpup::GitCommand
- Extended by:
- Rake::DSL
- Defined in:
- lib/jumpup/commands/git_command.rb
Class Method Summary collapse
- .check_integration ⇒ Object
- .lock_integration ⇒ Object
- .pull ⇒ Object
- .push ⇒ Object
- .status_check ⇒ Object
- .unlock_integration ⇒ Object
Class Method Details
.check_integration ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/jumpup/commands/git_command.rb', line 23 def check_integration Jumpup::UI.say " --> Checking if there's someone integrating...".yellow Jumpup::UI.say `git tag -d integrating` Jumpup::UI.say `git fetch --tags --quiet` = `git tag`.strip.split("\n") if .include?('integrating') tag_info = `git show integrating` = /Tagger: (.*) <.*>/.match(tag_info)[1] if == user Jumpup::UI.say " --> Project is locked to you ('#{}'), go ahead!".green else Jumpup::UI.say " --> Project is already being integrated by '#{}', halting!".red exit end else Jumpup::UI.say ' --> No, go ahead!'.green end end |
.lock_integration ⇒ Object
43 44 45 46 47 48 |
# File 'lib/jumpup/commands/git_command.rb', line 43 def lock_integration Jumpup::UI.say ' --> Locking integration...'.yellow Jumpup::UI.say `git tag -a -f integrating -m "Integration started at #{Time.now.strftime('%d/%m/%Y %T %Z')}"` Jumpup::UI.say `git push -f origin integrating --quiet` Jumpup::UI.say ' --> OK!'.green end |
.pull ⇒ Object
15 16 17 |
# File 'lib/jumpup/commands/git_command.rb', line 15 def pull sh 'git pull --rebase --quiet' end |
.push ⇒ Object
19 20 21 |
# File 'lib/jumpup/commands/git_command.rb', line 19 def push sh 'git push --quiet' end |
.status_check ⇒ Object
8 9 10 11 12 13 |
# File 'lib/jumpup/commands/git_command.rb', line 8 def status_check result = `git status` return unless result.include?('Untracked files:') || result.include?('unmerged:') || result.include?('modified:') Jumpup::UI.say result exit end |
.unlock_integration ⇒ Object
50 51 52 53 54 55 |
# File 'lib/jumpup/commands/git_command.rb', line 50 def unlock_integration Jumpup::UI.say ' --> Unlocking integration...'.yellow Jumpup::UI.say `git tag -d integrating` Jumpup::UI.say `git push origin :refs/tags/integrating` Jumpup::UI.say ' --> OK!'.green end |