Class: OsCtl::Repo::Remote::Repository

Inherits:
Object
  • Object
show all
Defined in:
lib/osctl/repo/remote/repository.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Repository

Returns a new instance of Repository.



7
8
9
10
# File 'lib/osctl/repo/remote/repository.rb', line 7

def initialize(url)
  @url = File.join(url, "v#{SCHEMA}")
  @path = File.join('.', "v#{SCHEMA}")
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



5
6
7
# File 'lib/osctl/repo/remote/repository.rb', line 5

def path
  @path
end

#urlObject (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

Returns:

  • (Boolean)


16
17
18
# File 'lib/osctl/repo/remote/repository.rb', line 16

def has_index?
  File.exist?(index_path)
end

#index_pathObject



24
25
26
# File 'lib/osctl/repo/remote/repository.rb', line 24

def index_path
  File.join(path, 'INDEX.json')
end

#index_urlObject



28
29
30
# File 'lib/osctl/repo/remote/repository.rb', line 28

def index_url
  File.join(url, 'INDEX.json')
end

#lock_indexObject



20
21
22
# File 'lib/osctl/repo/remote/repository.rb', line 20

def lock_index(&)
  Filelock(File.join(path, '.INDEX.json.lock'), &)
end