Sha256: 67326d6a1ce081d7accef945c1f66a7331cc61b71ed621e1f8350c11f9fa3d13

Contents?: true

Size: 920 Bytes

Versions: 9

Compression:

Stored size: 920 Bytes

Contents

module XcodeInstall
  class Command
    class InstallCLITools < Command
      self.command = 'install-cli-tools'
      self.summary = 'Installs Xcode Command Line Tools.'

      def run
        fail Informative, 'Xcode CLI Tools are already installed.' if installed?
        install
      end

      def installed?
        `xcode-select -p`
        $?.success?
      end

      def install
        cli_placeholder_file = '/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress'
        # create the placeholder file that's checked by CLI updates' .dist code in Apple's SUS catalog
        FileUtils.touch(cli_placeholder_file)
        # find the CLI Tools update
        product = `softwareupdate -l | grep "\*.*Command Line" | head -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | tr -d '\n'`
        `softwareupdate -i "#{product}" -v`
        FileUtils.rm(cli_placeholder_file)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
xcode-install-1.2.5 lib/xcode/install/cli.rb
xcode-install-1.2.4 lib/xcode/install/cli.rb
xcode-install-1.2.3 lib/xcode/install/cli.rb
xcode-install-1.2.2 lib/xcode/install/cli.rb
xcode-install-1.2.1 lib/xcode/install/cli.rb
xcode-install-1.2.0 lib/xcode/install/cli.rb
xcode-install-1.1.0 lib/xcode/install/cli.rb
xcode-install-1.0.1 lib/xcode/install/cli.rb
xcode-install-1.0.0 lib/xcode/install/cli.rb