Sha256: 8040f5247bc6223196275d925b95a401cb4a3b60a8674bd7a9e4d0223758160c

Contents?: true

Size: 1014 Bytes

Versions: 8

Compression:

Stored size: 1014 Bytes

Contents

module XcodeInstall
  class Command
    class Select < Command
      self.command = 'select'
      self.summary = 'Select installed Xcode via `xcode-select`.'

      self.arguments = [
        CLAide::Argument.new('VERSION', :true)
      ]

      def self.options
        [['--symlink', 'Update symlink in /Applications with selected Xcode']].concat(super)
      end

      def initialize(argv)
        @installer = Installer.new
        @version = argv.shift_argument
        @should_symlink = argv.flag?('symlink', false)
        super
      end

      def validate!
        super

        fail Informative, 'Please specify a version to select.' if @version.nil?
        fail Informative, "Version #{@version} not installed." unless @installer.installed?(@version)
      end

      def run
        xcode = @installer.installed_versions.detect { |v| v.version == @version }
        `sudo xcode-select --switch #{xcode.path}`
        @installer.symlink xcode.version if @should_symlink
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
xcode-install-2.6.1 lib/xcode/install/select.rb
xcode-install-2.6.0 lib/xcode/install/select.rb
xcode-install-citrus-2.5.0 lib/xcode/install/select.rb
xcode-install-2.5.0 lib/xcode/install/select.rb
xcode-install-2.4.4 lib/xcode/install/select.rb
xcode-install-2.4.2 lib/xcode/install/select.rb
xcode-install-2.4.1 lib/xcode/install/select.rb
xcode-install-2.4.0 lib/xcode/install/select.rb