xcode-install 2.3.1 → 2.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.circleci/config.yml +33 -0
- data/.github/workflows/ci.yml +36 -0
- data/.gitignore +1 -0
- data/README.md +53 -9
- data/bin//360/237/216/211 +1 -1
- data/lib/xcode/install/cli.rb +4 -1
- data/lib/xcode/install/install.rb +10 -3
- data/lib/xcode/install/select.rb +7 -1
- data/lib/xcode/install/version.rb +1 -1
- data/lib/xcode/install.rb +296 -63
- data/spec/curl_spec.rb +1 -1
- data/spec/fixtures/xcode.json +30 -1
- data/spec/fixtures/xcode_63.json +28 -44
- data/spec/fixtures/yolo.json +1 -1
- data/spec/install_spec.rb +12 -4
- data/spec/installer_spec.rb +126 -0
- data/spec/json_spec.rb +14 -4
- data/spec/list_spec.rb +56 -3
- data/spec/prerelease_spec.rb +1 -1
- data/xcode-install.gemspec +4 -1
- metadata +14 -13
- data/.travis.yml +0 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 0fea81231fe9d81aed11e53e9340d8749cb90b12b61cf455ef216c4659beaf85
|
|
4
|
+
data.tar.gz: d385404265a3453ff25f3f6c2c532235ca7ed9769e0c1b808c64749f930f6eca
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4147ef290648e0f0ac2122be32a2cc0d4fd26d3c9509767661107527fe20e58534bab89c505d992a876202a40effa7913b3901e24f504952839e5f416d011503
|
|
7
|
+
data.tar.gz: fa470926afe6472b552bd7be37619542024913101997df6e00a47064714199594c6c0dafbf1a41c07aa79ea1cb22e35f3cca75a1bbce8bb068b9453ec7bc6a6d
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
|
|
3
|
+
jobs:
|
|
4
|
+
build:
|
|
5
|
+
macos:
|
|
6
|
+
xcode: "9.0"
|
|
7
|
+
working_directory: ~/xcode-install
|
|
8
|
+
shell: /bin/bash --login -eo pipefail
|
|
9
|
+
steps:
|
|
10
|
+
- checkout
|
|
11
|
+
|
|
12
|
+
# See Also: https://discuss.circleci.com/t/circleci-2-0-ios-error-installing-gems/23291/4
|
|
13
|
+
- run:
|
|
14
|
+
name: Set Ruby Version
|
|
15
|
+
command: echo "ruby-2.4" > ~/.ruby-version
|
|
16
|
+
|
|
17
|
+
- run:
|
|
18
|
+
name: Install ruby dependencies
|
|
19
|
+
command: bundle install
|
|
20
|
+
|
|
21
|
+
- run:
|
|
22
|
+
name: Run test
|
|
23
|
+
command: bundle exec rake spec
|
|
24
|
+
|
|
25
|
+
- run:
|
|
26
|
+
name: Run lint
|
|
27
|
+
command: bundle exec rake rubocop
|
|
28
|
+
|
|
29
|
+
workflows:
|
|
30
|
+
version: 2
|
|
31
|
+
build_and_test:
|
|
32
|
+
jobs:
|
|
33
|
+
- build
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: "CI"
|
|
2
|
+
on: [pull_request]
|
|
3
|
+
|
|
4
|
+
jobs:
|
|
5
|
+
build:
|
|
6
|
+
strategy:
|
|
7
|
+
fail-fast: false
|
|
8
|
+
matrix:
|
|
9
|
+
ruby: ["2.5", "2.6"]
|
|
10
|
+
|
|
11
|
+
runs-on: macos-latest
|
|
12
|
+
steps:
|
|
13
|
+
# Setup env
|
|
14
|
+
- uses: actions/checkout@v2
|
|
15
|
+
- uses: actions/setup-ruby@v1
|
|
16
|
+
with:
|
|
17
|
+
ruby-version: "${{ matrix.ruby }}"
|
|
18
|
+
|
|
19
|
+
# Show env
|
|
20
|
+
- name: Show macOS version
|
|
21
|
+
run: sw_vers
|
|
22
|
+
- name: Show ruby version
|
|
23
|
+
run: |
|
|
24
|
+
ruby --version
|
|
25
|
+
bundler --version
|
|
26
|
+
|
|
27
|
+
# Prepare
|
|
28
|
+
- name: Install bundler 1.7
|
|
29
|
+
run: gem install bundler -v "~> 1.7"
|
|
30
|
+
- name: Install ruby dependencies
|
|
31
|
+
run: bundle install -j4 --clean --path=vendor
|
|
32
|
+
|
|
33
|
+
- name: Run test
|
|
34
|
+
run: bundle exec rake spec
|
|
35
|
+
- name: Run lint
|
|
36
|
+
run: bundle exec rake rubocop
|
data/.gitignore
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Xcode::Install
|
|
2
2
|
|
|
3
|
-
[](http://badge.fury.io/rb/xcode-install)
|
|
3
|
+
[](http://badge.fury.io/rb/xcode-install) [](https://circleci.com/gh/xcpretty/xcode-install)
|
|
4
4
|
|
|
5
5
|
Install and update your Xcodes automatically.
|
|
6
6
|
|
|
@@ -9,6 +9,8 @@ $ gem install xcode-install
|
|
|
9
9
|
$ xcversion install 6.3
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
+
This tool uses the [Downloads for Apple Developer](https://developer.apple.com/download/more/) page.
|
|
13
|
+
|
|
12
14
|
## Installation
|
|
13
15
|
|
|
14
16
|
```
|
|
@@ -34,6 +36,8 @@ XCODE_INSTALL_USER
|
|
|
34
36
|
XCODE_INSTALL_PASSWORD
|
|
35
37
|
```
|
|
36
38
|
|
|
39
|
+
### List
|
|
40
|
+
|
|
37
41
|
To list available versions:
|
|
38
42
|
|
|
39
43
|
```
|
|
@@ -41,17 +45,21 @@ $ xcversion list
|
|
|
41
45
|
6.0.1
|
|
42
46
|
6.1
|
|
43
47
|
6.1.1
|
|
44
|
-
6.2
|
|
48
|
+
6.2 (installed)
|
|
45
49
|
6.3
|
|
46
50
|
```
|
|
47
51
|
|
|
48
|
-
|
|
52
|
+
Already installed versions are marked with `(installed)`.
|
|
53
|
+
(Use `$ xcversion installed` to only list installed Xcodes with their path).
|
|
54
|
+
|
|
55
|
+
To update the list of available versions, run:
|
|
49
56
|
|
|
50
|
-
To list all available versions run
|
|
51
57
|
```
|
|
52
|
-
$ xcversion
|
|
58
|
+
$ xcversion update
|
|
53
59
|
```
|
|
54
60
|
|
|
61
|
+
### Install
|
|
62
|
+
|
|
55
63
|
To install a certain version, simply:
|
|
56
64
|
|
|
57
65
|
```
|
|
@@ -64,7 +72,10 @@ Xcode 8
|
|
|
64
72
|
Build version 6D570
|
|
65
73
|
```
|
|
66
74
|
|
|
67
|
-
This will download and install that version of Xcode.
|
|
75
|
+
This will download and install that version of Xcode. Then you can start it from `/Applications` as usual.
|
|
76
|
+
The new version will also be automatically selected for CLI commands (see below).
|
|
77
|
+
|
|
78
|
+
#### GMs and beta versions
|
|
68
79
|
|
|
69
80
|
Note: GMs and beta versions usually have special names, e.g.
|
|
70
81
|
|
|
@@ -74,7 +85,24 @@ $ xcversion list
|
|
|
74
85
|
7.1 beta
|
|
75
86
|
```
|
|
76
87
|
|
|
77
|
-
|
|
88
|
+
They have to be installed using the full name, e.g. `xcversion install '7 GM seed'`.
|
|
89
|
+
|
|
90
|
+
### Select
|
|
91
|
+
|
|
92
|
+
To see the currently selected version, run
|
|
93
|
+
```
|
|
94
|
+
$ xcversion selected
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
To select a version as active, run
|
|
98
|
+
```
|
|
99
|
+
$ xcversion select 8
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
To select a version as active and change the symlink at `/Applications/Xcode`, run
|
|
103
|
+
```
|
|
104
|
+
$ xcversion select 8 --symlink
|
|
105
|
+
```
|
|
78
106
|
|
|
79
107
|
### Command Line Tools
|
|
80
108
|
|
|
@@ -121,12 +149,16 @@ XcodeInstall automatically installs additional components so that it is immediat
|
|
|
121
149
|
commandline. Unfortunately, Xcode will load third-party plugins even in that situation, which leads
|
|
122
150
|
to a dialog popping up. Feel free to dupe [the radar][5]. 📡
|
|
123
151
|
|
|
124
|
-
XcodeInstall
|
|
152
|
+
XcodeInstall normally relies on the Spotlight index to locate installed versions of Xcode. If you use it while
|
|
125
153
|
indexing is happening, it might show inaccurate results and it will not be able to see installed
|
|
126
|
-
versions on unindexed volumes.
|
|
154
|
+
versions on unindexed volumes.
|
|
155
|
+
|
|
156
|
+
To workaround the Spotlight limitation, XcodeInstall searches `/Applications` folder to locate Xcodes when Spotlight is disabled on the machine, or when Spotlight query for Xcode does not return any results. But it still won't work if your Xcodes are not located under `/Applications` folder.
|
|
127
157
|
|
|
128
158
|
## Thanks
|
|
129
159
|
|
|
160
|
+
Thanks to [@neonichu](https://github.com/neonichu), the original (and best) author.
|
|
161
|
+
|
|
130
162
|
[This][3] downloading script which has been used for some inspiration, also [this][4]
|
|
131
163
|
for doing the installation. Additionally, many thanks to everyone who has contributed to this
|
|
132
164
|
project, especially [@henrikhodne][6] and [@lacostej][7] for making XcodeInstall C extension free.
|
|
@@ -139,6 +171,18 @@ project, especially [@henrikhodne][6] and [@lacostej][7] for making XcodeInstall
|
|
|
139
171
|
4. Push to the branch (`git push origin my-new-feature`)
|
|
140
172
|
5. Create a new Pull Request
|
|
141
173
|
|
|
174
|
+
### Running tests
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
bundle exec rake spec
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Running code style linter
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
bundle exec rubocop -a
|
|
184
|
+
```
|
|
185
|
+
|
|
142
186
|
## License
|
|
143
187
|
|
|
144
188
|
This project is licensed under the terms of the MIT license. See the [LICENSE](LICENSE) file.
|
data/bin//360/237/216/211
CHANGED
data/lib/xcode/install/cli.rb
CHANGED
|
@@ -5,7 +5,10 @@ module XcodeInstall
|
|
|
5
5
|
self.summary = 'Installs Xcode Command Line Tools.'
|
|
6
6
|
|
|
7
7
|
def run
|
|
8
|
-
|
|
8
|
+
if installed?
|
|
9
|
+
print 'Xcode CLI Tools are already installed.'
|
|
10
|
+
exit(0)
|
|
11
|
+
end
|
|
9
12
|
install
|
|
10
13
|
end
|
|
11
14
|
|
|
@@ -17,12 +17,14 @@ module XcodeInstall
|
|
|
17
17
|
['--no-install', 'Only download DMG, but do not install it.'],
|
|
18
18
|
['--no-progress', 'Don’t show download progress.'],
|
|
19
19
|
['--no-clean', 'Don’t delete DMG after installation.'],
|
|
20
|
-
['--no-show-release-notes', 'Don’t open release notes in browser after installation.']
|
|
20
|
+
['--no-show-release-notes', 'Don’t open release notes in browser after installation.'],
|
|
21
|
+
['--retry-download-count', 'Count of retrying download when curl is failed.']].concat(super)
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
def initialize(argv)
|
|
24
25
|
@installer = Installer.new
|
|
25
26
|
@version = argv.shift_argument
|
|
27
|
+
@version ||= File.read('.xcode-version') if File.exist?('.xcode-version')
|
|
26
28
|
@url = argv.option('url')
|
|
27
29
|
@force = argv.flag?('force', false)
|
|
28
30
|
@should_clean = argv.flag?('clean', true)
|
|
@@ -30,6 +32,7 @@ module XcodeInstall
|
|
|
30
32
|
@should_switch = argv.flag?('switch', true)
|
|
31
33
|
@progress = argv.flag?('progress', true)
|
|
32
34
|
@show_release_notes = argv.flag?('show-release-notes', true)
|
|
35
|
+
@retry_download_count = argv.option('retry-download-count', '3')
|
|
33
36
|
super
|
|
34
37
|
end
|
|
35
38
|
|
|
@@ -37,14 +40,18 @@ module XcodeInstall
|
|
|
37
40
|
super
|
|
38
41
|
|
|
39
42
|
help! 'A VERSION argument is required.' unless @version
|
|
40
|
-
|
|
43
|
+
if @installer.installed?(@version) && !@force
|
|
44
|
+
print "Version #{@version} already installed."
|
|
45
|
+
exit(0)
|
|
46
|
+
end
|
|
41
47
|
fail Informative, "Version #{@version} doesn't exist." unless @url || @installer.exist?(@version)
|
|
42
48
|
fail Informative, "Invalid URL: `#{@url}`" unless !@url || @url =~ /\A#{URI.regexp}\z/
|
|
49
|
+
fail Informative, "Invalid Retry: `#{@retry_download_count} is not positive number.`" if (@retry_download_count =~ /\A[0-9]*\z/).nil?
|
|
43
50
|
end
|
|
44
51
|
|
|
45
52
|
def run
|
|
46
53
|
@installer.install_version(@version, @should_switch, @should_clean, @should_install,
|
|
47
|
-
@progress, @url, @show_release_notes)
|
|
54
|
+
@progress, @url, @show_release_notes, nil, @retry_download_count.to_i)
|
|
48
55
|
end
|
|
49
56
|
end
|
|
50
57
|
end
|
data/lib/xcode/install/select.rb
CHANGED
|
@@ -8,9 +8,14 @@ module XcodeInstall
|
|
|
8
8
|
CLAide::Argument.new('VERSION', :true)
|
|
9
9
|
]
|
|
10
10
|
|
|
11
|
+
def self.options
|
|
12
|
+
[['--symlink', 'Update symlink in /Applications with selected Xcode']].concat(super)
|
|
13
|
+
end
|
|
14
|
+
|
|
11
15
|
def initialize(argv)
|
|
12
16
|
@installer = Installer.new
|
|
13
17
|
@version = argv.shift_argument
|
|
18
|
+
@should_symlink = argv.flag?('symlink', false)
|
|
14
19
|
super
|
|
15
20
|
end
|
|
16
21
|
|
|
@@ -23,7 +28,8 @@ module XcodeInstall
|
|
|
23
28
|
|
|
24
29
|
def run
|
|
25
30
|
xcode = @installer.installed_versions.detect { |v| v.version == @version }
|
|
26
|
-
`sudo xcode-select --switch #{xcode.path}`
|
|
31
|
+
`sudo xcode-select --switch "#{xcode.path}"`
|
|
32
|
+
@installer.symlink xcode.version if @should_symlink
|
|
27
33
|
end
|
|
28
34
|
end
|
|
29
35
|
end
|