Sha256: f4f409caa3076f9c91006c2e30487256c85a475c946a2d4ae394727a0b832e2e

Contents?: true

Size: 991 Bytes

Versions: 13

Compression:

Stored size: 991 Bytes

Contents

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

      def run
        if installed?
          print 'Xcode CLI Tools are already installed.'
          exit(0)
        end
        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 & 2 rubygems

Version Path
xcode-install-2.8.1 lib/xcode/install/cli.rb
xcode-install-2.8.0 lib/xcode/install/cli.rb
xcode-install-2.7.0 lib/xcode/install/cli.rb
xcode-install-2.6.8 lib/xcode/install/cli.rb
xcode-install-2.6.7 lib/xcode/install/cli.rb
xcode-install-2.6.6 lib/xcode/install/cli.rb
xcode-install-2.6.5 lib/xcode/install/cli.rb
xcode-install-2.6.4 lib/xcode/install/cli.rb
xcode-install-2.6.3 lib/xcode/install/cli.rb
xcode-install-2.6.2 lib/xcode/install/cli.rb
xcode-install-2.6.1 lib/xcode/install/cli.rb
xcode-install-2.6.0 lib/xcode/install/cli.rb
xcode-install-citrus-2.5.0 lib/xcode/install/cli.rb