xcode-installer 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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzZhZjIyMzZkMzVjY2E4ZTZkYTViOGY1NmQwYjA1NGU1ZGM3MzE5OA==
4
+ ZmZhM2ZjMmIxYjg2ZjkzNjg4OGQwMWRjMjBkYzdhMjFkOGM4NjdmMQ==
5
5
  data.tar.gz: !binary |-
6
- ZjNkZDZkZDA3OTFkZjU4YTY2ZWI4ZDFhZjM5MjU3NTJmOWE1NzU2YQ==
6
+ NmU2ZWVjOTM3YWRjZTExM2JmZTk2OWMxMGRhMjg4NmI2NWI2ZGNmOA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MDM5YTVjMDljNTkwMDE0ZjA1OWUzOTg4MjJhOWQyMmM2YzAyNThkMjgyNzhj
10
- NWFlOWZmYzA0MTQ3MjE5OWVkN2ZjY2IwZjE2NWEyMWE5MDdkYzFhYzEzZTU1
11
- MzEwNDU3YzQ2NDU4Zjc1Yjc5MzdjYTNmMmE3Mzk1YTlkOWY5ZWY=
9
+ YjhhODNhYzUzYzVlZTdlZjIzYTE4YzcwNTJlMTQ1NTUxYzYyNTg3ZmFjMDFj
10
+ NjlmMGYxYmIwNmEzMTQyYTdiYmM4NGMxMjZmZWZkNTE5ZDJkMTA5MjZiNTQ0
11
+ Zjk0MDcwYmZjMmMzZWFhNzliM2NkOTNkYjc3MTA3ZjIwM2Q3NDE=
12
12
  data.tar.gz: !binary |-
13
- OTg4OTNkMjk1M2RiYjIwYzBhZGZjZDI2Y2E4YTU5YjY3MzE0OGJhMzU4NDBj
14
- ZDQxZTc2MjA4NzNkZjI0MDNjZTM3NGVkMWYwMGJiNDIwMTM0MDg5NGMyMzNk
15
- MDExOWU2MzFhOWZlY2NlNjQyM2EwOGQzODljNzA1NGY1NTZjMDY=
13
+ ZmQ0MWJkMzc4NmQzNzg5N2NhNjA5ODk5MTdjMjJjYmFkYmE4MDBmMzY5MWI1
14
+ ZGU3OWQ2ZWZmOWU4MjkwODkxNGM2NjBmODljZDVlNWY5OGUzMDNlODg5Zjkx
15
+ YzdkNzZkYjI5NzhmNzM4MGU4OTE5ZGUyMWUzODk1YWYyYWJhNTI=
data/HISTORY.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.3.1 (2014-03-10)
2
+
3
+ * enable cli download and install
4
+
1
5
  ## 0.3.0 (2014-03-10)
2
6
 
3
7
  * add xcode 5.1
@@ -1,5 +1,5 @@
1
1
  module XcodeInstaller
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
 
4
4
  class UnsuccessfulAuthenticationError < RuntimeError; end
5
5
  end
@@ -1,12 +1,12 @@
1
1
  require 'xcode-installer/download'
2
2
 
3
3
  command :'download' do |c|
4
- c.syntax = 'xcode-installer download [options]'
4
+ c.syntax = 'xcode-installer download [options] [gui|cli]'
5
5
  c.option '--dry-run', 'Enables a HEAD request instead of downloading the file'
6
6
  c.option '--release STRING', 'Used to specify an old or pre-release version of Xcode. Otherwise, latest GA release of Xcode is downloaded.'
7
7
  c.option '--pre-release', 'Specifies to download the latest pre-release version of Xcode.'
8
- c.summary = 'Initiates the download'
9
- c.description = ''
8
+ c.summary = 'Initiates the download of the Xcode .dmg file.'
9
+ c.description = 'Specify "cli" to download command-line tools (gui is the default)'
10
10
 
11
11
  c.action XcodeInstaller::Download, :action
12
12
  end
@@ -1,12 +1,12 @@
1
1
  require 'xcode-installer/install'
2
2
 
3
3
  command :'install' do |c|
4
- c.syntax = 'xcode-installer install [options]'
4
+ c.syntax = 'xcode-installer install [options] [gui|cli]'
5
5
  c.option '--no-trash', 'Prevents trashing .dmg after install'
6
6
  c.option '--release STRING', 'Used to specify an old or pre-release version of Xcode. Otherwise, latest GA release of Xcode is downloaded.'
7
7
  c.option '--pre-release', 'Specifies to download the latest pre-release version of Xcode.'
8
- c.summary = 'Installs xcode from a .dmg file, downloading it if not already present'
9
- c.description = 'NEEDS SOME WORK - Use download and mount .dmg manually for now'
8
+ c.summary = 'Installs Xcode (or the command-line tools) from a .dmg file, downloading it if not already present'
9
+ c.description = 'NEEDS SOME WORK - Use download and mount .dmg manually for now. Specify "cli" to install command-line tools (gui is the default)'
10
10
 
11
11
  c.action XcodeInstaller::Install, :action
12
12
  end
