Class: Bundle
- Inherits:
-
Object
- Object
- Bundle
- Defined in:
- lib/bundle.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #bundle_identifier ⇒ Object
- #defaults_read(key) ⇒ Object
- #defaults_write(*args) ⇒ Object
- #info_path ⇒ Object
-
#initialize(path) ⇒ Bundle
constructor
A new instance of Bundle.
- #valid? ⇒ Boolean
- #version ⇒ Object
Constructor Details
#initialize(path) ⇒ Bundle
Returns a new instance of Bundle.
6 7 8 |
# File 'lib/bundle.rb', line 6 def initialize(path) self.path = path.strip end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/bundle.rb', line 4 def path @path end |
Instance Method Details
#bundle_identifier ⇒ Object
18 19 20 |
# File 'lib/bundle.rb', line 18 def bundle_identifier defaults_read("CFBundleIdentifier") end |
#defaults_read(key) ⇒ Object
26 27 28 29 |
# File 'lib/bundle.rb', line 26 def defaults_read(key) plist_path = "#{path}/Contents/Info" `defaults read "#{plist_path}" #{key}`.strip end |
#defaults_write(*args) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/bundle.rb', line 31 def defaults_write(*args) plist_path = "#{path}/Contents/Info" command = "defaults write \"#{plist_path}\" #{args.join(' ')}" if CLI.dry_run? puts command else `#{command}`.strip end end |
#info_path ⇒ Object
14 15 16 |
# File 'lib/bundle.rb', line 14 def info_path "#{path}/Contents/Info.plist" end |
#valid? ⇒ Boolean
10 11 12 |
# File 'lib/bundle.rb', line 10 def valid? false end |
#version ⇒ Object
22 23 24 |
# File 'lib/bundle.rb', line 22 def version defaults_read('CFBundleShortVersionString') end |