Sha256: 87bd63676bb1c238c2e7ec9fcfb610105a97136cada509a97c7c42b8a203bf4d

Contents?: true

Size: 1.7 KB

Versions: 14

Compression:

Stored size: 1.7 KB

Contents

require 'uri'

module XcodeInstall
  class Command
    class Install < Command
      self.command = 'install'
      self.summary = 'Install a specific version of Xcode.'

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

      def self.options
        [['--url', 'Custom Xcode DMG file path or HTTP URL.'],
         ['--force', 'Install even if the same version is already installed.'],
         ['--no-switch', 'Don’t switch to this version after installation'],
         ['--no-install', 'Only download DMG, but do not install it.'],
         ['--no-progress', 'Don’t show download progress.'],
         ['--no-clean', 'Don’t delete DMG after installation.']].concat(super)
      end

      def initialize(argv)
        @installer = Installer.new
        @version = argv.shift_argument
        @url = argv.option('url')
        @force = argv.flag?('force', false)
        @should_clean = argv.flag?('clean', true)
        @should_install = argv.flag?('install', true)
        @should_switch = argv.flag?('switch', true)
        @progress = argv.flag?('progress', true)
        super
      end

      def validate!
        super

        help! 'A VERSION argument is required.' unless @version
        fail Informative, "Version #{@version} already installed." if @installer.installed?(@version) && !@force
        fail Informative, "Version #{@version} doesn't exist." unless @url || @installer.exist?(@version)
        fail Informative, "Invalid URL: `#{@url}`" unless !@url || @url =~ /\A#{URI.regexp}\z/
      end

      def run
        @installer.install_version(@version, @should_switch, @should_clean, @should_install,
                                   @progress, @url)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
xcode-install-2.2.0 lib/xcode/install/install.rb
xcode-install-2.1.1 lib/xcode/install/install.rb
xcode-install-2.1.0 lib/xcode/install/install.rb
xcode-install-2.0.9 lib/xcode/install/install.rb
xcode-install-2.0.8 lib/xcode/install/install.rb
xcode-install-2.0.7 lib/xcode/install/install.rb
xcode-install-2.0.6 lib/xcode/install/install.rb
xcode-install-2.0.5 lib/xcode/install/install.rb
xcode-install-2.0.4 lib/xcode/install/install.rb
xcode-install-2.0.3 lib/xcode/install/install.rb
xcode-install-2.0.2 lib/xcode/install/install.rb
xcode-install-2.0.1 lib/xcode/install/install.rb
xcode-install-2.0.0 lib/xcode/install/install.rb
xcode-install-1.4.0 lib/xcode/install/install.rb