Class: SparkleAppcast::Archive
- Inherits:
-
Object
- Object
- SparkleAppcast::Archive
- Defined in:
- lib/sparkle_appcast/archive.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #bundle_info ⇒ Object
- #created_at ⇒ Object
- #data ⇒ Object
-
#initialize(path) ⇒ Archive
constructor
A new instance of Archive.
- #size ⇒ Object
Constructor Details
#initialize(path) ⇒ Archive
Returns a new instance of Archive.
7 8 9 |
# File 'lib/sparkle_appcast/archive.rb', line 7 def initialize(path) @path = File.(path) end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/sparkle_appcast/archive.rb', line 5 def path @path end |
Instance Method Details
#bundle_info ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/sparkle_appcast/archive.rb', line 23 def bundle_info @bundle_info ||= Dir.mktmpdir do |tmpdir_path| unarchive!(tmpdir_path) app_paths = Dir.glob(File.join(tmpdir_path, "*.app"), File::FNM_CASEFOLD) if app_paths.size == 0 raise RuntimeError.new("No application bundle found: #{path}") elsif app_paths.size > 1 raise RuntimeError.new("Found multiple application bundles: #{app_paths.map{|path| File.basename(path)}}") else app_path = app_paths.first Bundle.new(app_path).info end end end |
#created_at ⇒ Object
11 12 13 |
# File 'lib/sparkle_appcast/archive.rb', line 11 def created_at File.birthtime(path) end |
#data ⇒ Object
19 20 21 |
# File 'lib/sparkle_appcast/archive.rb', line 19 def data File.binread(path) end |
#size ⇒ Object
15 16 17 |
# File 'lib/sparkle_appcast/archive.rb', line 15 def size File.size(path) end |