Class: Rubolite::Admin
- Inherits:
-
Object
- Object
- Rubolite::Admin
- Defined in:
- lib/rubolite/admin.rb
Constant Summary collapse
- InvalidPath =
Class.new(Exception)
- InvalidGitRepo =
Class.new(Exception)
- InvalidRepo =
Class.new(Exception)
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
-
#repos ⇒ Object
readonly
Returns the value of attribute repos.
Instance Method Summary collapse
- #add_repo(repo) ⇒ Object (also: #<<)
- #client ⇒ Object
- #git ⇒ Object
-
#initialize(path = nil) ⇒ Admin
constructor
A new instance of Admin.
- #parser ⇒ Object
- #repo_origin ⇒ Object
- #reset! ⇒ Object
- #writer ⇒ Object
Constructor Details
#initialize(path = nil) ⇒ Admin
Returns a new instance of Admin.
9 10 11 |
# File 'lib/rubolite/admin.rb', line 9 def initialize(path=nil) @path = path if path && valid_path?(path) end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
7 8 9 |
# File 'lib/rubolite/admin.rb', line 7 def path @path end |
#repos ⇒ Object (readonly)
Returns the value of attribute repos.
7 8 9 |
# File 'lib/rubolite/admin.rb', line 7 def repos @repos end |
Instance Method Details
#add_repo(repo) ⇒ Object Also known as: <<
28 29 30 31 |
# File 'lib/rubolite/admin.rb', line 28 def add_repo(repo) raise InvalidRepo, "Repo not type of Rubolite::Repo, got #{repo.class}" unless repo.kind_of?(Repo) (@repos ||= []) << repo end |
#client ⇒ Object
50 51 52 |
# File 'lib/rubolite/admin.rb', line 50 def client @client ||= Client.new(self) end |
#git ⇒ Object
42 43 44 |
# File 'lib/rubolite/admin.rb', line 42 def git @git ||= Git.open(path) end |
#parser ⇒ Object
34 35 36 |
# File 'lib/rubolite/admin.rb', line 34 def parser @parser ||= Parser.new("#{path}/conf/gitolite.conf") end |
#repo_origin ⇒ Object
46 47 48 |
# File 'lib/rubolite/admin.rb', line 46 def repo_origin @repo_origin ||= git.remote("origin") end |
#reset! ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/rubolite/admin.rb', line 13 def reset! @parser = nil @writer = nil @git = nil @repo_origin = nil @client = nil self end |
#writer ⇒ Object
38 39 40 |
# File 'lib/rubolite/admin.rb', line 38 def writer @writer ||= parser.writer end |