xcode-install 1.1.0 → 2.0.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: 6400b83c001ff5429ba066cb709c7c48a3ee52d3
4
- data.tar.gz: d03b8a2ca220319f47e47883cff2b240bcdd6697
3
+ metadata.gz: 692e7a2d0f5405ba8f1f5d8aed39cc36be68cd91
4
+ data.tar.gz: af0d1cf4e618a42dc06c540c8c050340757cbcb4
5
5
  SHA512:
6
- metadata.gz: 7f670c8560447440ae2b048c481a91addf64752bbc083c0f849a92bc46a403eb09f7d58c05eaaa2714a9d7b005287821d01340bf78a4cc91f89be8e0875687b1
7
- data.tar.gz: 1c116c302f03f011a924f6bd764967703fcc00af5578554318be11bc96045e28ec210a6e310e8059d04c20473d26af21e763e3b1e57a28986077a92f76f14549
6
+ metadata.gz: 490d574a7dbfcec4e9c2d7193deb91ed3fe3b29a3497b1b364fe33824c8d75e41cd6e90ff210f5d4f203819b46f760a353c72b618113356351f0d19c7eb572b2
7
+ data.tar.gz: cf9dcb687e61e0387ccae70536259371fcd6018b2b1c2d61083310fb6e9a89165e156a418915366627597cc16784d2b151b38572cb4637f7f98c94ce49b41131
data/.gitignore CHANGED
@@ -12,3 +12,4 @@
12
12
  *.o
13
13
  *.a
14
14
  mkmf.log
15
+ .DS_Store
data/.rubocop.yml CHANGED
@@ -1,20 +1,21 @@
1
- Metrics/AbcSize:
2
- Max: 18
3
-
4
- Metrics/ClassLength:
5
- Max: 130
6
-
7
- Metrics/CyclomaticComplexity:
8
- Max: 7
1
+ inherit_from: .rubocop_todo.yml
9
2
 
10
3
  Metrics/LineLength:
11
4
  Max: 215
12
5
 
13
- Metrics/MethodLength:
14
- Max: 20
6
+ Style/AsciiComments:
7
+ Enabled: false
15
8
 
16
9
  Style/Documentation:
17
10
  Enabled: false
18
11
 
12
+ Style/FileName:
13
+ Exclude:
14
+ - bin/🎉
15
+ - bin/xcode-install
16
+
17
+ Style/SpecialGlobalVars:
18
+ Enabled: false
19
+
19
20
  Lint/Void:
20
21
  Enabled: false
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,34 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2016-04-26 22:45:06 -0700 using RuboCop version 0.35.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 11
10
+ Metrics/AbcSize:
11
+ Max: 39
12
+
13
+ # Offense count: 1
14
+ # Configuration parameters: CountComments.
15
+ Metrics/ClassLength:
16
+ Max: 226
17
+
18
+ # Offense count: 3
19
+ Metrics/CyclomaticComplexity:
20
+ Max: 8
21
+
22
+ # Offense count: 10
23
+ # Configuration parameters: CountComments.
24
+ Metrics/MethodLength:
25
+ Max: 40
26
+
27
+ # Offense count: 1
28
+ # Configuration parameters: CountKeywordArgs.
29
+ Metrics/ParameterLists:
30
+ Max: 6
31
+
32
+ # Offense count: 2
33
+ Metrics/PerceivedComplexity:
34
+ Max: 9
data/.travis.yml CHANGED
@@ -1,4 +1,8 @@
1
1
  language: ruby
2
+ os: osx
3
+ osx_image: xcode7.3
2
4
  rvm: 2.0.0-p598
3
5
  cache: bundler
4
- script: bundle exec rake spec
6
+ script:
7
+ - bundle exec rake spec
8
+ - bundle exec rake rubocop
data/Gemfile CHANGED
@@ -7,5 +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', '0.35.1'
10
11
  gem 'coveralls', require: false
11
12
  end
data/README.md CHANGED
@@ -7,15 +7,24 @@
7
7
 
8
8
  Install and update your Xcodes automatically.
9
9
 
10
- ```bash
10
+ ```
11
11
  $ gem install xcode-install
12
12
  $ xcversion install 6.3
13
13
  ```
14
14
 
15
15
  ## Installation
16
16
 
17
- ```bash
18
- $ gem install xcversion
17
+ ```
18
+ $ gem install xcode-install
19
+ ```
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
19
28
  ```
20
29
 
21
30
  ## Usage
@@ -30,7 +39,7 @@ XCODE_INSTALL_PASSWORD
30
39
 
31
40
  To list available versions:
32
41
 
33
- ```bash
42
+ ```
34
43
  $ xcversion list
35
44
  6.0.1
36
45
  6.1
@@ -39,11 +48,11 @@ $ 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
 
46
- ```bash
55
+ ```
47
56
  $ xcversion install 6.3
48
57
  ########################################################### 82.1%
49
58
  ######################################################################## 100.0%
@@ -57,7 +66,7 @@ This will download and install that version of Xcode. It will also be automatica
57
66
 
58
67
  Note: GMs and beta versions usually have special names, e.g.
59
68
 
60
- ```bash
69
+ ```
61
70
  $ xcversion list
62
71
  7 GM seed
63
72
  7.1 beta
@@ -73,24 +82,28 @@ XcodeInstall can also install Xcode's Command Line Tools by calling `xcversion i
73
82
 
