Class: Gitolite::Git::FileAccess
- Defined in:
- lib/gitolite/grit/file_access.rb
Constant Summary
Constants inherited from Adapter
Adapter::DEFAULT_BRANCH, Adapter::Git_command__push_mutex
Instance Method Summary collapse
- #add_file(file_rel_path, content) ⇒ Object
- #commit(commit_msg) ⇒ Object
- #remove_file(file_rel_path) ⇒ Object
Methods inherited from Adapter
#branches, #file_content, #initialize, #ls_r, #path_exists?, #pull, #push, #push_to_mirror_repo
Constructor Details
This class inherits a constructor from Gitolite::Git::Adapter
Instance Method Details
#add_file(file_rel_path, content) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/gitolite/grit/file_access.rb', line 5 def add_file(file_rel_path,content) content ||= String.new file_path = qualified_path(file_rel_path) chdir_and_checkout do File.open(file_path,"w"){|f|f << content} git_command(:add,file_path) end end |
#commit(commit_msg) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/gitolite/grit/file_access.rb', line 23 def commit(commit_msg) #TODO is chdir_and_checkout needed chdir_and_checkout do @grit_repo.commit_index(commit_msg) end end |
#remove_file(file_rel_path) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/gitolite/grit/file_access.rb', line 14 def remove_file(file_rel_path) file_path = qualified_path(file_rel_path) chdir_and_checkout do if File.file?(file_path) git_command(:rm,file_path) end end end |