xcode-install 1.2.0 → 1.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 43d37a17db67d22edd50424ccf56a2e88fdfe46a
4
- data.tar.gz: 5a5adb23dc67519d513176a1ed796c9aa54e5c1f
3
+ metadata.gz: bbe119d0e500ca2bd3f40878365d9feccc766d78
4
+ data.tar.gz: 8e910ab1e30bbc5b66b21ea20a25b40647ebc646
5
5
  SHA512:
6
- metadata.gz: 4dc978f5f136e1a621e3a7cbf293d2292dc0e9e00d20f9b0338daa28c37c849742a5c3b8d7f7a9e831f12eca4ac892faacdf938117d8a8100446b42c1467b5a8
7
- data.tar.gz: 39ed9aa06b63e5d65c357752898783a80095eb6e1f3311079371a650c6e37e959d5f27575ab9f21b781c5f853af1d21470dbf3fcd670dbce2f623a906b5f3bd8
6
+ metadata.gz: 7d3de0a500322bc15c834d00093a05cf206e0040b7dbd71a7d722dda859e9349e9a76f5fb8a65afdb11977c120c623bacc4721a7d512e9b0b9e94d30ac47984f
7
+ data.tar.gz: a890daa46eddcfdb241b2dc07fef0fda2f3683ca056f7d36d62a75683374d50942ce0229619776331b4307e268f1bfc5fb1fdb4792f2dec46f530cc7ee445a7f
data/.gitignore CHANGED
@@ -12,3 +12,4 @@
12
12
  *.o
13
13
  *.a
14
14
  mkmf.log
15
+ .DS_Store
data/.rubocop_todo.yml CHANGED
@@ -28,3 +28,8 @@ Metrics/MethodLength:
28
28
  # Configuration parameters: CountKeywordArgs.
29
29
  Metrics/ParameterLists:
30
30
  Max: 6
31
+
32
+ # FIXME: for spaceship workaround
33
+ Lint/HandleExceptions:
34
+ Exclude:
35
+ - 'lib/xcode/install.rb'
data/Gemfile CHANGED
@@ -7,6 +7,6 @@ group :development do
7
7
  gem 'mocha-on-bacon'
8
8
  gem 'mocha', '~> 0.11.4'
9
9
  gem 'prettybacon'
10
- gem 'rubocop'
10
+ gem 'rubocop', '0.35.1'
11
11
  gem 'coveralls', require: false
12
12
  end
data/README.md CHANGED
@@ -18,6 +18,15 @@ $ xcversion install 6.3
18
18
  $ gem install xcode-install
19
19
  ```
20
20
 
21
+ Note: unfortunately, XcodeInstall has a transitive dependency on a gem with native extensions and this is not really fixable at this point in time. If you are installing this on a machine without a working compiler, please use these alternative instructions instead:
22
+
23
+ ```
24
+ $ curl -sL -O https://github.com/neonichu/ruby-domain_name/releases/download/v0.5.99999999/domain_name-0.5.99999999.gem
25
+ $ gem install domain_name-0.5.99999999.gem
26
+ $ gem install --conservative xcode-install
27
+ $ rm -f domain_name-0.5.99999999.gem
28
+ ```
29
+
21
30
  ## Usage
22
31
 
23
32
  XcodeInstall needs environment variables with your credentials to access the Apple Developer
@@ -39,7 +48,7 @@ $ xcversion list
39
48
  6.3
40
49
  ```
41
50
 
42
- By default, only the latest major version is listed.
51
+ Installed versions will be omitted and by default, only the latest major version is listed.
43
52
 
44
53
  To install a certain version, simply:
45
54
 
@@ -75,22 +84,26 @@ XcodeInstall can also manage your local simulators using the `simulators` comman
75
84
 
76
85
  ```
77
86
  $ xcversion simulators
78
- Xcode 6.4.0 (/Applications/Xcode.app)
87
+ Xcode 6.4 (/Applications/Xcode-6.4.app)
79
88
  iOS 7.1 Simulator (installed)
80
89
  iOS 8.1 Simulator (not installed)
81
90
  iOS 8.2 Simulator (not installed)
82
91
  iOS 8.3 Simulator (installed)
83
- Xcode 7.0.0 (/Applications/Xcode-beta.app)
92
+ Xcode 7.2.1 (/Applications/Xcode-7.2.1.app)
84
93
  iOS 8.1 Simulator (not installed)
85
94
  iOS 8.2 Simulator (not installed)
86
95
  iOS 8.3 Simulator (installed)
87
- iOS 8.4 Simulator (installed)
96
+ iOS 8.4 Simulator (not installed)
97
+ iOS 9.0 Simulator (not installed)
98
+ iOS 9.1 Simulator (not installed)
99
+ tvOS 9.0 Simulator (not installed)
100
+ watchOS 2.0 Simulator (installed)
88
101
  ```
