Sha256: 1f67c124c3339d89645f90fd4503577a8fbdd5eae49c8856982b3576d7fa808a

Contents?: true

Size: 1016 Bytes

Versions: 10

Compression:

Stored size: 1016 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

10 entries across 10 versions & 1 rubygems

Version Path
xcode-install-2.8.1 lib/xcode/install/select.rb
xcode-install-2.8.0 lib/xcode/install/select.rb
xcode-install-2.7.0 lib/xcode/install/select.rb
xcode-install-2.6.8 lib/xcode/install/select.rb
xcode-install-2.6.7 lib/xcode/install/select.rb
xcode-install-2.6.6 lib/xcode/install/select.rb
xcode-install-2.6.5 lib/xcode/install/select.rb
xcode-install-2.6.4 lib/xcode/install/select.rb
xcode-install-2.6.3 lib/xcode/install/select.rb
xcode-install-2.6.2 lib/xcode/install/select.rb