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, #file_content_and_size, #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
24 25 26 27 28 29 30 31 |
# File 'lib/gitolite/grit/file_access.rb', line 24 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
42 43 44 45 46 47 |
# File 'lib/gitolite/grit/file_access.rb', line 42 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
33 34 35 36 37 38 39 40 |
# File 'lib/gitolite/grit/file_access.rb', line 33 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 |