Class: Captain::Package
- Inherits:
-
Object
- Object
- Captain::Package
- Defined in:
- lib/captain/package.rb
Instance Attribute Summary collapse
-
#codename ⇒ Object
readonly
Returns the value of attribute codename.
-
#component ⇒ Object
readonly
Returns the value of attribute component.
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#md5sum ⇒ Object
readonly
Returns the value of attribute md5sum.
-
#mirror ⇒ Object
readonly
Returns the value of attribute mirror.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#tasks ⇒ Object
readonly
Returns the value of attribute tasks.
Instance Method Summary collapse
- #copy_manifest_to(stream) ⇒ Object
- #copy_to(directory) ⇒ Object
-
#initialize(mirror, codename, component, manifest) ⇒ Package
constructor
A new instance of Package.
Constructor Details
#initialize(mirror, codename, component, manifest) ⇒ Package
Returns a new instance of Package.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/captain/package.rb', line 14 def initialize(mirror, codename, component, manifest) @mirror = mirror @codename = codename @component = component @manifest = manifest @dependencies = Set.new @provides = Set.new @recommends = Set.new @tasks = Set.new @manifest.each_line do |line| case line when /^Depends:(.*)$/ @dependencies.merge(parse_list($1)) when /^Filename:(.*)$/ @filename = $1.strip when /^MD5sum:(.*)$/ @md5sum = $1.strip when /^Package:(.*)$/ @name = $1.strip when /^Recommends:(.*)$/ @recommends.merge(parse_list($1)) when /^Task:(.*)$/ @tasks.merge(parse_list($1)) end end end |
Instance Attribute Details
#codename ⇒ Object (readonly)
Returns the value of attribute codename.
5 6 7 |
# File 'lib/captain/package.rb', line 5 def codename @codename end |
#component ⇒ Object (readonly)
Returns the value of attribute component.
6 7 8 |
# File 'lib/captain/package.rb', line 6 def component @component end |
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies.
7 8 9 |
# File 'lib/captain/package.rb', line 7 def dependencies @dependencies end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
8 9 10 |
# File 'lib/captain/package.rb', line 8 def filename @filename end |
#md5sum ⇒ Object (readonly)
Returns the value of attribute md5sum.
9 10 11 |
# File 'lib/captain/package.rb', line 9 def md5sum @md5sum end |
#mirror ⇒ Object (readonly)
Returns the value of attribute mirror.
10 11 12 |
# File 'lib/captain/package.rb', line 10 def mirror @mirror end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/captain/package.rb', line 11 def name @name end |
#tasks ⇒ Object (readonly)
Returns the value of attribute tasks.
12 13 14 |
# File 'lib/captain/package.rb', line 12 def tasks @tasks end |
Instance Method Details
#copy_manifest_to(stream) ⇒ Object
47 48 49 50 51 |
# File 'lib/captain/package.rb', line 47 def copy_manifest_to(stream) # Just making sure we don't end up with extra newlines. Postel's law and all that. stream.puts(@manifest.strip) stream.puts end |
#copy_to(directory) ⇒ Object
43 44 45 |
# File 'lib/captain/package.rb', line 43 def copy_to(directory) Remote.package_file(mirror, filename, md5sum).copy_to(directory, filename) end |