Class: Bundle

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

Direct Known Subclasses

Xcode, XcodePlugin

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#pathObject

Returns the value of attribute path.



4
5
6
# File 'lib/bundle.rb', line 4

def path
  @path
end

Instance Method Details

#bundle_identifierObject



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_pathObject



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

def info_path
  "#{path}/Contents/Info.plist"
end

#valid?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/bundle.rb', line 10

def valid?
  false
end

#versionObject



22
23
24
# File 'lib/bundle.rb', line 22

def version
  defaults_read('CFBundleShortVersionString')
end