89
102
 
90
- To install a simulator, simply:
103
+ To install a simulator, use `--install` and the beginning of a simulator name:
91
104
 
92
105
  ```
93
- $ xcversion simulators --install=8.4
106
+ $ xcversion simulators --install='iOS 8.4'
94
107
  ########################################################### 82.1%
95
108
  ######################################################################## 100.0%
96
109
  Please authenticate to install iOS 8.4 Simulator...
@@ -10,8 +10,7 @@ module XcodeInstall
10
10
  end
11
11
 
12
12
  def installed?
13
- `xcode-select -p`
14
- $?.success?
13
+ File.exist?('/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib')
15
14
  end
16
15
 
17
16
  def install
@@ -12,6 +12,7 @@ module XcodeInstall
12
12
 
13
13
  def self.options
14
14
  [['--url', 'Custom Xcode DMG file path or HTTP URL.'],
15
+ ['--force', 'Install even if the same version is already installed.'],
15
16
  ['--no-switch', 'Don’t switch to this version after installation'],
16
17
  ['--no-install', 'Only download DMG, but do not install it.'],
17
18
  ['--no-progress', 'Don’t show download progress.'],
@@ -22,6 +23,7 @@ module XcodeInstall
22
23
  @installer = Installer.new
23
24
  @version = argv.shift_argument
24
25
  @url = argv.option('url')
26
+ @force = argv.flag?('force', false)
25
27
  @should_clean = argv.flag?('clean', true)
26
28
  @should_install = argv.flag?('install', true)
27
29
  @should_switch = argv.flag?('switch', true)
@@ -32,8 +34,8 @@ module XcodeInstall
32
34
  def validate!
33
35
  super
34
36
 
35
- return if @version.nil?
36
- fail Informative, "Version #{@version} already installed." if @installer.installed?(@version)
37
+ help! 'A VERSION argument is required.' unless @version
38
+ fail Informative, "Version #{@version} already installed." if @installer.installed?(@version) && !@force
37
39
  fail Informative, "Version #{@version} doesn't exist." unless @installer.exist?(@version)
38
40
  fail Informative, "Invalid URL: `#{@url}`" unless !@url || @url =~ /\A#{URI.regexp}\z/
39
41
  end
@@ -7,7 +7,7 @@ module XcodeInstall
7
7
  self.summary = 'List or install iOS simulators.'
8
8
 
9
9
  def self.options
10
- [['--install=version', 'Install simulator with the given version.']].concat(super)
10
+ [['--install=name', 'Install simulator beginning with name, e.g. \'iOS 8.4\', \'tvOS 9.0\'.']].concat(super)
11
11
  end
12
12
 
13
13
  def initialize(argv)
@@ -24,8 +24,8 @@ module XcodeInstall
24
24
  :private
25
25
 
26
26
  def install
27
- filtered_simulators = @installed_xcodes.map(&:available_simulators).flatten.select do |sim|
28
- sim.version.to_s.start_with?(@install)
27
+ filtered_simulators = @installed_xcodes.map(&:available_simulators).flatten.uniq(&:name).select do |sim|
28
+ sim.name.start_with?(@install)
29
29
  end
30
30
  case filtered_simulators.count
31
31
  when 0
@@ -41,7 +41,7 @@ module XcodeInstall
41
41
  puts "[!] More than one simulator matching #{@install} was found. Please specify the full version.".ansi.red
42
42
  filtered_simulators.each do |candidate|
43
43
  puts "Xcode #{candidate.xcode.bundle_version} (#{candidate.xcode.path})".ansi.green
44
- puts "xcode-install candidate --install=#{candidate.version}"
44
+ puts "xcversion simulators --install=#{candidate.name}"
45
45
  end
46
46
  exit 1
47
47
  end
@@ -16,6 +16,8 @@ module XcodeInstall
16
16
 
17
17
  def validate!
18
18
  super
19
+ help! 'A VERSION argument is required.' unless @version
20
+
19
21
  fail Informative, "Version #{@version} is not installed." unless @installer.installed?(@version)
20
22
  end
21
23
 
@@ -1,3 +1,3 @@
1
1
  module XcodeInstall
