Module: MultiGit::Utils
Defined Under Namespace
Modules: AbstractMethods
Constant Summary collapse
- NULL_OID =
'0'*40
- MODE_SYMLINK =
0120000
- MODE_SUBMODULE =
0160000
- MODE_DIRECTORY =
0040000
- MODE_FILE =
0100644
- MODE_EXECUTEABLE =
0100755
- MODE_TYPES =
{ MODE_SYMLINK => :blob, MODE_SUBMODULE => :commit, MODE_DIRECTORY => :tree, MODE_FILE => :blob, MODE_EXECUTEABLE => :blob }
- DOTS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ '.' => true, '..' => true }
Instance Method Summary collapse
- #empty_dir?(path) ⇒ Boolean
- #file_loadeable?(file) ⇒ Boolean private
-
#looks_bare?(path) ⇒ Boolean
A.
- #type_from_mode(mode) ⇒ Object
Instance Method Details
#empty_dir?(path) ⇒ Boolean
35 36 37 |
# File 'lib/multi_git/utils.rb', line 35 def empty_dir?(path) Dir.new(path).reject{|path| DOTS[path] }.none? end |
#file_loadeable?(file) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 |
# File 'lib/multi_git/utils.rb', line 47 def file_loadeable?(file) $LOAD_PATH.any?{|path| File.exists?( File.join(path, file) ) } end |
#looks_bare?(path) ⇒ Boolean
A
40 41 42 43 44 |
# File 'lib/multi_git/utils.rb', line 40 def (path) return nil unless ::File.exists?(path) return !::File.exists?(::File.join(path,'.git')) && ::File.exists?(::File.join(path,'refs')) end |
#type_from_mode(mode) ⇒ Object
51 52 53 |
# File 'lib/multi_git/utils.rb', line 51 def type_from_mode(mode) MODE_TYPES.fetch(mode.to_i){ raise "Unknown file mode #{mode}" } end |