xcode-install 0.3.2 → 0.3.3

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: e6b87f893b10cddae2347fdbd7efb04798a7a355
4
- data.tar.gz: 8e95f4459e1caca918bfb2ae5b466ccd522ea438
3
+ metadata.gz: 0315796b802e96968533cbd84beffd9196db6278
4
+ data.tar.gz: 5f1e8191fdd093ce812d335917999e90455498e4
5
5
  SHA512:
6
- metadata.gz: bc08c7e3e75b4107474e54e259c6700af820c614f57cd1976bfc608fdd1f23395276fb21c1f3f3911ff941f9b79074de4db7f07aa24c18a09e775c1b44ca6246
7
- data.tar.gz: 94e6b8ef8923103e2f030c54cfef8454d49ef034e1aa0823d87bf7c7298fffd23d7cb3d75ebc5748da85e848afafb3d341f1d51677c18ea93ec09ddc0703fee0
6
+ metadata.gz: 6db340040ce85117495e443c0e39f05b3d617698e75aeb869717ffda3576c7b43c1e0162479f549383e7ed42401cc9a687bc59c5df989b24b0cbda3833a4bb15
7
+ data.tar.gz: 76b48c89942caf99ad195c0d713efb023fc27fc1bde695cd5dc02646ab6fda85af2db1044673ae400e87b01da6ba8fa7b0e40a1d394c9a6abbc7336c2320c944
data/lib/xcode/install.rb CHANGED
@@ -1,50 +1,11 @@
1
- require 'fastlane_core'
2
- require 'fastlane_core/developer_center/developer_center'
1
+ require 'fileutils'
2
+ require 'pathname'
3
+ require 'spaceship'
3
4
  require 'nokogiri'
4
5
  require 'rubygems/version'
5
6
  require 'xcode/install/command'
6
7
  require 'xcode/install/version'
7
8
 
8
- module CredentialsManager
9
- class PasswordManager
10
- alias_method :old_ask_for_login, :ask_for_login
11
-
12
- def ask_for_login
13
- puts "\nXcodeInstall needs your developer AppleID credentials to access the DevCenter."
14
-
15
- old_ask_for_login
16
- end
17
- end
18
- end
19
-
20
- module FastlaneCore
21
- class DeveloperCenter
22
- def cookies
23
- cookie_string = ''
24
-
25
- page.driver.cookies.each do |_key, cookie|
26
- cookie_string << "#{cookie.name}=#{cookie.value};"
27
- end
28
-
29
- cookie_string
30
- end
31
-
32
- def download_seedlist
33
- JSON.parse(page.evaluate_script("$.ajax({data: { start: \"0\", limit: \"1000\", " \
34
- "sort: \"dateModified\", dir: \"DESC\", searchTextField: \"\", " \
35
- "searchCategories: \"\", search: \"false\" } , type: 'GET', " \
36
- "url: '/services-account/QH65B2/downloadws/listDownloads.action', " \
37
- 'async: false})')['responseText'])
38
- end
39
- end
40
-
41
- module Helper
42
- def self.is_test?
43
- true
44
- end
45
- end
46
- end
47
-
48
9
  module XcodeInstall
49
10
  class Curl
50
11
  COOKIES_PATH = Pathname.new('/tmp/curl-cookies.txt')
@@ -88,7 +49,7 @@ module XcodeInstall
88
49
  xcode = seedlist.find { |x| x.name == version }
89
50
  dmg_file = Pathname.new(File.basename(xcode.path))
90
51
 
91
- result = Curl.new.fetch(xcode.url, CACHE_DIR, devcenter.cookies, dmg_file)
52
+ result = Curl.new.fetch(xcode.url, CACHE_DIR, spaceship.cookie, dmg_file)
92
53
  result ? CACHE_DIR + dmg_file : nil
93
54
  end
94
55
 
@@ -135,12 +96,12 @@ module XcodeInstall
135
96
  FileUtils.rm_f(dmgPath) if clean
136
97
  end
137
98
 
138
- def install_version(version, switch = true, clean = true)
99
+ def install_version(version, switch = true, clean = true, install = true)
139
100
  return if version.nil?
140
101
  dmg_path = get_dmg(version)
141
102
  fail Informative, "Failed to download Xcode #{version}." if dmg_path.nil?
142
103
 
143
- install_dmg(dmg_path, "-#{version.split(' ')[0]}", switch, clean)
104
+ install_dmg(dmg_path, "-#{version.split(' ')[0]}", switch, clean) if install
144
105
  end
145
106
 
146
107
  def list_current
@@ -169,15 +130,21 @@ module XcodeInstall
169
130
 
170
131
  private
171
132
 
133
+ def spaceship
134
+ @spaceship ||= begin
135
+ Spaceship.login(ENV["XCODE_INSTALL_USER"], ENV["XCODE_INSTALL_PASSWORD"])
136
+ if ENV.key?("XCODE_INSTALL_TEAM_ID")
137
+ Spaceship.client.team_id = ENV["XCODE_INSTALL_TEAM_ID"]
138
+ end
139
+ Spaceship.client
140
+ end
141
+ end
142
+
172
143
  CACHE_DIR = Pathname.new("#{ENV['HOME']}/Library/Caches/XcodeInstall")
173
144
  LIST_FILE = CACHE_DIR + Pathname.new('xcodes.bin')
174
145
  MINIMUM_VERSION = Gem::Version.new('4.3')
175
146
  SYMLINK_PATH = Pathname.new('/Applications/Xcode.app')
176
147
 
177
- def devcenter
178
- @devcenter ||= FastlaneCore::DeveloperCenter.new
179
- end
180
-
181
148
  def enable_developer_mode
182
149
  `sudo /usr/sbin/DevToolsSecurity -enable`
183
150
  `sudo /usr/sbin/dseditgroup -o edit -t group -a staff _developer`
@@ -193,7 +160,15 @@ module XcodeInstall
193
160
  end
194
161
 
195
162
  def fetch_seedlist
196
- @xcodes = parse_seedlist(devcenter.download_seedlist)
163
+ @xcodes = parse_seedlist(spaceship.send(:request, :get, '/services-account/QH65B2/downloadws/listDownloads.action', {
164
+ start: "0",
165
+ limit: "1000",
166
+ sort: "dateModified",
167
+ dir: "DESC",
168
+ searchTextField: "",
169
+ searchCategories: "",
170
+ search: "false",
171
+ }).body)
197
172
 
198
173
  names = @xcodes.map(&:name)
199
174
  @xcodes += prereleases.reject { |pre| names.include?(pre.name) }
@@ -227,7 +202,7 @@ module XcodeInstall
227
202
  end
228
203
 
229
204
  def prereleases
230
- page = Nokogiri::HTML.parse(devcenter.download_file('/xcode/downloads/'))
205
+ page = Nokogiri::HTML.parse(spaceship.send(:request, :get, '/xcode/downloads/').body)
231
206
  links = page.xpath('//a').select { |link| link['href'].end_with?('.dmg') }
232
207
 
233
208
  links.map { |pre| Xcode.new_prelease(pre.text.strip.gsub(/.*Xcode /, ''), pre['href']) }
@@ -10,6 +10,7 @@ module XcodeInstall
10
10
 
11
11
  def self.options
12
12
  [['--no-switch', 'Don’t switch to this version after installation'],
13
+ ['--no-install', 'Only download DMG, but do not install it.'],
13
14
  ['--no-clean', 'Don’t delete DMG after installation.']].concat(super)
14
15
  end
15
16
 
@@ -17,6 +18,7 @@ module XcodeInstall
17
18
  @installer = Installer.new
18
19
  @version = argv.shift_argument
19
20
  @should_clean = argv.flag?('clean', true)
21
+ @should_install = argv.flag?('install', true)
20
22
  @should_switch = argv.flag?('switch', true)
21
23
  super
22
24
  end
@@ -29,7 +31,7 @@ module XcodeInstall
29
31
 
30
32
  def run
31
33
  return if @version.nil?
32
- @installer.install_version(@version, @should_switch, @should_clean)
34
+ @installer.install_version(@version, @should_switch, @should_clean, @should_install)
33
35
  end
34
36
  end
35
37
  end
@@ -1,3 +1,3 @@
1
1
  module XcodeInstall
2
- VERSION = '0.3.2'
2
+ VERSION = '0.3.3'
3
3
  end
@@ -18,6 +18,12 @@ module XcodeInstall
18
18
  devcenter = mock
19
19
  devcenter.stubs(:download_file).returns(nil)
20
20
  Installer.any_instance.stubs(:devcenter).returns(devcenter)
21
+
22
+ result = mock
23
+ result.stubs(:body).returns(nil)
24
+ client = mock
25
+ client.stubs(:request).returns(result)
26
+ Spaceship::Client.stubs(:login).returns(client)
21
27
  end
22
28
 
23
29
  it 'can parse prereleases from 20150414' do
@@ -19,7 +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 'fastlane_core', '~> 0.5.0'
22
+ spec.add_dependency 'spaceship', '0.0.11'
23
23
  spec.add_dependency 'nokogiri', '~> 1.3'
24
24
 
25
25
  spec.add_development_dependency 'bundler', '~> 1.7'
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.2
4
+ version: 0.3.3
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-06-24 00:00:00.000000000 Z
11
+ date: 2015-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.8.1
27
27
  - !ruby/object:Gem::Dependency
28
- name: fastlane_core
28
+ name: spaceship
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.5.0
33
+ version: 0.0.11
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.5.0
40
+ version: 0.0.11
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: nokogiri
43
43
  requirement: !ruby/object:Gem::Requirement