Class: Dply::Repo
- Inherits:
-
Object
- Object
- Dply::Repo
- Defined in:
- lib/dply/repo.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#mirror ⇒ Object
readonly
Returns the value of attribute mirror.
-
#upstream ⇒ Object
readonly
Returns the value of attribute upstream.
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(dir, upstream, mirror: nil) ⇒ Repo
constructor
A new instance of Repo.
Constructor Details
#initialize(dir, upstream, mirror: nil) ⇒ Repo
Returns a new instance of Repo.
7 8 9 10 11 |
# File 'lib/dply/repo.rb', line 7 def initialize(dir, upstream, mirror: nil) @dir = dir @upstream = upstream @mirror = mirror end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
5 6 7 |
# File 'lib/dply/repo.rb', line 5 def dir @dir end |
#mirror ⇒ Object (readonly)
Returns the value of attribute mirror.
5 6 7 |
# File 'lib/dply/repo.rb', line 5 def mirror @mirror end |
#upstream ⇒ Object (readonly)
Returns the value of attribute upstream.
5 6 7 |
# File 'lib/dply/repo.rb', line 5 def upstream @upstream end |
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/dply/repo.rb', line 13 def create if Dir.exist? "#{dir}/.git" raise Error, "unable to create repo (another repo already exists)" if not verify_remote_url else Git.clone upstream, dir, mirror: @mirror end end |