Class: OsxApp
- Inherits:
-
Object
- Object
- OsxApp
- Defined in:
- lib/osx_app.rb
Overview
this class describes OSX Application
Defined Under Namespace
Classes: CannotFind, Invalid
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(name_or_path) ⇒ OsxApp
constructor
A new instance of OsxApp.
- #version ⇒ Object
- #version_major ⇒ Object
Constructor Details
#initialize(name_or_path) ⇒ OsxApp
Returns a new instance of OsxApp.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/osx_app.rb', line 9 def initialize(name_or_path) if File.directory?(name_or_path) @name = File.basename(name_or_path).gsub('.app', '') @path = name_or_path else @name = name_or_path.gsub('.app', '') @path = "/Applications/#{@name}.app" fail CannotFind, @path unless File.directory?(@path) end validate! end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/osx_app.rb', line 6 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/osx_app.rb', line 7 def path @path end |
Instance Method Details
#version ⇒ Object
21 22 23 |
# File 'lib/osx_app.rb', line 21 def version `defaults read #{info_plist} CFBundleShortVersionString`.strip end |
#version_major ⇒ Object
25 26 27 |
# File 'lib/osx_app.rb', line 25 def version_major version.split('.').first end |