Class: Gitit::Repo
- Inherits:
-
Object
- Object
- Gitit::Repo
- Defined in:
- lib/gitit/repo.rb
Overview
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
Instance Method Summary collapse
-
#init ⇒ Object
————————————————————————- ————————————————————————-.
-
#initialize(location) ⇒ Repo
constructor
————————————————————————- ————————————————————————-.
-
#valid? ⇒ Boolean
————————————————————————- ————————————————————————-.
Constructor Details
#initialize(location) ⇒ Repo
15 16 17 18 |
# File 'lib/gitit/repo.rb', line 15 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.
11 12 13 |
# File 'lib/gitit/repo.rb', line 11 def location @location end |
Instance Method Details
#init ⇒ Object
30 31 32 33 |
# File 'lib/gitit/repo.rb', line 30 def init raise "failed to create repo" if valid? commandres = `(cd #{@location} && git init)` end |
#valid? ⇒ Boolean
22 23 24 25 26 |
# File 'lib/gitit/repo.rb', line 22 def valid? commandres = `(cd #{@location} && git status 2&>/dev/null)` return true unless $?.exitstatus != 0 return false end |