Sha256: 56b95eea28508d024f93738a9b210a8c346a3b76050c0ec5cc30647a85ad0e81

Contents?: true

Size: 825 Bytes

Versions: 6

Compression:

Stored size: 825 Bytes

Contents

require 'rocket_fuel/fix/command_line_tools/dmg_metadata'

module RocketFuel
  module Fix
    module CommandLineTools
      class Install
        def initialize(dmg_path)
          @dmg_path = dmg_path
          @metadata = DmgMetadata.new(dmg_path)
        end

        def run
          #sudo before the work needs to be done to improve clarity of prompt
          `sudo echo `
          `echo Y | PAGER=true hdiutil attach '#{@dmg_path}' -quiet `
          `sudo installer -pkg '/Volumes/#{volumes_dir}/#{pkg_name}.pkg' -target /`
          `hdiutil detach '/Volumes/#{volumes_dir}' || hdiutil detach '/Volumes/#{volume_dir}' -force`
        end

        protected
        def volume_dir
          @metadata.volume_dir
        end

        def pkg_name
          @metadata.pkg_name
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rocket_fuel-0.0.6 lib/rocket_fuel/fix/command_line_tools/install.rb
rocket_fuel-0.0.5 lib/rocket_fuel/fix/command_line_tools/install.rb
rocket_fuel-0.0.4 lib/rocket_fuel/fix/command_line_tools/install.rb
rocket_fuel-0.0.3 lib/rocket_fuel/fix/command_line_tools/install.rb
rocket_fuel-0.0.2 lib/rocket_fuel/fix/command_line_tools/install.rb
rocket_fuel-0.0.1 lib/rocket_fuel/fix/command_line_tools/install.rb