Class: Wrapp::AppInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/wrapp/app_info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ AppInfo

Returns a new instance of AppInfo.



5
6
7
# File 'lib/wrapp/app_info.rb', line 5

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/wrapp/app_info.rb', line 3

def path
  @path
end

Instance Method Details

#full_nameObject



9
10
11
12
# File 'lib/wrapp/app_info.rb', line 9

def full_name
  separator = '_'
  [name.downcase, version].join(separator).gsub(/\s+/, separator)
end

#get_property(property) ⇒ Object



22
23
24
25
26
# File 'lib/wrapp/app_info.rb', line 22

def get_property(property)
  output = `/usr/libexec/PlistBuddy -c 'Print :#{property}' '#{plist}'`
  raise "Error reading #{property} from #{plist}" unless $?.success?
  output.strip
end

#nameObject



14
15
16
# File 'lib/wrapp/app_info.rb', line 14

def name
  get_property('CFBundleName')
end

#versionObject



18
19
20
# File 'lib/wrapp/app_info.rb', line 18

def version
  get_property('CFBundleShortVersionString')
end