xcode-install 0.3.0 → 0.3.1
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 +4 -4
- data/.rubocop.yml +20 -0
- data/Gemfile +2 -2
- data/Rakefile +2 -2
- data/bin/xcode-install +5 -5
- data/lib/xcode/install/cleanup.rb +11 -11
- data/lib/xcode/install/command.rb +22 -22
- data/lib/xcode/install/install.rb +29 -29
- data/lib/xcode/install/installed.rb +12 -12
- data/lib/xcode/install/list.rb +22 -22
- data/lib/xcode/install/uninstall.rb +26 -26
- data/lib/xcode/install/update.rb +11 -11
- data/lib/xcode/install/version.rb +1 -1
- data/lib/xcode/install.rb +292 -277
- data/spec/fixtures/devcenter/xcode-20150601.html +212 -0
- data/spec/fixtures/devcenter/xcode-20150608.html +315 -0
- data/spec/fixtures/yolo.json +1 -1
- data/spec/install_spec.rb +19 -19
- data/spec/installed_spec.rb +7 -6
- data/spec/json_spec.rb +18 -18
- data/spec/prerelease_spec.rb +37 -30
- data/spec/spec_helper.rb +5 -5
- data/xcode-install.gemspec +13 -13
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aab5d0135dc575609e7e51a5b80a6cda4e1961d8
|
4
|
+
data.tar.gz: 0c1a7f167a64e666de00a9470a11e842a39a5dcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25bd0f8b900bb58257a8403a0b47b3fb241133ab42db2ce86989339b6f6e009313cf428ecf1caf6cdf303a530a745f077fc09c696b3006617b225b760a8d51e6
|
7
|
+
data.tar.gz: e2bfb4e367ca6f194a4a6df05d738fca23a4f758aa1f5c11ad1e3728100469f056d05532abe29637fcfd0e3c5e3226aa2610808358717397af0a3f65b0b3c257
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Metrics/AbcSize:
|
2
|
+
Max: 18
|
3
|
+
|
4
|
+
Metrics/ClassLength:
|
5
|
+
Max: 130
|
6
|
+
|
7
|
+
Metrics/CyclomaticComplexity:
|
8
|
+
Max: 7
|
9
|
+
|
10
|
+
Metrics/LineLength:
|
11
|
+
Max: 215
|
12
|
+
|
13
|
+
Metrics/MethodLength:
|
14
|
+
Max: 20
|
15
|
+
|
16
|
+
Style/Documentation:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Lint/Void:
|
20
|
+
Enabled: false
|
data/Gemfile
CHANGED
@@ -6,6 +6,6 @@ group :development do
|
|
6
6
|
gem 'bacon'
|
7
7
|
gem 'mocha-on-bacon'
|
8
8
|
gem 'mocha', '~> 0.11.4'
|
9
|
-
gem 'prettybacon', :
|
10
|
-
gem 'coveralls', :
|
9
|
+
gem 'prettybacon', git: 'https://github.com/irrationalfab/PrettyBacon.git', branch: 'master'
|
10
|
+
gem 'coveralls', require: false
|
11
11
|
end
|
data/Rakefile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
2
|
|
3
3
|
def specs(dir)
|
4
4
|
FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
|
@@ -9,4 +9,4 @@ task :spec do
|
|
9
9
|
sh "bundle exec bacon #{specs('**')}"
|
10
10
|
end
|
11
11
|
|
12
|
-
task :
|
12
|
+
task default: :specs
|
data/bin/xcode-install
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
if $PROGRAM_NAME == __FILE__
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__)
|
5
|
+
require 'rubygems'
|
6
|
+
require 'bundler/setup'
|
7
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
8
8
|
end
|
9
9
|
|
10
10
|
require 'xcode/install'
|
11
11
|
|
12
|
-
XcodeInstall::Command.run(ARGV)
|
12
|
+
XcodeInstall::Command.run(ARGV)
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module XcodeInstall
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
class Command
|
3
|
+
class Cleanup < Command
|
4
|
+
self.command = 'cleanup'
|
5
|
+
self.summary = 'Cleanup cached downloads.'
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
def run
|
8
|
+
installer = XcodeInstall::Installer.new
|
9
|
+
return if installer.cache_dir.nil? || installer.cache_dir.to_s.length < 5
|
10
|
+
FileUtils.rm_f(Dir.glob("#{installer.cache_dir}/*"))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
14
|
end
|
@@ -1,28 +1,28 @@
|
|
1
1
|
require 'claide'
|
2
|
-
require
|
2
|
+
require 'xcode/install/version'
|
3
3
|
|
4
4
|
module XcodeInstall
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
class PlainInformative < StandardError
|
6
|
+
include CLAide::InformativeError
|
7
|
+
end
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
class Informative < PlainInformative
|
10
|
+
def message
|
11
|
+
"[!] #{super}".red
|
12
|
+
end
|
13
|
+
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
class Command < CLAide::Command
|
16
|
+
require 'xcode/install/cleanup'
|
17
|
+
require 'xcode/install/install'
|
18
|
+
require 'xcode/install/installed'
|
19
|
+
require 'xcode/install/list'
|
20
|
+
require 'xcode/install/uninstall'
|
21
|
+
require 'xcode/install/update'
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
23
|
+
self.abstract_command = true
|
24
|
+
self.command = 'xcode-install'
|
25
|
+
self.version = VERSION
|
26
|
+
self.description = 'Xcode installation manager.'
|
27
|
+
end
|
28
|
+
end
|
@@ -1,36 +1,36 @@
|
|
1
1
|
module XcodeInstall
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
class Command
|
3
|
+
class Install < Command
|
4
|
+
self.command = 'install'
|
5
|
+
self.summary = 'Install a specific version of Xcode.'
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
self.arguments = [
|
8
|
+
CLAide::Argument.new('VERSION', :true)
|
9
|
+
]
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
def self.options
|
12
|
+
[['--no-switch', 'Don’t switch to this version after installation'],
|
13
|
+
['--no-clean', 'Don’t delete DMG after installation.']].concat(super)
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
def initialize(argv)
|
17
|
+
@installer = Installer.new
|
18
|
+
@version = argv.shift_argument
|
19
|
+
@should_clean = argv.flag?('clean', true)
|
20
|
+
@should_switch = argv.flag?('switch', true)
|
21
|
+
super
|
22
|
+
end
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
def validate!
|
25
|
+
return if @version.nil?
|
26
|
+
fail Informative, "Version #{@version} already installed." if @installer.installed?(@version)
|
27
|
+
fail Informative, "Version #{@version} doesn't exist." unless @installer.exist?(@version)
|
28
|
+
end
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
def run
|
31
|
+
return if @version.nil?
|
32
|
+
@installer.install_version(@version, @should_switch, @should_clean)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
36
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
module XcodeInstall
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
class Command
|
3
|
+
class Installed < Command
|
4
|
+
self.command = 'installed'
|
5
|
+
self.summary = 'List installed Xcodes.'
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
def run
|
8
|
+
installer = XcodeInstall::Installer.new
|
9
|
+
installer.installed_versions.each do |xcode|
|
10
|
+
puts "#{xcode.version}\t(#{xcode.path})"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
15
|
end
|
data/lib/xcode/install/list.rb
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
module XcodeInstall
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
class Command
|
3
|
+
class List < Command
|
4
|
+
self.command = 'list'
|
5
|
+
self.summary = 'List Xcodes available for download.'
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
def self.options
|
8
|
+
[['--all', 'Show all available versions.']].concat(super)
|
9
|
+
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
def initialize(argv)
|
12
|
+
@all = argv.flag?('all', false)
|
13
|
+
super
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
16
|
+
def run
|
17
|
+
installer = XcodeInstall::Installer.new
|
18
|
+
|
19
|
+
if @all
|
20
|
+
puts installer.list
|
21
|
+
else
|
22
|
+
puts installer.list_current
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
27
|
end
|
@@ -1,33 +1,33 @@
|
|
1
1
|
module XcodeInstall
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
class Command
|
3
|
+
class Uninstall < Command
|
4
|
+
self.command = 'uninstall'
|
5
|
+
self.summary = 'Uninstall a specific version of Xcode.'
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
self.arguments = [
|
8
|
+
CLAide::Argument.new('VERSION', :true)
|
9
|
+
]
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
def initialize(argv)
|
12
|
+
@installer = Installer.new
|
13
|
+
@version = argv.shift_argument
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
def validate!
|
17
|
+
fail Informative, "Version #{@version} is not installed." unless @installer.installed?(@version)
|
18
|
+
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
def run
|
21
|
+
installed_path = @installer.installed_versions.find { |x| x.version == @version }
|
22
|
+
return if installed_path.nil? || installed_path.path.nil?
|
23
23
|
|
24
|
-
|
24
|
+
`sudo rm -rf #{installed_path.path}`
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
26
|
+
if @installer.symlinks_to == installed_path.path
|
27
|
+
newest_version = @installer.installed_versions.last
|
28
|
+
@installer.symlink(newest_version)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/xcode/install/update.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
module XcodeInstall
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
class Command
|
3
|
+
class Update < Command
|
4
|
+
self.command = 'update'
|
5
|
+
self.summary = 'Update cached list of available Xcodes.'
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
def run
|
8
|
+
installer = XcodeInstall::Installer.new
|
9
|
+
installer.rm_list_cache
|
10
|
+
installer.list
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
14
|
end
|