Class: Gync::Git
- Inherits:
-
Object
- Object
- Gync::Git
- Defined in:
- lib/gync/git.rb
Instance Method Summary collapse
-
#initialize(local_path, remote_path) ⇒ Git
constructor
A new instance of Git.
- #pull ⇒ Object
- #push ⇒ Object
Constructor Details
#initialize(local_path, remote_path) ⇒ Git
Returns a new instance of Git.
3 4 5 |
# File 'lib/gync/git.rb', line 3 def initialize(local_path, remote_path) @local_path, @remote_path = local_path, remote_path end |
Instance Method Details
#pull ⇒ Object
7 8 9 10 11 |
# File 'lib/gync/git.rb', line 7 def pull reopen_repo! @git.fetch @git.merge 'origin/master' end |
#push ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gync/git.rb', line 13 def push reopen_repo! if not changed_files.empty? or not new_files.empty? or not removed_files.empty? @git.add changed_files unless changed_files.empty? @git.add new_files unless new_files.empty? @git.remove removed_files unless removed_files.empty? @git.commit commit_msg @git.push "origin", "master" end end |