Sha256: 4e55c1f308334e2c5ece7acf837b597f2b07b7a90802b361b17ba7cdefd234e2

Contents?: true

Size: 820 Bytes

Versions: 1

Compression:

Stored size: 820 Bytes

Contents

module Wrapp
  class DMGBuilder
    DEFAULT_FILESYSTEM = 'HFS+'

    attr_reader :app_path

    def initialize(app_path, opts = {})
      @app_path = app_path
      @opts = opts
    end

    def create
      cmd = %w(hdiutil create)
      cmd << "-srcfolder '#{app_path}'"
      cmd << "-fs '#{filesystem}'"
      cmd << "-volname '#{volume_name}'"
      cmd << "'#{dmg_filename}'"
      system(cmd.join(' '))
    end

    def filesystem
      @opts.fetch(:filesystem) { DEFAULT_FILESYSTEM }
    end

    def volume_name
      @opts.fetch(:volume_name) { app.name }
    end

    private

    #def source_path
      #@opts[:include_parent_dir] ? File.dirname(app_path) : app_path
    #end

    def dmg_filename
      "#{app.full_name}.dmg"
    end

    def app
      @app_info ||= AppInfo.new(app_path)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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