Sha256: a0f6f9809f921c1080fbc99aaba1ea227e89bf7d4b36fbbd9a43c49e457fa099

Contents?: true

Size: 656 Bytes

Versions: 1

Compression:

Stored size: 656 Bytes

Contents

module Wrapp
  class AppInfo
    attr_reader :path

    def initialize(path)
      @path = path
    end

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

    def name
      get_property('CFBundleName')
    end

    def version
      get_property('CFBundleShortVersionString')
    end

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

    private

    def plist
      File.join(path, 'Contents', 'Info.plist')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wrapp-1.0.0 lib/wrapp/app_info.rb