Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensuring the xip extraction will work #167

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@

# Offense count: 11
Metrics/AbcSize:
Max: 39
Max: 44

# Offense count: 1
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 226
Max: 260

# Offense count: 3
Metrics/CyclomaticComplexity:
Max: 8
Max: 10

# Offense count: 10
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 40
Max: 51

# Offense count: 1
# Configuration parameters: CountKeywordArgs.
Expand All @@ -31,4 +31,4 @@ Metrics/ParameterLists:

# Offense count: 2
Metrics/PerceivedComplexity:
Max: 9
Max: 12
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Install and update your Xcodes automatically.

```
$ gem install xcode-install
$ xcversion install 6.3
$ xcversion install 8
```

## Installation
Expand Down Expand Up @@ -35,15 +35,18 @@ XCODE_INSTALL_USER
XCODE_INSTALL_PASSWORD
```

or

```
FASTLANE_USER
FASTLANE_PASSWORD
```

To list available versions:

```
$ xcversion list
6.0.1
6.1
6.1.1
6.2
6.3
8
```

Installed versions will be omitted and by default, only the latest major version is listed.
Expand All @@ -57,12 +60,12 @@ To install a certain version, simply:

```
$ xcversion install 8
########################################################### 82.1%
######################################################################## 100.0%
Please authenticate for Xcode installation...
/Applications/Xcode-8.app: accepted
source=Apple System

Xcode 8
Build version 6D570
Xcode 8.0
Build version 8A218a
```

This will download and install that version of Xcode. It will also be automatically selected.
Expand Down
13 changes: 12 additions & 1 deletion lib/xcode/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ def current_symlink
File.symlink?(SYMLINK_PATH) ? SYMLINK_PATH : nil
end

def os_version_compatibility_issue?(version)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some comments here with context on why this is necessary?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add a few comments describing the issue with<10.11.5 failing to extract the archive

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a comment. Let me know If you would like me to rebase and submit as a single commit.

return false if version != '8'

osx_version = `sw_vers -productVersion`.delete!("\n")
version_parts = osx_version.split('.')

minor = version_parts[1].to_i
patch = version_parts[2].to_i

return true if minor < 12 && minor < 11 || minor == 11 && patch < 5
end

def download(version, progress, url = nil)
return unless url || exist?(version)
xcode = seedlist.find { |x| x.name == version } unless url
Expand Down Expand Up @@ -107,7 +119,6 @@ def install_dmg(dmg_path, suffix = '', switch = true, clean = true)
$stderr.puts out.tr("\n", ' ')
return
end

`sudo -p "#{prompt}" ditto "#{source}" "#{xcode_path}"`
`umount "/Volumes/Xcode"`
end
Expand Down
1 change: 1 addition & 0 deletions lib/xcode/install/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def validate!
super

help! 'A VERSION argument is required.' unless @version
fail Informative, 'An OS X version >10.11.4 is required for xcode 8.' if @installer.os_version_compatibility_issue?(@version)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be Xcode

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/
Expand Down