Sha256: 31cc435ed88ed6021a8b0afa7d6a2a7311680dcc8afe1875ad5f383d295a1ebc

Contents?: true

Size: 963 Bytes

Versions: 13

Compression:

Stored size: 963 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?
        File.exist?('/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib')
      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 --verbose -i "#{product}"`
        FileUtils.rm(cli_placeholder_file)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
xcode-install-2.5.0 lib/xcode/install/cli.rb
xcode-install-2.4.4 lib/xcode/install/cli.rb
xcode-install-2.4.2 lib/xcode/install/cli.rb
xcode-install-2.4.1 lib/xcode/install/cli.rb
xcode-install-2.4.0 lib/xcode/install/cli.rb
xcode-install-2.3.1 lib/xcode/install/cli.rb
xcode-install-2.3.0 lib/xcode/install/cli.rb
xcode-install-2.2.1 lib/xcode/install/cli.rb
xcode-install-2.2.0 lib/xcode/install/cli.rb
xcode-install-2.1.1 lib/xcode/install/cli.rb
xcode-install-2.1.0 lib/xcode/install/cli.rb
xcode-install-2.0.9 lib/xcode/install/cli.rb
xcode-install-2.0.8 lib/xcode/install/cli.rb