Class: Pullr::LocalRepository
- Inherits:
-
Object
- Object
- Pullr::LocalRepository
- Includes:
- Repository
- Defined in:
- lib/pullr/local_repository.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
The path of the repository.
-
#scm ⇒ Object
readonly
The SCM used for the repository.
-
#uri ⇒ Object
Optional URI for the remote repository.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ LocalRepository
constructor
Initializes the repository.
-
#name ⇒ String
The name of the repository.
-
#scm_dir ⇒ String
The control directory used by the SCM.
-
#update(uri = self.uri) ⇒ Object
Pulls any new updates for the repository down.
Methods included from Repository
#infer_scm_from_dir, #infer_scm_from_uri
Constructor Details
#initialize(options = {}) ⇒ LocalRepository
Initializes the repository.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/pullr/local_repository.rb', line 33 def initialize(={}) super() @path = [:path] unless @scm infer_scm_from_dir && infer_scm_from_uri end unless @scm raise(AmbigiousRepository,"could not infer the SCM from the directory #{@path.dump}",caller) end extend SCM.lookup(@scm) end |
Instance Attribute Details
#path ⇒ Object (readonly)
The path of the repository
10 11 12 |
# File 'lib/pullr/local_repository.rb', line 10 def path @path end |
#scm ⇒ Object (readonly)
The SCM used for the repository
13 14 15 |
# File 'lib/pullr/local_repository.rb', line 13 def scm @scm end |
#uri ⇒ Object
Optional URI for the remote repository
16 17 18 |
# File 'lib/pullr/local_repository.rb', line 16 def uri @uri end |
Instance Method Details
#name ⇒ String
The name of the repository.
57 58 59 |
# File 'lib/pullr/local_repository.rb', line 57 def name File.basename(@path) end |
#scm_dir ⇒ String
The control directory used by the SCM.
67 68 69 70 71 |
# File 'lib/pullr/local_repository.rb', line 67 def scm_dir dir, scm = SCM::DIRS.find { |dir,scm| scm == @scm } return dir end |
#update(uri = self.uri) ⇒ Object
Pulls any new updates for the repository down.
79 80 81 |
# File 'lib/pullr/local_repository.rb', line 79 def update(uri=self.uri) scm_update(@path,uri) end |