Class: OsCtl::Repo::Remote::Repository
- Inherits:
-
Object
- Object
- OsCtl::Repo::Remote::Repository
- Defined in:
- lib/osctl/repo/remote/repository.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #has_index? ⇒ Boolean
- #index_path ⇒ Object
- #index_url ⇒ Object
-
#initialize(url) ⇒ Repository
constructor
A new instance of Repository.
- #lock_index ⇒ Object
Constructor Details
#initialize(url) ⇒ Repository
Returns a new instance of Repository.
8 9 10 11 |
# File 'lib/osctl/repo/remote/repository.rb', line 8 def initialize(url) @url = File.join(url, "v#{SCHEMA}") @path = File.join('.', "v#{SCHEMA}") end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/osctl/repo/remote/repository.rb', line 6 def path @path end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
5 6 7 |
# File 'lib/osctl/repo/remote/repository.rb', line 5 def url @url end |
Instance Method Details
#has_index? ⇒ Boolean
17 18 19 |
# File 'lib/osctl/repo/remote/repository.rb', line 17 def has_index? File.exist?(index_path) end |
#index_path ⇒ Object
25 26 27 |
# File 'lib/osctl/repo/remote/repository.rb', line 25 def index_path File.join(path, 'INDEX.json') end |
#index_url ⇒ Object
29 30 31 |
# File 'lib/osctl/repo/remote/repository.rb', line 29 def index_url File.join(url, 'INDEX.json') end |
#lock_index ⇒ Object
21 22 23 |
# File 'lib/osctl/repo/remote/repository.rb', line 21 def lock_index Filelock(File.join(path, '.INDEX.json.lock')) { yield } end |