@@ -9,10 +9,12 @@ module XcodeInstaller
9
9
  attr_accessor :release
10
10
 
11
11
  def action(args, options)
12
+ download_type = (args.include? 'cli') ? 'cli' : 'gui'
13
+
12
14
  mgr = XcodeInstaller::ReleaseManager.new
13
- @release = mgr.get_release(options.release, options.pre_release)
15
+ @release = mgr.get_release(options.release, options.pre_release, download_type)
14
16
 
15
- if release
17
+ if @release
16
18
  xcode_url = @release['download_url']
17
19
  else
18
20
  puts "No Xcode release with number #{options.release}. Use the 'list' command to see a list of known releases."
@@ -21,9 +21,11 @@ module XcodeInstaller
21
21
  end
22
22
 
23
23
  def action(args, options)
24
+ install_type = (args.include? 'cli') ? 'cli' : 'gui'
25
+
24
26
  @verbose = options.verbose
25
27
  mgr = XcodeInstaller::ReleaseManager.new
26
- @release = mgr.get_release(options.release, options.pre_release)
28
+ @release = mgr.get_release(options.release, options.pre_release, install_type)
27
29
  @version_suffix = "-#{@release['version']}"
28
30
 
29
31
  files = Dir.glob(dmg_file_name)
@@ -42,14 +44,23 @@ module XcodeInstaller
42
44
  # system "hdid '#{dmg_file}' -mountpoint #{mountpoint}"
43
45
  system "hdiutil attach -quiet #{dmg_file}"
44
46
 
45
- app_bundle_name = @release['app_bundle_name'] ||= "Xcode.app"
47
+ #
48
+ # Install
49
+ #
50
+ if (install_type == 'gui')
51
+ app_bundle_name = @release['app_bundle_name'] ||= "Xcode.app"
46
52
 
47
- # Trash existing install (so command is rerunnable)
48
- destination = "/Applications/Xcode#{version_suffix}.app"
49
- Trash.new.throw_out(destination)
53
+ # Trash existing install (so command is rerunnable)
54
+ destination = "/Applications/Xcode#{version_suffix}.app"
55
+ Trash.new.throw_out(destination)
50
56
 
51
- # TODO: Dynamically determine .app file name (DP releases have the version embedded)
52
- copy("#{mountpoint}/#{app_bundle_name}", destination)
57
+ # TODO: Dynamically determine .app file name (DP releases have the version embedded)
58
+ copy("#{mountpoint}/#{app_bundle_name}", destination)
59
+ else
60
+ # CLI install
61
+ mountpoint = '/Volumes/Command\ Line\ Developer\ Tools'
62
+ system "sudo installer -package #{mountpoint}/*.pkg -target /"
63
+ end
53
64
 
54
65
  system "hdiutil detach -quiet #{mountpoint}"
55
66
  end
@@ -35,13 +35,19 @@ module XcodeInstaller
35
35
  # Extra line between tables
36
36
  puts if show_all
37
37
 
38
+ os_version = `sw_vers -productVersion`
39
+ # Drop the patch number
40
+ os_version = os_version.match(/\d+\.\d+/)[0]
41
+
38
42
  if show_all || show_cli
39
43
  title = 'Xcode Command-Line'
40
44
  table = Terminal::Table.new :title => title do |t|
41
45
  t << ['Version', 'Release Date', 'Download URL']
42
46
  cli_versions.each do |release|
43
- t << :separator
47
+ # Skip releases for a different OS version
48
+ next unless release['os_version'].to_s == os_version
44
49
 
50
+ t << :separator
45
51
  row = [release['version'], release['release_date'], release['download_url']]
46
52
  t << row
47
53
  end
@@ -15,7 +15,7 @@ module XcodeInstaller
15
15
  return list
16
16
  end
17
17
 
18
- def get_release(version, include_beta)
18
+ def get_release(version, include_beta, interface_type)
19
19
  version ||= 'latest'
20
20
  include_beta ||= false
21
21
  interface_type ||= 'gui'
@@ -26,8 +26,13 @@ module XcodeInstaller
26
26
  elsif version == 'latest'
27
27
  version = LATEST_GA
28
28
  end
29
+
30
+ os_version = `sw_vers -productVersion`
31
+ # Drop the patch number
32
+ os_version = os_version.match(/\d+\.\d+/)[0]
33
+
29
34
  list.each { |release|
30
- if release['version'] == version
35
+ if release['version'].to_s == version && release['os_version'].to_s == os_version
31
36
  return release
32
37
  end
33
38
  }
@@ -121,62 +121,17 @@ gui:
121
121
  download_url: https://developer.apple.com/downloads/download.action?path=Developer_Tools/xcode_4.6/xcode460417218a.dmg
122
122
  interface_type: gui
123
123
  cli:
