Class: EY::Repo
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #current_branch ⇒ Object
- #exist? ⇒ Boolean
- #fail_on_no_remotes! ⇒ Object
- #has_remote?(repository_uri) ⇒ Boolean
-
#initialize(repo_path = '.') ⇒ Repo
constructor
A new instance of Repo.
- #urls ⇒ Object
Constructor Details
#initialize(repo_path = '.') ⇒ Repo
Returns a new instance of Repo.
10 11 12 |
# File 'lib/engineyard/repo.rb', line 10 def initialize(repo_path='.') self.path = repo_path end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
8 9 10 |
# File 'lib/engineyard/repo.rb', line 8 def path @path end |
Instance Method Details
#current_branch ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/engineyard/repo.rb', line 22 def current_branch if exist? && (head = dotgit("HEAD").read.chomp) && head.gsub!("ref: refs/heads/", "") head else nil end end |
#exist? ⇒ Boolean
18 19 20 |
# File 'lib/engineyard/repo.rb', line 18 def exist? dotgit.directory? end |
#fail_on_no_remotes! ⇒ Object
38 39 40 41 42 |
# File 'lib/engineyard/repo.rb', line 38 def fail_on_no_remotes! if urls.empty? raise NoRemotesError.new(path) end end |
#has_remote?(repository_uri) ⇒ Boolean
34 35 36 |
# File 'lib/engineyard/repo.rb', line 34 def has_remote?(repository_uri) urls.include?(repository_uri) end |
#urls ⇒ Object
30 31 32 |
# File 'lib/engineyard/repo.rb', line 30 def urls @urls ||= config('remote.*.url').map { |c| c.split.last } end |