74
83
  XcodeInstall can also manage your local simulators using the `simulators` command.
75
84
 
76
- ```bash
77
- $ xcode-install simulators
78
- Xcode 6.4.0 (/Applications/Xcode.app)
85
+ ```
86
+ $ xcversion simulators
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
- ```bash
93
- $ xcode-install simulators --install=8.4
105
+ ```
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...
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'bundler/gem_tasks'
2
+ require 'rubocop/rake_task'
2
3
 
3
4
  def specs(dir)
4
5
  FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
@@ -9,4 +10,7 @@ task :spec do
9
10
  sh "bundle exec bacon #{specs('**')}"
10
11
  end
11
12
 
12
- task default: :spec
13
+ desc 'Lints all the files'
14
+ RuboCop::RakeTask.new(:rubocop)
15
+
16
+ task default: [:spec, :rubocop]
@@ -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,18 +34,15 @@ 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
- fail Informative, "Version #{@version} doesn't exist." unless @installer.exist?(@version)
38
-
39
- if @url
40
- fail Informative, "Invalid URL: `#{@url}`" unless @url =~ /\A#{URI::regexp}\z/
41
- end
37
+ help! 'A VERSION argument is required.' unless @version
38
+ fail Informative, "Version #{@version} already installed." if @installer.installed?(@version) && !@force
39
+ fail Informative, "Version #{@version} doesn't exist." unless @url || @installer.exist?(@version)
40
+ fail Informative, "Invalid URL: `#{@url}`" unless !@url || @url =~ /\A#{URI.regexp}\z/
42
41
  end
43
42
 
44
43
  def run
45
44
  @installer.install_version(@version, @should_switch, @should_clean, @should_install,
46
- @progress, @url)
45
+ @progress, @url)
47
46
  end
48
47
  end
49
48
  end
@@ -4,10 +4,19 @@ module XcodeInstall
4
4
  self.command = 'installed'
5
5
  self.summary = 'List installed Xcodes.'
6
6
 
7
+ def self.options
8
+ [['--uuid', 'Show DVTPlugInCompatibilityUUIDs in the list.']].concat(super)
9
+ end
10
+
11
+ def initialize(argv)
12
+ @uuid = argv.flag?('uuid', false)
13
+ super
14
+ end
15
+
7
16
  def run
8
17
  installer = XcodeInstall::Installer.new
9
18
  installer.installed_versions.each do |xcode|
10
- puts "#{xcode.version}\t(#{xcode.path})"
19
+ puts "#{xcode.version}\t(#{xcode.path})\t#{@uuid ? xcode.uuid : ''}"
11
20
  end
12
21
  end
13
22
  end
@@ -17,7 +17,7 @@ module XcodeInstall
17
17
  def validate!
18
18
  super
19
19
 
20
- fail Informative, "Please specify a version to select." if @version.nil?
20
+ fail Informative, 'Please specify a version to select.' if @version.nil?
21
21
  fail Informative, "Version #{@version} not installed." unless @installer.installed?(@version)
22
22
  end
23
23
 
@@ -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,23 +24,24 @@ module XcodeInstall
24
24
  :private
25
25
 
26
26
  def install
27
- filtered_simulators = @installed_xcodes.map { |x| x.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
- if filtered_simulators.count == 0
30
+ case filtered_simulators.count
31
+ when 0
31
32
  puts "[!] No simulator matching #{@install} was found. Please specify a version from the following available simulators:".ansi.red
32
33
  list
33
34
  exit 1
34
- elsif filtered_simulators.count == 1
35
+ when 1
35
36
  simulator = filtered_simulators.first
36
37
  fail Informative, "#{simulator.name} is already installed." if simulator.installed?
37
38
  puts "Installing #{simulator.name} for Xcode #{simulator.xcode.bundle_version}..."
38
39
  simulator.install
39
40
  else
40
41
  puts "[!] More than one simulator matching #{@install} was found. Please specify the full version.".ansi.red
41
- filtered_simulators.each do |simulator|
42
- puts "Xcode #{simulator.xcode.bundle_version} (#{simulator.xcode.path})".ansi.green
43
- puts "xcode-install simulator --install=#{simulator.version}"
42
+ filtered_simulators.each do |candidate|
43
+ puts "Xcode #{candidate.xcode.bundle_version} (#{candidate.xcode.path})".ansi.green
44
+ puts "xcversion simulators --install=#{candidate.name}"
44
45
  end
45
46
  exit 1
46
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
 
@@ -25,10 +27,9 @@ module XcodeInstall
25
27
 
26
28
  `sudo rm -rf #{installed_path.path}`
27
29
 
28
- if @installer.symlinks_to == installed_path.path
29
- newest_version = @installer.installed_versions.last
30
- @installer.symlink(newest_version)
31
- end
30
+ return unless @installer.symlinks_to == installed_path.path
31
+ newest_version = @installer.installed_versions.last
32
+ @installer.symlink(newest_version)
32
33
  end
33
34
  end
34
35
  end
@@ -1,3 +1,3 @@
1
1
  module XcodeInstall
2
- VERSION = '1.1.0'
2
+ VERSION = '2.0.0'.freeze
3
3
  end