Class: Captain::Release::Component::Manifest

Inherits:
Object
  • Object
show all
Defined in:
lib/captain/release.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, contents) ⇒ Manifest

Returns a new instance of Manifest.



79
80
81
82
# File 'lib/captain/release.rb', line 79

def initialize(path, contents)
  @path     = path
  @contents = contents
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



77
78
79
# File 'lib/captain/release.rb', line 77

def path
  @path
end

Instance Method Details

#checksum(algorithm) ⇒ Object



90
91
92
# File 'lib/captain/release.rb', line 90

def checksum(algorithm)
  Digest(algorithm).hexdigest(@contents)
end

#copy_to(directory) ⇒ Object



84
85
86
87
88
# File 'lib/captain/release.rb', line 84

def copy_to(directory)
  file = Pathname.new(directory).join(path)
  file.dirname.mkpath
  file.open('w') { |io| io.write(@contents) }
end

#sizeObject



94
95
96
# File 'lib/captain/release.rb', line 94

def size
  @contents.length
end