Class: Ed::Repository
- Inherits:
-
Object
- Object
- Ed::Repository
- Defined in:
- lib/ed/repository.rb
Instance Attribute Summary collapse
-
#path ⇒ String
readonly
The path to the repository on local disk.
Class Method Summary collapse
-
.is_local?(path) ⇒ Boolean
Returns true if the repository is considered to exist on filesystem.
-
.ls_remote(*args) {|sha, ref| ... } ⇒ Enumerator
Returns a Enumerator if no block is given.
Instance Method Summary collapse
- #checkout(*args) ⇒ void
-
#initialize(path) ⇒ Ed::Repository
constructor
Returns a instance of Repository.
Constructor Details
#initialize(path) ⇒ Ed::Repository
Returns a instance of Ed::Repository.
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/ed/repository.rb', line 59 def initialize path @path = copy!(path.to_s) parent = Process.pid at_exit do if parent == Process.pid FileUtils.rm_rf(@path) end end end |
Instance Attribute Details
#path ⇒ String (readonly)
Returns The path to the repository on local disk.
50 51 52 |
# File 'lib/ed/repository.rb', line 50 def path @path end |
Class Method Details
.is_local?(path) ⇒ Boolean
Returns true if the repository is considered to exist on filesystem.
40 41 42 |
# File 'lib/ed/repository.rb', line 40 def is_local? path path[0..6] == "file://" || !path.include?(":") end |
.ls_remote(*args) {|sha, ref| ... } ⇒ Enumerator
Returns a Enumerator if no block is given.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ed/repository.rb', line 20 def ls_remote *args unless block_given? return enum_for(:ls_remote, *args) end output = `git ls-remote #{args.join(' ')}` output.each_line do |line| sha, ref = line.split(/\s+/, 2) yield sha, ref.chomp end end |
Instance Method Details
#checkout(*args) ⇒ void
This method returns an undefined value.
77 78 79 |
# File 'lib/ed/repository.rb', line 77 def checkout *args git "checkout", *args end |