Class: ActiveRepo
Instance Attribute Summary
Attributes inherited from Repo
#shell
Instance Method Summary
collapse
Methods inherited from Repo
#changed?, #current_branch, #find_files, #grep, #initialize, root_dir, #status_files
Constructor Details
This class inherits a constructor from Repo
Instance Method Details
#fetch_origin ⇒ Object
47
48
49
|
# File 'lib/active_repo.rb', line 47
def fetch_origin
shell.run 'git fetch origin'
end
|
#files_changed ⇒ Object
36
37
38
|
# File 'lib/active_repo.rb', line 36
def files_changed
@files_changed
end
|
#move_to_master! ⇒ Object
55
56
57
|
# File 'lib/active_repo.rb', line 55
def move_to_master!
shell.run "git checkout master"
end
|
#pull_origin_master! ⇒ Object
40
41
42
43
44
45
|
# File 'lib/active_repo.rb', line 40
def pull_origin_master!
up do
fetch_origin
reset_hard_origin_master!
end
end
|
#rebase_on_master! ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/active_repo.rb', line 5
def rebase_on_master!
shell.notify "\nRebasing current branch on master:"
up do
begin
shell.run "git pull --rebase origin master"
rescue ShellRunner::CommandFailureError
puts "Unable to rebase. Maybe you need to stash local changes, or there are rebase conflicts"
puts `git status`
exit
end
end
end
|
#reset_hard_origin_master! ⇒ Object
51
52
53
|
# File 'lib/active_repo.rb', line 51
def reset_hard_origin_master!
shell.run "git reset --hard origin/master"
end
|
#set_files_changed(old_sha) ⇒ Object
31
32
33
34
|
# File 'lib/active_repo.rb', line 31
def set_files_changed(old_sha)
shell.notify "\nIdentifying changed files:"
@files_changed = (shell.run "git diff --name-only #{old_sha}").split("\n")
end
|
#up ⇒ Object
24
25
26
27
28
29
|
# File 'lib/active_repo.rb', line 24
def up
old_sha = current_sha
yield
set_files_changed(old_sha)
end
|
#up_master! ⇒ Object
19
20
21
22
|
# File 'lib/active_repo.rb', line 19
def up_master!
move_to_master!
rebase_on_master!
end
|