124
- - version: 5-GM
125
- download_url: https://developer.apple.com/downloads/download.action?path=Developer_Tools/command_line_tools_os_x_mountain_lion_for_xcode__september_2013/command_line_tools_os_x_mountain_lion_for_xcode__september_2013.dmg
126
- release_date: 2013-09-10
127
- interface_type: cli
128
- os_version: 10.8
129
- # - version: 5-DP6
130
- # download_url: https://developer.apple.com/downloads/download.action?path=Developer_Tools/command_line_tools_for_os_x_mavericks_developer_preview_6/command_line_tools_for_os_x_mavericks_developer_preview_6.dmg
131
- # release_date: 2013-08-16
132
- # interface_type: cli
133
- # os_version: 10.9
134
- - version: 5-DP6
135
- download_url: https://developer.apple.com/downloads/download.action?path=Developer_Tools/command_line_tools_for_os_x_mountain_lion_developer_preview_6/command_line_tools_for_os_x_mountain_lion_developer_preview_6.dmg
136
- release_date: 2013-08-21
137
- interface_type: cli
138
- os_version: 10.8
139
- # - version: 5-DP5
140
- # download_url: https://developer.apple.com/downloads/download.action?path=Developer_Tools/command_line_tools_for_os_x_mavericks_developer_preview_5/command_line_tools_for_os_x_mavericks_developer_preview_5.dmg
141
- # release_date: 2013-08-06
142
- # interface_type: cli
143
- # os_version: 10.9
144
- - version: 5-DP5
145
- download_url: https://developer.apple.com/downloads/download.action?path=Developer_Tools/command_line_tools_for_os_x_mountain_lion_developer_preview_5/command_line_tools_for_os_x_mountain_lion_developer_preview_5.dmg
146
- release_date: 2013-08-06
147
- interface_type: cli
148
- os_version: 10.8
149
- # - version: 5-DP4
150
- # download_url: https://developer.apple.com/downloads/download.action?path=Developer_Tools/command_line_tools_for_os_x_mavericks_developer_preview_4/command_line_tools_for_os_x_mavericks_developer_preview_4.dmg
151
- # release_date: 2013-07-29
152
- # interface_type: cli
153
- # os_version: 10.9
154
- - version: 5-DP4
155
- download_url: https://developer.apple.com/downloads/download.action?path=Developer_Tools/command_line_tools_for_os_x_mountain_lion_developer_preview_4/command_line_tools_for_os_x_mountain_lion_developer_preview_4.dmg
156
- release_date: 2013-07-29
124
+ - version: 5.1
125
+ os_version: 10.9
126
+ description: Command Line Tools (OS X Mavericks) for Xcode - March 2014
127
+ download_url: https://developer.apple.com/downloads/download.action?path=Developer_Tools/command_line_tools_os_x_mavericks_for_xcode__march_2014/commandline_tools_os_x_mavericks_for_xcode__march_2014.dmg
128
+ release_date: 2014-03-10
129
+ last_modified: 'Mon, 10 Mar 2014 19:03:18 GMT'
157
130
  interface_type: cli
131
+ - version: 5.1
158
132
  os_version: 10.8
159
- - version: 5-DP3
160
- download_url: https://developer.apple.com/downloads/download.action?path=Developer_Tools/command_line_tools_os_x_mountain_lion_for_xcode_5__july_2013/command_line_tools_os_x_mountain_lion_for_xcode_5__july_2013.dmg
161
- release_date: 2013-07-08
162
- interface_type: cli
163
- - version: 5-DP
164
- download_url: https://developer.apple.com/downloads/download.action?path=Developer_Tools/command_line_tools_os_x_mountain_lion_for_xcode_5__june_2013/command_line_tools_mountain_lion_for_xcode_5_june_2013.dmg
165
- release_date: 2013-06-10
166
- interface_type: cli
167
- - version: 4.6.3
168
- download_url: https://developer.apple.com/downloads/download.action?path=wwdc_2013/command_line_tools_os_x_v10.9_for_xcode_5__june_2013/command_line_tools_os_x_v10.9_for_xcode_5_developer_preview.dmg
169
- interface_type: cli
170
- - version: 4.6.2
171
- download_url: https://developer.apple.com/downloads/download.action?path=Developer_Tools/command_line_tools_os_x_mountain_lion_for_xcode__april_2013/xcode462_cltools_10_86938259a.dmg
172
- release_date: 2013-04-15
173
- interface_type: cli
174
- - version: 4.6.1
175
- download_url: https://developer.apple.com/downloads/download.action?path=Developer_Tools/command_line_tools_os_x_mountain_lion_for_xcode__march_2013/xcode461_cltools_10_86938245a.dmg
176
- release_date: 2013-03-14
177
- interface_type: cli
178
- - version: 4.6
179
- download_url: https://developer.apple.com/downloads/download.action?path=Developer_Tools/command_line_tools_os_x_mountain_lion_for_xcode__january_2013/xcode46cltools_10_86938131a.dmg
180
- release_date: 2013-02-19
133
+ description: Command Line Tools (OS X Mountain Lion) for Xcode - March 2014
134
+ download_url: https://developer.apple.com/downloads/download.action?path=Developer_Tools/command_line_tools_os_x_mountain_lion_for_xcode__march_2014/commandline_tools_os_x_mountain_lion_for_xcode__march_2014.dmg
135
+ release_date: 2014-03-10
136
+ last_modified:
181
137
  interface_type: cli
182
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcode-installer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Chatelain