xcode-install 0.9.0 → 0.9.1

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: 82276c486f016d15325b027bac509063ef807cba
4
- data.tar.gz: 12791f86b6e6d6a43ff5f179381c6c44d7649bb3
3
+ metadata.gz: ff9a825792c85a007a8c6436cdf95d80218039b5
4
+ data.tar.gz: 3d908af8cb1cfd488e598097ab1e4855f430a044
5
5
  SHA512:
6
- metadata.gz: 9c75ef419ed9ffe50f16716c642114c99ce294baf2343455f1fe5de79ed9bb2099df340d48cd9621f797f52b43bfdbfbd9f4b94a83ce3741ec18dd08eda1be92
7
- data.tar.gz: f956fc36418324bb1f55c2afda840d314b569135bbbdd6bd83e45c635347b46f6731439397febbb3d91c13ead6735dc3e96d21422e645da010d6f2132cd14605
6
+ metadata.gz: 21bde96d3a74753b3da4cda7a734098910c9c376de969e00b436ea01deb32d294005aa43cdbd983bfc9d1787e85222afd128a4602736a58431f9024f684074ed
7
+ data.tar.gz: 8a94316af2ec67a3a696805d2f1a9885c13795d84426eb10a4b410b590fbe573454683283cad6093b5c8c1c569c5b8d8e3299b14e5e7a6d3c3eb344c2b2d3b74
data/README.md CHANGED
@@ -70,7 +70,8 @@ versions on unindexed volumes.
70
70
  ## Thanks
71
71
 
72
72
  [This][3] downloading script which has been used for some inspiration, also [this][4]
73
- for doing the installation.
73
+ for doing the installation. Additionally, many thanks to everyone who has contributed to this
74
+ project, especially [@henrikhodne][6] and [@lacostej][7] for making XcodeInstall C extension free.
74
75
 
75
76
  ## Contributing
76
77
 
@@ -86,3 +87,5 @@ for doing the installation.
86
87
  [3]: http://atastypixel.com/blog/resuming-adc-downloads-cos-safari-sucks/
87
88
  [4]: https://github.com/magneticbear/Jenkins_Bootstrap
88
89
  [5]: http://www.openradar.me/22001810
90
+ [6]: https://github.com/henrikhodne
91
+ [7]: https://github.com/lacostej
data/lib/xcode/install.rb CHANGED
@@ -9,7 +9,7 @@ module XcodeInstall
9
9
  class Curl
10
10
  COOKIES_PATH = Pathname.new('/tmp/curl-cookies.txt')
11
11
 
12
- def fetch(url, directory = nil, cookies = nil, output = nil)
12
+ def fetch(url, directory = nil, cookies = nil, output = nil, progress = true)
13
13
  options = cookies.nil? ? '' : "-b '#{cookies}' -c #{COOKIES_PATH}"
14
14
  # options += ' -vvv'
15
15
 
@@ -17,7 +17,8 @@ module XcodeInstall
17
17
  output ||= File.basename(uri.path)
18
18
  output = (Pathname.new(directory) + Pathname.new(output)) if directory
19
19
 
20
- command = "curl #{options} -L -C - -# -o #{output} #{url}"
20
+ progress = progress ? '-#' : '-s'
21
+ command = "curl #{options} -L -C - #{progress} -o #{output} #{url}"
21
22
  IO.popen(command).each do |fd|
22
23
  puts(fd)
23
24
  end
@@ -43,12 +44,12 @@ module XcodeInstall
43
44
  File.symlink?(SYMLINK_PATH) ? SYMLINK_PATH : nil
44
45
  end
45
46
 
46
- def download(version)
47
+ def download(version, progress)
47
48
  return unless exist?(version)
48
49
  xcode = seedlist.find { |x| x.name == version }
49
50
  dmg_file = Pathname.new(File.basename(xcode.path))
50
51
 
51
- result = Curl.new.fetch(xcode.url, CACHE_DIR, spaceship.cookie, dmg_file)
52
+ result = Curl.new.fetch(xcode.url, CACHE_DIR, spaceship.cookie, dmg_file, progress)
52
53
  result ? CACHE_DIR + dmg_file : nil
53
54
  end
54
55
 
@@ -104,9 +105,9 @@ HELP
104
105
  FileUtils.rm_f(dmgPath) if clean
105
106
  end
106
107
 
107
- def install_version(version, switch = true, clean = true, install = true)
108
+ def install_version(version, switch = true, clean = true, install = true, progress = true)
108
109
  return if version.nil?
109
- dmg_path = get_dmg(version)
110
+ dmg_path = get_dmg(version, progress)
110
111
  fail Informative, "Failed to download Xcode #{version}." if dmg_path.nil?
111
112
 
112
113
  install_dmg(dmg_path, "-#{version.split(' ')[0]}", switch, clean) if install
@@ -143,6 +144,9 @@ HELP
143
144
  begin
144
145
  Spaceship.login(ENV["XCODE_INSTALL_USER"], ENV["XCODE_INSTALL_PASSWORD"])
145
146
  rescue Spaceship::Client::InvalidUserCredentialsError
147
+ $stderr.puts 'The specified Apple developer account credentials are incorrect.'
148
+ exit(1)
149
+ rescue Spaceship::Client::NoUserCredentialsError
146
150
  $stderr.puts <<-HELP
147
151
  Please provide your Apple developer account credentials via the
148
152
  XCODE_INSTALL_USER and XCODE_INSTALL_PASSWORD environment variables.
@@ -167,13 +171,13 @@ HELP
167
171
  `sudo /usr/sbin/dseditgroup -o edit -t group -a staff _developer`
168
172
  end
169
173
 
170
- def get_dmg(version)
174
+ def get_dmg(version, progress = true)
171
175
  if ENV.key?('XCODE_INSTALL_CACHE_DIR')
172
176
  cache_path = Pathname.new(ENV['XCODE_INSTALL_CACHE_DIR']) + Pathname.new("xcode-#{version}.dmg")
173
177
  return cache_path if cache_path.exist?
174
178
  end
175
179
 
176
- download(version)
180
+ download(version, progress)
177
181
  end
178
182
 
179
183
  def fetch_seedlist
@@ -8,7 +8,7 @@ module XcodeInstall
8
8
 
9
9
  class Informative < PlainInformative
10
10
  def message
11
- "[!] #{super}".red
11
+ "[!] #{super}".ansi.red
12
12
  end
13
13
  end
14
14
 
@@ -11,6 +11,7 @@ module XcodeInstall
11
11
  def self.options
12
12
  [['--no-switch', 'Don’t switch to this version after installation'],
13
13
  ['--no-install', 'Only download DMG, but do not install it.'],
14
+ ['--no-progress', 'Don’t show download progress.'],
14
15
  ['--no-clean', 'Don’t delete DMG after installation.']].concat(super)
15
16
  end
16
17
 
@@ -20,6 +21,7 @@ module XcodeInstall
20
21
  @should_clean = argv.flag?('clean', true)
21
22
  @should_install = argv.flag?('install', true)
22
23
  @should_switch = argv.flag?('switch', true)
24
+ @progress = argv.flag?('progress', true)
23
25
  super
24
26
  end
25
27
 
@@ -33,7 +35,7 @@ module XcodeInstall
33
35
 
34
36
  def run
35
37
  return if @version.nil?
36
- @installer.install_version(@version, @should_switch, @should_clean, @should_install)
38
+ @installer.install_version(@version, @should_switch, @should_clean, @should_install, @progress)
37
39
  end
38
40
  end
39
41
  end
@@ -1,3 +1,3 @@
1
1
  module XcodeInstall
2
- VERSION = '0.9.0'
2
+ VERSION = '0.9.1'
3
3
  end
data/spec/install_spec.rb CHANGED
@@ -11,15 +11,21 @@ module XcodeInstall
11
11
  end
12
12
 
13
13
  it 'downloads and installs' do
14
- Installer.any_instance.expects(:download).with('6.3').returns('/some/path')
14
+ Installer.any_instance.expects(:download).with('6.3', true).returns('/some/path')
15
15
  Installer.any_instance.expects(:install_dmg).with('/some/path', '-6.3', true, true)
16
16
  Command::Install.run(['6.3'])
17
17
  end
18
18
 
19
19
  it 'downloads and installs and does not switch if --no-switch given' do
20
- Installer.any_instance.expects(:download).with('6.3').returns('/some/path')
20
+ Installer.any_instance.expects(:download).with('6.3', true).returns('/some/path')
21
21
  Installer.any_instance.expects(:install_dmg).with('/some/path', '-6.3', false, true)
22
22
  Command::Install.run(['6.3', '--no-switch'])
23
23
  end
24
+
25
+ it 'downloads without progress if switch --no-progress is given' do
26
+ Installer.any_instance.expects(:download).with('6.3', false).returns('/some/path')
27
+ Installer.any_instance.expects(:install_dmg).with('/some/path', '-6.3', true, true)
28
+ Command::Install.run(['6.3', '--no-progress'])
29
+ end
24
30
  end
25
31
  end
@@ -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 'spaceship', '~> 0.3.2'
22
+ spec.add_dependency 'spaceship', '~> 0.3.3'
23
23
 
24
24
  spec.add_development_dependency 'bundler', '~> 1.7'
25
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.9.0
4
+ version: 0.9.1
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-26 00:00:00.000000000 Z
11
+ date: 2015-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 0.3.2
33
+ version: 0.3.3
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.3.2
40
+ version: 0.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement