Class: Lagunitas::App
- Inherits:
-
Object
- Object
- Lagunitas::App
- Defined in:
- lib/lagunitas/app.rb
Overview
Representation of an app inside an IPA
Instance Method Summary collapse
- #bundle_name ⇒ Object
- #display_name ⇒ Object
- #icon(size) ⇒ Object
- #icons ⇒ Object
- #identifier ⇒ Object
- #info ⇒ Object
-
#initialize(path) ⇒ App
constructor
A new instance of App.
- #short_version ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(path) ⇒ App
Returns a new instance of App.
9 10 11 |
# File 'lib/lagunitas/app.rb', line 9 def initialize(path) @path = path end |
Instance Method Details
#bundle_name ⇒ Object
21 22 23 |
# File 'lib/lagunitas/app.rb', line 21 def bundle_name info['CFBundleName'] end |
#display_name ⇒ Object
25 26 27 |
# File 'lib/lagunitas/app.rb', line 25 def display_name info['CFBundleDisplayName'] end |
#icon(size) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/lagunitas/app.rb', line 37 def icon(size) icons.each do |icon| return icon[:path] if icon[:width] >= size end nil end |
#icons ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/lagunitas/app.rb', line 44 def icons @icons ||= begin icons = [] info['CFBundleIcons']['CFBundlePrimaryIcon']['CFBundleIconFiles'].each do |name| icons << get_image(name) icons << get_image("#{name}@2x") end icons.delete_if(&:!) rescue NoMethodError # fix a ipa without icons [] end end |
#identifier ⇒ Object
17 18 19 |
# File 'lib/lagunitas/app.rb', line 17 def identifier info['CFBundleIdentifier'] end |
#info ⇒ Object
13 14 15 |
# File 'lib/lagunitas/app.rb', line 13 def info @info ||= CFPropertyList.native_types(CFPropertyList::List.new(file: File.join(@path, 'Info.plist')).value) end |
#short_version ⇒ Object
33 34 35 |
# File 'lib/lagunitas/app.rb', line 33 def short_version info['CFBundleShortVersionString'] end |
#version ⇒ Object
29 30 31 |
# File 'lib/lagunitas/app.rb', line 29 def version info['CFBundleVersion'] end |