xcode-install 0.3.3 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0315796b802e96968533cbd84beffd9196db6278
4
- data.tar.gz: 5f1e8191fdd093ce812d335917999e90455498e4
3
+ metadata.gz: 82276c486f016d15325b027bac509063ef807cba
4
+ data.tar.gz: 12791f86b6e6d6a43ff5f179381c6c44d7649bb3
5
5
  SHA512:
6
- metadata.gz: 6db340040ce85117495e443c0e39f05b3d617698e75aeb869717ffda3576c7b43c1e0162479f549383e7ed42401cc9a687bc59c5df989b24b0cbda3833a4bb15
7
- data.tar.gz: 76b48c89942caf99ad195c0d713efb023fc27fc1bde695cd5dc02646ab6fda85af2db1044673ae400e87b01da6ba8fa7b0e40a1d394c9a6abbc7336c2320c944
6
+ metadata.gz: 9c75ef419ed9ffe50f16716c642114c99ce294baf2343455f1fe5de79ed9bb2099df340d48cd9621f797f52b43bfdbfbd9f4b94a83ce3741ec18dd08eda1be92
7
+ data.tar.gz: f956fc36418324bb1f55c2afda840d314b569135bbbdd6bd83e45c635347b46f6731439397febbb3d91c13ead6735dc3e96d21422e645da010d6f2132cd14605
data/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ spec/fixtures/* linguist-documentation
data/README.md CHANGED
@@ -20,8 +20,13 @@ $ gem install xcode-install
20
20
 
21
21
  ## Usage
22
22
 
23
- XcodeInstall will ask for your credentials to access the Apple Developer Center, they are stored
24
- using the [CredentialsManager][1] of [Fastlane][2].
23
+ XcodeInstall needs environment variables with your credentials to access the Apple Developer
24
+ Center, they are stored using the [CredentialsManager][1] of [Fastlane][2]:
25
+
26
+ ```
27
+ XCODE_INSTALL_USER
28
+ XCODE_INSTALL_PASSWORD
29
+ ```
25
30
 
26
31
  To list available versions:
27
32
 
@@ -52,11 +57,15 @@ This will download and install that version of Xcode. It will also be automatica
52
57
 
53
58
  ## Limitations
54
59
 
55
- Because some dependencies uses C extensions, a working Xcode is required to actually install this gem (see [#17](../../issues/17)).
60
+ Unfortunately, the installation size of Xcodes downloaded will be bigger than when downloading via the Mac App Store, see [#10](/../../issues/10) and feel free to dupe the radar. 📡
56
61
 
57
- ![](http://i.giphy.com/aImJnc9F8Omzu.gif)
62
+ XcodeInstall automatically installs additional components so that it is immediately usable from the
63
+ commandline. Unfortunately, Xcode will load third-party plugins even in that situation, which leads
64
+ to a dialog popping up. Feel free to dupe [the radar][5]. 📡
58
65
 
59
- Unfortunately, the installation size of Xcodes downloaded will be bigger than when downloading via the Mac App Store, see [#10](/../../issues/10) and feel free to dupe the radar. 📡
66
+ XcodeInstall uses the Spotlight index to locate installed versions of Xcode. If you use it while
67
+ indexing is happening, it might show inaccurate results and it will not be able to see installed
68
+ versions on unindexed volumes.
60
69
 
61
70
  ## Thanks
62
71
 
@@ -72,7 +81,8 @@ for doing the installation.
72
81
  5. Create a new Pull Request
73
82
 
74
83
 
75
- [1]: https://github.com/KrauseFx/CredentialsManager
84
+ [1]: https://github.com/fastlane/credentials_manager#using-environment-variables
76
85
  [2]: http://fastlane.tools
77
86
  [3]: http://atastypixel.com/blog/resuming-adc-downloads-cos-safari-sucks/
78
87
  [4]: https://github.com/magneticbear/Jenkins_Bootstrap
88
+ [5]: http://www.openradar.me/22001810
data/lib/xcode/install.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'fileutils'
2
2
  require 'pathname'
3
3
  require 'spaceship'
4
- require 'nokogiri'
5
4
  require 'rubygems/version'
6
5
  require 'xcode/install/command'
7
6
  require 'xcode/install/version'
@@ -57,6 +56,10 @@ module XcodeInstall
57
56
  list_versions.include?(version)
58
57
  end
59
58
 
59
+ def install_components(xcode_path)
60
+ `#{xcode_path}/Contents/MacOS/Xcode -installComponents`
61
+ end
62
+
60
63
  def installed?(version)
61
64
  installed_versions.map(&:version).include?(version)
62
65
  end
@@ -75,7 +78,11 @@ module XcodeInstall
75
78
  source = Dir.glob('/Volumes/Xcode/Xcode*.app').first
76
79
 
77
80
  if source.nil?
78
- puts 'No `Xcode.app` found in DMG.'
81
+ $stderr.puts <<-HELP
82
+ No `Xcode.app` found in DMG. Please remove #{dmgPath} if you suspect a corrupted
83
+ download or run `xcode-install update` to see if the version you tried to install
84
+ has been pulled by Apple. If none of this is true, please open a new GH issue.
85
+ HELP
79
86
  return
80
87
  end
81
88
 
@@ -84,6 +91,7 @@ module XcodeInstall
84
91
 
85
92
  enable_developer_mode
86
93
  `sudo xcodebuild -license` unless xcode_license_approved?
94
+ install_components(xcode_path)
87
95
 
88
96
  if switch
89
97
  `sudo rm -f #{SYMLINK_PATH}` unless current_symlink.nil?
@@ -132,7 +140,16 @@ module XcodeInstall
132
140
 
133
141
  def spaceship
134
142
  @spaceship ||= begin
135
- Spaceship.login(ENV["XCODE_INSTALL_USER"], ENV["XCODE_INSTALL_PASSWORD"])
143
+ begin
144
+ Spaceship.login(ENV["XCODE_INSTALL_USER"], ENV["XCODE_INSTALL_PASSWORD"])
145
+ rescue Spaceship::Client::InvalidUserCredentialsError
146
+ $stderr.puts <<-HELP
147
+ Please provide your Apple developer account credentials via the
148
+ XCODE_INSTALL_USER and XCODE_INSTALL_PASSWORD environment variables.
149
+ HELP
150
+ exit(1)
151
+ end
152
+
136
153
  if ENV.key?("XCODE_INSTALL_TEAM_ID")
137
154
  Spaceship.client.team_id = ENV["XCODE_INSTALL_TEAM_ID"]
138
155
  end
@@ -181,6 +198,11 @@ module XcodeInstall
181
198
  end
182
199
 
183
200
  def installed
201
+ unless (`mdutil -s /` =~ /disabled/).nil?
202
+ $stderr.puts 'Please enable Spotlight indexing for /Applications.'
203
+ exit(1)
204
+ end
205
+
184
206
  `mdfind "kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'" 2>/dev/null`.split("\n")
185
207
  end
186
208
 
@@ -202,10 +224,10 @@ module XcodeInstall
202
224
  end
203
225
 
204
226
  def prereleases
205
- page = Nokogiri::HTML.parse(spaceship.send(:request, :get, '/xcode/downloads/').body)
206
- links = page.xpath('//a').select { |link| link['href'].end_with?('.dmg') }
227
+ body=spaceship.send(:request, :get, '/xcode/downloads/').body
228
+ links=body.scan(/<a.+?href="(.+?.dmg)".*>(.*)<\/a>/)
207
229
 
208
- links.map { |pre| Xcode.new_prelease(pre.text.strip.gsub(/.*Xcode /, ''), pre['href']) }
230
+ links.map { |pre| Xcode.new_prelease(pre[1].strip.gsub(/.*Xcode /, ''), pre[0]) }
209
231
  end
210
232
 
211
233
  def seedlist
@@ -24,6 +24,8 @@ module XcodeInstall
24
24
  end
25
25
 
26
26
  def validate!
27
+ super
28
+
27
29
  return if @version.nil?
28
30
  fail Informative, "Version #{@version} already installed." if @installer.installed?(@version)
29
31
  fail Informative, "Version #{@version} doesn't exist." unless @installer.exist?(@version)
@@ -11,9 +11,11 @@ module XcodeInstall
11
11
  def initialize(argv)
12
12
  @installer = Installer.new
13
13
  @version = argv.shift_argument
14
+ super
14
15
  end
15
16
 
16
17
  def validate!
18
+ super
17
19
  fail Informative, "Version #{@version} is not installed." unless @installer.installed?(@version)
18
20
  end
19
21
 
@@ -1,3 +1,3 @@
1
1
  module XcodeInstall
2
- VERSION = '0.3.3'
2
+ VERSION = '0.9.0'
3
3
  end
@@ -3,12 +3,12 @@ require File.expand_path('../spec_helper', __FILE__)
3
3
  module XcodeInstall
4
4
  describe Installer do
5
5
  def fixture(date)
6
- Nokogiri::HTML.parse(File.read("spec/fixtures/devcenter/xcode-#{date}.html"))
6
+ File.read("spec/fixtures/devcenter/xcode-#{date}.html")
7
7
  end
8
8
 
9
9
  def parse_prereleases(date)
10
10
  fixture = fixture(date)
11
- Nokogiri::HTML.stubs(:parse).returns(fixture)
11
+ @result.stubs(:body).returns(fixture)
12
12
 
13
13
  installer = Installer.new
14
14
  installer.send(:prereleases)
@@ -19,11 +19,11 @@ module XcodeInstall
19
19
  devcenter.stubs(:download_file).returns(nil)
20
20
  Installer.any_instance.stubs(:devcenter).returns(devcenter)
21
21
 
22
- result = mock
23
- result.stubs(:body).returns(nil)
22
+ @result = mock
23
+ @result.stubs(:body).returns(nil)
24
24
  client = mock
25
- client.stubs(:request).returns(result)
26
- Spaceship::Client.stubs(:login).returns(client)
25
+ client.stubs(:request).returns(@result)
26
+ Spaceship::PortalClient.stubs(:login).returns(client)
27
27
  end
28
28
 
29
29
  it 'can parse prereleases from 20150414' do
@@ -19,8 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.add_dependency 'claide', '~> 0.8.1'
22
- spec.add_dependency 'spaceship', '0.0.11'
23
- spec.add_dependency 'nokogiri', '~> 1.3'
22
+ spec.add_dependency 'spaceship', '~> 0.3.2'
24
23
 
25
24
  spec.add_development_dependency 'bundler', '~> 1.7'
26
25
  spec.add_development_dependency 'rake', '~> 10.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcode-install
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Bügling
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-14 00:00:00.000000000 Z
11
+ date: 2015-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide
@@ -26,32 +26,18 @@ dependencies:
26
26
  version: 0.8.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: spaceship
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '='
32
- - !ruby/object:Gem::Version
33
- version: 0.0.11
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '='
39
- - !ruby/object:Gem::Version
40
- version: 0.0.11
41
- - !ruby/object:Gem::Dependency
42
- name: nokogiri
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - ~>
46
32
  - !ruby/object:Gem::Version
47
- version: '1.3'
33
+ version: 0.3.2
48
34
  type: :runtime
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - ~>
53
39
  - !ruby/object:Gem::Version
54
- version: '1.3'
40
+ version: 0.3.2
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: bundler
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -88,6 +74,7 @@ executables:
88
74
  extensions: []
89
75
  extra_rdoc_files: []
90
76
  files:
77
+ - .gitattributes
91
78
  - .gitignore
92
79
  - .rubocop.yml
93
80
  - .travis.yml