Class: Gitit::GitRepo
- Inherits:
-
Object
- Object
- Gitit::GitRepo
- Defined in:
- lib/gitit/git_repo.rb
Overview
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
Instance Method Summary collapse
-
#init ⇒ Object
————————————————————————- ————————————————————————-.
-
#initialize(location) ⇒ GitRepo
constructor
————————————————————————- ————————————————————————-.
-
#valid? ⇒ Boolean
————————————————————————- ————————————————————————-.
Constructor Details
#initialize(location) ⇒ GitRepo
12 13 14 15 |
# File 'lib/gitit/git_repo.rb', line 12 def initialize(location) raise 'Invalid path specified' unless File.directory? location @location = location end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
8 9 10 |
# File 'lib/gitit/git_repo.rb', line 8 def location @location end |
Instance Method Details
#init ⇒ Object
26 27 28 29 |
# File 'lib/gitit/git_repo.rb', line 26 def init raise 'already a git repo' if valid? `(cd #{@location} && git init)` end |
#valid? ⇒ Boolean
19 20 21 22 |
# File 'lib/gitit/git_repo.rb', line 19 def valid? `(cd #{@location} && git rev-parse --git-dir 2>&1)` $?.exitstatus == 0 end |