2
- VERSION = '1.2.0'
2
+ VERSION = '1.3.0'.freeze
3
3
  end
data/lib/xcode/install.rb CHANGED
@@ -53,7 +53,7 @@ module XcodeInstall
53
53
  xcode = seedlist.find { |x| x.name == version }
54
54
  dmg_file = Pathname.new(File.basename(url || xcode.path))
55
55
 
56
- result = Curl.new.fetch(url || xcode.url, CACHE_DIR, spaceship.cookie, dmg_file, progress)
56
+ result = Curl.new.fetch(url || xcode.url, CACHE_DIR, url ? nil : spaceship.cookie, dmg_file, progress)
57
57
  result ? CACHE_DIR + dmg_file : nil
58
58
  end
59
59
 
@@ -127,14 +127,20 @@ HELP
127
127
  `open #{xcode.release_notes_url}` unless xcode.nil? || xcode.release_notes_url.nil?
128
128
  end
129
129
 
130
+ def list_annotated(xcodes_list)
131
+ installed = installed_versions.map(&:version)
132
+ xcodes_list.map { |x| installed.include?(x) ? "#{x} (installed)" : x }.join("\n")
133
+ end
134
+
130
135
  def list_current
131
136
  stable_majors = list_versions.reject { |v| /beta/i =~ v }.map { |v| v.split('.')[0] }.map { |v| v.split(' ')[0] }
132
137
  latest_stable_major = stable_majors.select { |v| v.length == 1 }.uniq.sort.last.to_i
133
- list_versions.select { |v| v.split('.')[0].to_i >= latest_stable_major }.sort.join("\n")
138
+ current_versions = list_versions.select { |v| v.split('.')[0].to_i >= latest_stable_major }.sort
139
+ list_annotated(current_versions)
134
140
  end
135
141
 
136
142
  def list
137
- list_versions.join("\n")
143
+ list_annotated(list_versions.sort)
138
144
  end
139
145
 
140
146
  def rm_list_cache
@@ -151,6 +157,14 @@ HELP
151
157
  File.absolute_path(File.readlink(current_symlink), SYMLINK_PATH.dirname) if current_symlink
152
158
  end
153
159
 
160
+ def mount(dmg_path)
161
+ plist = hdiutil('mount', '-plist', '-nobrowse', '-noverify', dmg_path.to_s)
162
+ document = REXML::Document.new(plist)
163
+ node = REXML::XPath.first(document, "//key[.='mount-point']/following-sibling::*[1]")
164
+ fail Informative, 'Failed to mount image.' unless node
165
+ node.text
166
+ end
167
+
154
168
  private
155
169
 
156
170
  def spaceship
@@ -240,8 +254,7 @@ HELP
240
254
  end
241
255
 
242
256
  def list_versions
243
- installed = installed_versions.map(&:version)
244
- seedlist.map(&:name).reject { |x| installed.include?(x) }
257
+ seedlist.map(&:name)
245
258
  end
246
259
 
247
260
  def prereleases
@@ -276,14 +289,6 @@ HELP
276
289
  fail Informative, 'Failed to invoke hdiutil.' unless $?.exitstatus == 0
277
290
  result
278
291
  end
279
-
280
- def mount(dmg_path)
281
- plist = hdiutil('mount', '-plist', '-nobrowse', '-noverify', dmg_path.to_s)
282
- document = REXML::Document.new(plist)
283
- node = REXML::XPath.first(document, "//key[.='mount-point']/following-sibling::*[1]")
284
- fail Informative, 'Failed to mount image.' unless node
285
- node.text
286
- end
287
292
  end
288
293
 
289
294
  class Simulator
@@ -345,7 +350,7 @@ HELP
345
350
 
346
351
  def prepare_package
347
352
  puts 'Mounting DMG'
348
- mount_location = mount(dmg_path)
353
+ mount_location = Installer.new.mount(dmg_path)
349
354
  puts 'Expanding pkg'
350
355
  expanded_pkg_path = CACHE_DIR + identifier
351
356
  FileUtils.rm_rf(expanded_pkg_path)
@@ -0,0 +1,12 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ module XcodeInstall
4
+ describe Command::Uninstall do
5
+ describe 'when invoked' do
6
+ it 'raise error when the version is not specified' do
7
+ Command::Uninstall.any_instance.expects(:help!)
8
+ -> { Command::Uninstall.run([]) }.should.raise(Exception)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
20
20
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_dependency 'claide', '~> 0.9.1'
24
- spec.add_dependency 'spaceship', '>= 0.13.0', '< 1.0.0'
23
+ spec.add_dependency 'claide', '>= 0.9.1', '< 1.1.0'
24
+ spec.add_dependency 'spaceship', '>= 0.25.1', '< 1.0.0'
25
25
 
