xcode-install 0.2.0 → 0.3.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: 07bf6a5e12986899c2838cfaa033a800cd926f3b
4
- data.tar.gz: 4ad83829d78ba4f4e5f7519ff150c4ac9958298e
3
+ metadata.gz: fc28280820fe62413795965ee4b361d46b7aaff7
4
+ data.tar.gz: df8eab78dbaf502ac3006c2dc8d070a0562e4c70
5
5
  SHA512:
6
- metadata.gz: a9be63a2ef0f3a58331eb6c1e07bfad285bf14023a832863d16f755f13557b2a5a6a5781724f54bcfd0f73ac3e847d6a4127e11d7d88dd866e286e09518a6592
7
- data.tar.gz: 8d1f06026a27dbdd3571a6e13dfc2b9fb0499cdedcbc166b4911c516a5b7fa70f4a111f772f67eb8786eda15844cd60617731a63ceebece9b7beea393dfbb481
6
+ metadata.gz: f7aa0c1185455dc2edf0f2e63fd4b49262202e36a2941c74d8cc16eaf7b237ffddac48cbffd2331338efc310d558038ea0fb5c49ecfe22abd06d3998f45004cd
7
+ data.tar.gz: 299a9e10235efe65b101330cbfae0f8c1016c89d9c2d7fdf6fba67812acf5e8be498517e1c960ba52b5953f6a2d6ddb198782e2454ec642c4b458653462714e2
data/lib/xcode/install.rb CHANGED
@@ -18,11 +18,11 @@ module FastlaneCore
18
18
  end
19
19
 
20
20
  def download_seedlist
21
- # categories: Applications%2CDeveloper%20Tools%2CiOS%2COS%20X%2COS%20X%20Server%2CSafari
22
21
  JSON.parse(page.evaluate_script("$.ajax({data: { start: \"0\", limit: \"1000\", " +
23
22
  "sort: \"dateModified\", dir: \"DESC\", searchTextField: \"\", " +
24
- "searchCategories: \"\", search: \"false\" } , type: 'POST', " +
25
- "url: '/downloads/seedlist.action', async: false})")['responseText'])
23
+ "searchCategories: \"\", search: \"false\" } , type: 'GET', " +
24
+ "url: '/services-account/QH65B2/downloadws/listDownloads.action', " +
25
+ "async: false})")['responseText'])
26
26
  end
27
27
  end
28
28
 
@@ -123,6 +123,14 @@ module XcodeInstall
123
123
  FileUtils.rm_f(dmgPath) if clean
124
124
  end
125
125
 
126
+ def install_version(version, switch = true, clean = true)
127
+ return if version.nil?
128
+ dmg_path = get_dmg(version)
129
+ raise Informative, "Failed to download Xcode #{version}." if dmg_path.nil?
130
+
131
+ install_dmg(dmg_path, "-#{version.split(' ')[0]}", switch, clean)
132
+ end
133
+
126
134
  def list_current
127
135
  majors = list_versions.map { |v| v.split('.')[0] }.select { |v| v.length == 1 }.uniq
128
136
  list_versions.select { |v| v.start_with?(majors.last) }.join("\n")
@@ -146,7 +154,7 @@ module XcodeInstall
146
154
  File.absolute_path(File.readlink(current_symlink), SYMLINK_PATH.dirname) if current_symlink
147
155
  end
148
156
 
149
- :private
157
+ private
150
158
 
151
159
  CACHE_DIR = Pathname.new("#{ENV['HOME']}/Library/Caches/XcodeInstall")
152
160
  LIST_FILE = CACHE_DIR + Pathname.new('xcodes.bin')
@@ -162,6 +170,17 @@ module XcodeInstall
162
170
  `sudo /usr/sbin/dseditgroup -o edit -t group -a staff _developer`
163
171
  end
164
172
 
173
+ def get_dmg(version)
174
+ if ENV.key?("XCODE_INSTALL_CACHE_DIR")
175
+ cache_path = Pathname.new(ENV["XCODE_INSTALL_CACHE_DIR"]) + Pathname.new("xcode-#{version}.dmg")
176
+ if cache_path.exist?
177
+ return cache_path
178
+ end
179
+ end
180
+
181
+ return download(version)
182
+ end
183
+
165
184
  def get_seedlist
166
185
  @xcodes = parse_seedlist(devcenter.download_seedlist)
167
186
 
@@ -180,7 +199,7 @@ module XcodeInstall
180
199
  end
181
200
 
182
201
  def parse_seedlist(seedlist)
183
- seedlist['data'].select {
202
+ seedlist['downloads'].select {
184
203
  |t| /^Xcode [0-9]/.match(t['name'])
185
204
  }.map { |x| Xcode.new(x) }.reject { |x| x.version < MINIMUM_VERSION }.sort {
186
205
  |a,b| a.dateModified <=> b.dateModified
@@ -29,10 +29,7 @@ module XcodeInstall
29
29
 
30
30
  def run
31
31
  return if @version.nil?
32
- dmgPath = @installer.download(@version)
33
- raise Informative, "Failed to download Xcode #{@version}." if dmgPath.nil?
34
-
35
- @installer.install_dmg(dmgPath, "-#{@version.split(' ')[0]}", @should_switch, @should_clean)
32
+ @installer.install_version(@version, @should_switch, @should_clean)
36
33
  end
37
34
  end
38
35
  end
@@ -1,3 +1,3 @@
1
1
  module XcodeInstall
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -11,7 +11,7 @@ module XcodeInstall
11
11
  Nokogiri::HTML.stubs(:parse).returns(fixture)
12
12
 
13
13
  installer = Installer.new
14
- installer.prereleases
14
+ installer.send(:prereleases)
15
15
  end
16
16
 
17
17
  before do
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.2.0
4
+ version: 0.3.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-05-08 00:00:00.000000000 Z
11
+ date: 2015-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide