Class: Aptly::PublishedResource

Inherits:
Object
  • Object
show all
Defined in:
lib/aptly/publish.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dist, prefix = '') ⇒ PublishedResource

Instantiates a new published resource object from an existing published resource.

Parameters:

dist

The distribution name

prefix

An optional prefix

Returns:

An Aptly::PublishedResource object



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/aptly/publish.rb', line 121

def initialize dist, prefix=''
  idx = "#{prefix}#{prefix.empty? ? '' : '/'}#{dist}"

  published = Aptly::list_published
  if !published.include? idx
    raise AptlyError.new "Published resource #{idx} does not exist"
  end

  @dist = dist
  @prefix = prefix
  @path = published[idx]['path']
  @from_name = published[idx]['from_name']
  @from_type = published[idx]['from_type']
  @component = published[idx]['component']
  @archlist = published[idx]['archlist']
end

Instance Attribute Details

#archlistObject

Returns the value of attribute archlist.



100
101
102
# File 'lib/aptly/publish.rb', line 100

def archlist
  @archlist
end

#componentObject

Returns the value of attribute component.



99
100
101
# File 'lib/aptly/publish.rb', line 99

def component
  @component
end

#distObject

Returns the value of attribute dist.



100
101
102
# File 'lib/aptly/publish.rb', line 100

def dist
  @dist
end

#from_nameObject

Returns the value of attribute from_name.



99
100
101
# File 'lib/aptly/publish.rb', line 99

def from_name
  @from_name
end

#from_typeObject

Returns the value of attribute from_type.



99
100
101
# File 'lib/aptly/publish.rb', line 99

def from_type
  @from_type
end

#pathObject

Returns the value of attribute path.



99
100
101
# File 'lib/aptly/publish.rb', line 99

def path
  @path
end

Instance Method Details

#dropObject

Unpublish a currently published resource.



139
140
141
142
143
144
145
# File 'lib/aptly/publish.rb', line 139

def drop
  cmd = 'aptly publish drop'
  cmd += " #{@dist.quote}"
  cmd += " #{@prefix.quote}" if !@prefix.empty?

  Aptly::runcmd cmd
end