26
26
  spec.add_development_dependency 'bundler', '~> 1.7'
27
27
  spec.add_development_dependency 'rake', '~> 10.0'
metadata CHANGED
@@ -1,75 +1,81 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcode-install
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.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-11-14 00:00:00.000000000 Z
11
+ date: 2016-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.9.1
20
+ - - <
21
+ - !ruby/object:Gem::Version
22
+ version: 1.1.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: 0.9.1
30
+ - - <
31
+ - !ruby/object:Gem::Version
32
+ version: 1.1.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: spaceship
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - ">="
37
+ - - '>='
32
38
  - !ruby/object:Gem::Version
33
- version: 0.13.0
34
- - - "<"
39
+ version: 0.25.1
40
+ - - <
35
41
  - !ruby/object:Gem::Version
36
42
  version: 1.0.0
37
43
  type: :runtime
38
44
  prerelease: false
39
45
  version_requirements: !ruby/object:Gem::Requirement
40
46
  requirements:
41
- - - ">="
47
+ - - '>='
42
48
  - !ruby/object:Gem::Version
43
- version: 0.13.0
44
- - - "<"
49
+ version: 0.25.1
50
+ - - <
45
51
  - !ruby/object:Gem::Version
46
52
  version: 1.0.0
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: bundler
49
55
  requirement: !ruby/object:Gem::Requirement
50
56
  requirements:
51
- - - "~>"
57
+ - - ~>
52
58
  - !ruby/object:Gem::Version
53
59
  version: '1.7'
54
60
  type: :development
55
61
  prerelease: false
56
62
  version_requirements: !ruby/object:Gem::Requirement
57
63
  requirements:
58
- - - "~>"
64
+ - - ~>
59
65
  - !ruby/object:Gem::Version
60
66
  version: '1.7'
61
67
  - !ruby/object:Gem::Dependency
62
68
  name: rake
63
69
  requirement: !ruby/object:Gem::Requirement
64
70
  requirements:
65
- - - "~>"
71
+ - - ~>
66
72
  - !ruby/object:Gem::Version
67
73
  version: '10.0'
68
74
  type: :development
69
75
  prerelease: false
70
76
  version_requirements: !ruby/object:Gem::Requirement
71
77
  requirements:
72
- - - "~>"
78
+ - - ~>
73
79
  - !ruby/object:Gem::Version
74
80
  version: '10.0'
75
81
  description: Download, install and upgrade Xcodes with ease.
@@ -81,11 +87,11 @@ executables:
81
87
  extensions: []
82
88
  extra_rdoc_files: []
83
89
  files:
84
- - ".gitattributes"
85
- - ".gitignore"
86
- - ".rubocop.yml"
87
- - ".rubocop_todo.yml"
88
- - ".travis.yml"
90
+ - .gitattributes
91
+ - .gitignore
92
+ - .rubocop.yml
93
+ - .rubocop_todo.yml
94
+ - .travis.yml
89
95
  - Gemfile
90
96
  - LICENSE.txt
91
97
  - README.md
@@ -124,6 +130,7 @@ files:
124
130
  - spec/list_spec.rb
125
131
  - spec/prerelease_spec.rb
126
132
  - spec/spec_helper.rb
133
+ - spec/uninstall_spec.rb
127
134
  - xcode-install.gemspec
128
135
  homepage: https://github.com/neonichu/xcode-install
129
136
  licenses:
@@ -135,12 +142,12 @@ require_paths:
135
142
  - lib
136
143
  required_ruby_version: !ruby/object:Gem::Requirement
137
144
  requirements:
138
- - - ">="
145
+ - - '>='
139
146
  - !ruby/object:Gem::Version
140
147
  version: 2.0.0
141
148
  required_rubygems_version: !ruby/object:Gem::Requirement
142
149
  requirements:
143
- - - ">="
150
+ - - '>='
144
151
  - !ruby/object:Gem::Version
145
152
  version: '0'
146
153
  requirements: []
@@ -169,4 +176,5 @@ test_files:
169
176
  - spec/list_spec.rb
170
177
  - spec/prerelease_spec.rb
171
178
  - spec/spec_helper.rb
179
+ - spec/uninstall_spec.rb
172
180
  has_rdoc: