rocket_fuel 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -17
- data/lib/rocket_fuel/fix/command_line_tool_fix.rb +2 -39
- data/lib/rocket_fuel/install/run.rb +7 -1
- data/lib/rocket_fuel/precheck/command_line_tool_check.rb +4 -1
- data/lib/rocket_fuel/version.rb +1 -1
- data/spec/rocket_fuel/precheck/command_line_tool_check_spec.rb +22 -3
- metadata +19 -28
- data/lib/rocket_fuel/fix/command_line_tools/dmg_metadata.rb +0 -46
- data/lib/rocket_fuel/fix/command_line_tools/download.rb +0 -30
- data/lib/rocket_fuel/fix/command_line_tools/download_routine.rb +0 -76
- data/lib/rocket_fuel/fix/command_line_tools/install.applescript +0 -58
- data/lib/rocket_fuel/fix/command_line_tools/install.rb +0 -31
- data/spec/rocket_fuel/fix/command_line_tools/dmg_metadata_spec.rb +0 -19
- data/spec/rocket_fuel/fix/command_line_tools/download_spec.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7a3339260b37468e6af0c079c153090e77f85f4
|
4
|
+
data.tar.gz: 0e7c93459307e1f5740fe209006ecf0a09149ebb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1ad1be36bbad563c4834f75bf02500dd4a27e19a43b5cff298a439af9e03b51914c7c13cc316236d80780b31e283132f1918986530146750e12bda2f65cb282
|
7
|
+
data.tar.gz: afc41dfa8d39247646da91239371c1225808338d0f718d27c056c53607b4232a371d2c8e0985f379b0874dbc625407cebe46cc75a9a8731e357cfcbdcb266c77
|
data/README.md
CHANGED
@@ -1,27 +1,15 @@
|
|
1
1
|
# RocketFuel
|
2
2
|
|
3
|
-
|
3
|
+
Installs all the things (Ruby, Atom, etc) so that you can focus on writing code.
|
4
4
|
|
5
|
-
##
|
5
|
+
## Usage
|
6
6
|
|
7
|
-
|
7
|
+
### Install all of the things (Mac)
|
8
8
|
|
9
|
-
```
|
10
|
-
gem
|
9
|
+
```bash
|
10
|
+
$ xcode-select --install && sudo gem install rocket_fuel && rocket_fuel install
|
11
11
|
```
|
12
12
|
|
13
|
-
And then execute:
|
14
|
-
|
15
|
-
$ bundle
|
16
|
-
|
17
|
-
Or install it yourself as:
|
18
|
-
|
19
|
-
$ gem install rocket_fuel
|
20
|
-
|
21
|
-
## Usage
|
22
|
-
|
23
|
-
TODO: Write usage instructions here
|
24
|
-
|
25
13
|
## Contributing
|
26
14
|
|
27
15
|
1. Fork it ( https://github.com/[my-github-username]/rocket_fuel/fork )
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'rocket_fuel/fix/command_line_tools/download_routine'
|
2
|
-
require 'rocket_fuel/fix/command_line_tools/install'
|
3
1
|
module RocketFuel
|
4
2
|
module Fix
|
5
3
|
class CommandLineToolFix < AbstractFix
|
@@ -8,33 +6,8 @@ module RocketFuel
|
|
8
6
|
|
9
7
|
include Thor::Base
|
10
8
|
|
11
|
-
ACCOUNT_CREATION_URL = 'https://developer.apple.com/register/index.action'
|
12
|
-
APPLESCRIPT_PATH = File.join(File.dirname(__FILE__),
|
13
|
-
'command_line_tools', 'install.applescript')
|
14
|
-
|
15
9
|
def run
|
16
|
-
|
17
|
-
:limited_to => ['y', 'n'])
|
18
|
-
if dev_account == 'n'
|
19
|
-
say("Please register at #{ACCOUNT_CREATION_URL} and rerun " +
|
20
|
-
"this command.")
|
21
|
-
return false
|
22
|
-
else
|
23
|
-
routine = CommandLineTools::DownloadRoutine.new
|
24
|
-
say('')
|
25
|
-
say('Downloading Command Line Tools. ' +
|
26
|
-
'You will be prompted for your Apple account and password. ' +
|
27
|
-
'NOTE: rocket_fuel never stores your Apple account or password.')
|
28
|
-
dmg_path = routine.run
|
29
|
-
say('Done.')
|
30
|
-
|
31
|
-
install = CommandLineTools::Install.new(dmg_path)
|
32
|
-
say('')
|
33
|
-
say("Installing Command Line Tools. " +
|
34
|
-
"You will be prompted for your sudo password.")
|
35
|
-
install.run
|
36
|
-
say('Done.')
|
37
|
-
end
|
10
|
+
system('xcode-select --install')
|
38
11
|
end
|
39
12
|
|
40
13
|
def title
|
@@ -44,17 +17,7 @@ module RocketFuel
|
|
44
17
|
def message
|
45
18
|
'Installing Ruby requires a C compiler. For the Mac, Apple provides ' +
|
46
19
|
'a package known as "Command Line Tools" which includes a C compiler. ' +
|
47
|
-
'
|
48
|
-
"account @ #{ACCOUNT_CREATION_URL}. Once " +
|
49
|
-
'you\'ve created an account, you can download the version of command ' +
|
50
|
-
'line tools appropriate for your version of OS X at ' +
|
51
|
-
'https://developer.apple.com/downloads/index.action' +
|
52
|
-
'Our fix is available in an experimental capacity. Once you have ' +
|
53
|
-
'created an Apple Developer account, invoke: ' +
|
54
|
-
'`rocket_fuel fix command_line_tools` ' +
|
55
|
-
'The fix involves an experimental script that will ask for your ' +
|
56
|
-
'Apple ID and password. Please note that rocket_fuel NEVER stores ' +
|
57
|
-
'your login information'
|
20
|
+
'Most of the time running `xcode-select --install` will get the job done.'
|
58
21
|
end
|
59
22
|
end
|
60
23
|
end
|
@@ -29,7 +29,13 @@ module RocketFuel
|
|
29
29
|
end
|
30
30
|
say('Running rocket fuel recipes...this may take some time')
|
31
31
|
run = RocketFuel::Install::RecipeRun.new
|
32
|
-
|
32
|
+
say('')
|
33
|
+
|
34
|
+
if run.run
|
35
|
+
say("Congratuations! You're now running with RocketFuel!", :green)
|
36
|
+
else
|
37
|
+
say('Something went wrong.', :red)
|
38
|
+
end
|
33
39
|
say('Done')
|
34
40
|
end
|
35
41
|
end
|
@@ -6,6 +6,7 @@ module RocketFuel
|
|
6
6
|
check_name :command_line_tools
|
7
7
|
register!
|
8
8
|
|
9
|
+
TEN_ELEVEN_RECEIPT_PATH = '/System/Library/Receipts/com.apple.pkg.CLTools_Executables.bom'
|
9
10
|
TEN_NINE_RECEIPT_PATH = '/var/db/receipts/com.apple.pkg.CLTools_Executables.bom'
|
10
11
|
DEFAULT_RECEIPT_PATH = '/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.bom'
|
11
12
|
|
@@ -32,7 +33,9 @@ module RocketFuel
|
|
32
33
|
end
|
33
34
|
|
34
35
|
def receipt_file
|
35
|
-
if RocketFuel::SystemDetails.os.minor_version =~ /\A10.
|
36
|
+
if RocketFuel::SystemDetails.os.minor_version =~ /\A10.11/
|
37
|
+
TEN_ELEVEN_RECEIPT_PATH
|
38
|
+
elsif RocketFuel::SystemDetails.os.minor_version =~ /\A10.(9|(10))/
|
36
39
|
TEN_NINE_RECEIPT_PATH
|
37
40
|
else
|
38
41
|
DEFAULT_RECEIPT_PATH
|
data/lib/rocket_fuel/version.rb
CHANGED
@@ -9,19 +9,37 @@ require 'fileutils'
|
|
9
9
|
describe RocketFuel::Precheck::CommandLineToolCheck do
|
10
10
|
include FakeFS::SpecHelpers
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
context "os x 10.11" do
|
13
|
+
before(:each) do
|
14
|
+
os = RocketFuel::OperatingSystem.new('darwin', '10.11.2')
|
15
|
+
RocketFuel::SystemDetails.stubs(:os).returns(os)
|
16
|
+
FileUtils.mkdir_p(File.dirname(path))
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:check) { RocketFuel::Precheck::CommandLineToolCheck.new }
|
20
|
+
let(:path) { RocketFuel::Precheck::CommandLineToolCheck::TEN_ELEVEN_RECEIPT_PATH }
|
21
|
+
|
22
|
+
it 'is ok if the receipt file is found' do
|
23
|
+
FileUtils.touch(path)
|
24
|
+
expect(check).to be_ok
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'is not ok if the receipt is not found' do
|
28
|
+
FileUtils.rm_f(path) if FileTest.exist?(path)
|
29
|
+
expect(check).to_not be_ok
|
30
|
+
end
|
14
31
|
end
|
15
32
|
|
16
|
-
let(:path) { RocketFuel::Precheck::CommandLineToolCheck::TEN_NINE_RECEIPT_PATH }
|
17
33
|
[
|
18
34
|
'10.9.4',
|
19
35
|
'10.10'
|
20
36
|
].each do |os_vers|
|
21
37
|
context "os x #{os_vers}" do
|
38
|
+
let(:path) { RocketFuel::Precheck::CommandLineToolCheck::TEN_NINE_RECEIPT_PATH }
|
22
39
|
let(:os) { RocketFuel::OperatingSystem.new('darwin', os_vers)}
|
23
40
|
before(:each) do
|
24
41
|
RocketFuel::SystemDetails.stubs(:os).returns(os)
|
42
|
+
FileUtils.mkdir_p(File.dirname(path))
|
25
43
|
end
|
26
44
|
|
27
45
|
let(:check) { RocketFuel::Precheck::CommandLineToolCheck.new }
|
@@ -46,6 +64,7 @@ describe RocketFuel::Precheck::CommandLineToolCheck do
|
|
46
64
|
before(:each) do
|
47
65
|
os = RocketFuel::OperatingSystem.new('darwin', '10.8.4')
|
48
66
|
RocketFuel::SystemDetails.stubs(:os).returns(os)
|
67
|
+
FileUtils.mkdir_p(File.dirname(path))
|
49
68
|
end
|
50
69
|
|
51
70
|
let(:check) { RocketFuel::Precheck::CommandLineToolCheck.new }
|
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rocket_fuel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Pickett
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.7'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.7'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '10.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '3.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: mocha
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: fakefs
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
description: A ruby client for installing rocket fuel.
|
@@ -102,8 +102,8 @@ executables:
|
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
-
- .gitignore
|
106
|
-
- .rspec
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
107
|
- Gemfile
|
108
108
|
- LICENSE.txt
|
109
109
|
- README.md
|
@@ -115,11 +115,6 @@ files:
|
|
115
115
|
- lib/rocket_fuel/fix.rb
|
116
116
|
- lib/rocket_fuel/fix/abstract_fix.rb
|
117
117
|
- lib/rocket_fuel/fix/command_line_tool_fix.rb
|
118
|
-
- lib/rocket_fuel/fix/command_line_tools/dmg_metadata.rb
|
119
|
-
- lib/rocket_fuel/fix/command_line_tools/download.rb
|
120
|
-
- lib/rocket_fuel/fix/command_line_tools/download_routine.rb
|
121
|
-
- lib/rocket_fuel/fix/command_line_tools/install.applescript
|
122
|
-
- lib/rocket_fuel/fix/command_line_tools/install.rb
|
123
118
|
- lib/rocket_fuel/fix/curl_fix.rb
|
124
119
|
- lib/rocket_fuel/fix/file_sanitizer_fix.rb
|
125
120
|
- lib/rocket_fuel/fix/macports_fix.rb
|
@@ -145,8 +140,6 @@ files:
|
|
145
140
|
- lib/rocket_fuel/version.rb
|
146
141
|
- rocket_fuel.gemspec
|
147
142
|
- spec/rocket_fuel/command_line_icon_spec.rb
|
148
|
-
- spec/rocket_fuel/fix/command_line_tools/dmg_metadata_spec.rb
|
149
|
-
- spec/rocket_fuel/fix/command_line_tools/download_spec.rb
|
150
143
|
- spec/rocket_fuel/fix/macports_fix_spec.rb
|
151
144
|
- spec/rocket_fuel/fix/rbenv_fix_spec.rb
|
152
145
|
- spec/rocket_fuel/fix/rvm_fix_spec.rb
|
@@ -172,24 +165,22 @@ require_paths:
|
|
172
165
|
- lib
|
173
166
|
required_ruby_version: !ruby/object:Gem::Requirement
|
174
167
|
requirements:
|
175
|
-
- -
|
168
|
+
- - ">="
|
176
169
|
- !ruby/object:Gem::Version
|
177
170
|
version: '0'
|
178
171
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
172
|
requirements:
|
180
|
-
- -
|
173
|
+
- - ">="
|
181
174
|
- !ruby/object:Gem::Version
|
182
175
|
version: '0'
|
183
176
|
requirements: []
|
184
177
|
rubyforge_project:
|
185
|
-
rubygems_version: 2.
|
178
|
+
rubygems_version: 2.4.5.1
|
186
179
|
signing_key:
|
187
180
|
specification_version: 4
|
188
181
|
summary: A ruby client for installing rocket fuel
|
189
182
|
test_files:
|
190
183
|
- spec/rocket_fuel/command_line_icon_spec.rb
|
191
|
-
- spec/rocket_fuel/fix/command_line_tools/dmg_metadata_spec.rb
|
192
|
-
- spec/rocket_fuel/fix/command_line_tools/download_spec.rb
|
193
184
|
- spec/rocket_fuel/fix/macports_fix_spec.rb
|
194
185
|
- spec/rocket_fuel/fix/rbenv_fix_spec.rb
|
195
186
|
- spec/rocket_fuel/fix/rvm_fix_spec.rb
|
@@ -1,46 +0,0 @@
|
|
1
|
-
module RocketFuel
|
2
|
-
module Fix
|
3
|
-
module CommandLineTools
|
4
|
-
class DmgMetadata
|
5
|
-
def initialize(dmg_path)
|
6
|
-
@dmg_path = dmg_path
|
7
|
-
@os = RocketFuel::SystemDetails.os.minor_version
|
8
|
-
end
|
9
|
-
|
10
|
-
def volume_dir
|
11
|
-
if map[@os]
|
12
|
-
map[@os]['volume_dir']
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def pkg_name
|
17
|
-
if map[@os]
|
18
|
-
map[@os]['pkg_name']
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
protected
|
23
|
-
def map
|
24
|
-
@map ||= {
|
25
|
-
'10.10' => {
|
26
|
-
'volume_dir' => 'Command Line Developer Tools',
|
27
|
-
'pkg_name' => 'Command Line Tools (OS X 10.10)'
|
28
|
-
},
|
29
|
-
'10.9' => {
|
30
|
-
'volume_dir' => 'Command Line Developer Tools',
|
31
|
-
'pkg_name' => 'Command Line Tools (OS X 10.9)'
|
32
|
-
},
|
33
|
-
'10.8' => {
|
34
|
-
'volume_dir' => 'Command Line Tools (Mountain Lion)',
|
35
|
-
'pkg_name' => 'Command Line Tools (Mountain Lion)'
|
36
|
-
},
|
37
|
-
'10.7' => {
|
38
|
-
'volume_dir' => 'Command Line Tools (Lion)',
|
39
|
-
'pkg_name' => 'Command Line Tools (Lion)'
|
40
|
-
}
|
41
|
-
}
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module RocketFuel
|
2
|
-
module Fix
|
3
|
-
module CommandLineTools
|
4
|
-
class Download
|
5
|
-
URLS = {
|
6
|
-
'10.10' => '/downloads/download.action?path=Developer_Tools/command_line_tools_os_x_10.10_for_xcode__xcode_6.1/command_line_tools_for_osx_10.10_for_xcode_6.1.dmg',
|
7
|
-
'10.9' => '/downloads/download.action?path=Developer_Tools/command_line_tools_os_x_mavericks_for_xcode__april_2014/command_line_tools_for_osx_mavericks_april_2014.dmg',
|
8
|
-
'10.8' => '/downloads/download.action?path=Developer_Tools/command_line_tools_os_x_mountain_lion_for_xcode__april_2014/command_line_tools_for_osx_mountain_lion_april_2014.dmg',
|
9
|
-
'10.7' => '/downloads/download.action?path=Developer_Tools/command_line_tools_os_x_lion_for_xcode__april_2013/xcode462_cltools_10_76938260a.dmg'
|
10
|
-
}
|
11
|
-
|
12
|
-
FILE_NAME = 'command-line-tools.dmg'
|
13
|
-
DEFAULT_DMG_PATH = "/tmp/#{FILE_NAME}"
|
14
|
-
|
15
|
-
def url
|
16
|
-
base_host + URLS[os_minor]
|
17
|
-
end
|
18
|
-
|
19
|
-
protected
|
20
|
-
def os_minor
|
21
|
-
RocketFuel::SystemDetails.os.minor_version
|
22
|
-
end
|
23
|
-
|
24
|
-
def base_host
|
25
|
-
'https://developer.apple.com'
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
require 'rocket_fuel/fix/command_line_tools/download'
|
2
|
-
|
3
|
-
module RocketFuel
|
4
|
-
module Fix
|
5
|
-
module CommandLineTools
|
6
|
-
class DownloadRoutine
|
7
|
-
include Thor::Base
|
8
|
-
PREF_NAMESPACE = File.expand_path("#{ENV['HOME']}/Library/Preferences/com.apple.Safari")
|
9
|
-
|
10
|
-
def initialize
|
11
|
-
@script_path = File.join(File.dirname(__FILE__), 'install.applescript')
|
12
|
-
@download = Download.new
|
13
|
-
end
|
14
|
-
|
15
|
-
def run
|
16
|
-
whitelist_downloads
|
17
|
-
run_applescript
|
18
|
-
await_download_completion
|
19
|
-
end
|
20
|
-
|
21
|
-
protected
|
22
|
-
def whitelist_downloads
|
23
|
-
#only do this once. We don't want the active download to get in the queue, so
|
24
|
-
#we memoize
|
25
|
-
@downloads ||= Dir.glob(downloading_glob)
|
26
|
-
end
|
27
|
-
|
28
|
-
def downloading_glob
|
29
|
-
File.join(download_path, "*.download")
|
30
|
-
end
|
31
|
-
|
32
|
-
|
33
|
-
def download_path
|
34
|
-
unless @download_path
|
35
|
-
@download_path = `defaults read #{PREF_NAMESPACE} DownloadsPath`.chomp
|
36
|
-
if @download_path == '' || @download_path.nil?
|
37
|
-
@download_path = File.join(ENV["HOME"], "/Downloads")
|
38
|
-
end
|
39
|
-
|
40
|
-
@download_path = File.expand_path(@download_path)
|
41
|
-
end
|
42
|
-
@download_path
|
43
|
-
end
|
44
|
-
|
45
|
-
def run_applescript
|
46
|
-
`osascript #{@script_path} "#{@download.url}"`
|
47
|
-
end
|
48
|
-
|
49
|
-
def download_url
|
50
|
-
@download.url
|
51
|
-
end
|
52
|
-
|
53
|
-
def await_download_completion
|
54
|
-
puts "Waiting for CLT download to finish..."
|
55
|
-
sleep(5)
|
56
|
-
|
57
|
-
cared_for_downloads = Dir.glob(downloading_glob) - whitelist_downloads
|
58
|
-
puts "Ignoring #{whitelist_downloads}"
|
59
|
-
puts "Watching #{cared_for_downloads}"
|
60
|
-
#wait until all downloads have completed
|
61
|
-
while (Dir.glob(downloading_glob) - whitelist_downloads).length > 0 do
|
62
|
-
sleep(5)
|
63
|
-
end
|
64
|
-
puts "Download complete"
|
65
|
-
|
66
|
-
cared_for_downloads.each do |d|
|
67
|
-
dmg_file = d.gsub(/.download\z/, '')
|
68
|
-
if FileTest.exists?(dmg_file) && File.extname(dmg_file) == '.dmg'
|
69
|
-
return dmg_file
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
on run argv
|
2
|
-
tell application "Safari"
|
3
|
-
activate
|
4
|
-
|
5
|
-
set apple_id to the text returned of (display dialog "Rocket Fuel: please enter your AppleID email:" with title "Apple ID" default answer "" buttons {"OK"} default button 1)
|
6
|
-
set apple_password to the text returned of (display dialog "Rocket Fuel: please enter your AppleID password:" with title "Password" with icon caution default answer "" buttons {"OK"} default button 1 with hidden answer)
|
7
|
-
|
8
|
-
open location "https://developer.apple.com/downloads/index.action"
|
9
|
-
delay 3 -- this is a delay to allow the page to start loading
|
10
|
-
--wait till it's loaded
|
11
|
-
set pageLoaded to false -- this initialises the pageLoaded variable that gets set below
|
12
|
-
repeat while not pageLoaded -- keep doing this loop until loading complete
|
13
|
-
if (do JavaScript "document.readyState" in current tab of window 1) is "complete" then
|
14
|
-
set pageLoaded to true
|
15
|
-
else
|
16
|
-
delay 3 -- you can try adjusting this delay
|
17
|
-
end if
|
18
|
-
end repeat
|
19
|
-
delay 3
|
20
|
-
do JavaScript "
|
21
|
-
function fillInForm(){
|
22
|
-
//https://developer.apple.com/downloads/index.action
|
23
|
-
if(jQuery('#accountname').length > 0){
|
24
|
-
jQuery('#accountname').val('" & apple_id & "');
|
25
|
-
jQuery('#accountpassword').prop('type', 'hidden');
|
26
|
-
jQuery('#accountpassword').val('" & apple_password & "');
|
27
|
-
jQuery('#accountname').parents('form')[0].submit();
|
28
|
-
}
|
29
|
-
}
|
30
|
-
|
31
|
-
|
32
|
-
//script courtesy of http://remysharp.com/2007/04/12/how-to-detect-when-an-external-library-has-loaded/
|
33
|
-
function loadExtScript(src, test, callback) {
|
34
|
-
var s = document.createElement('script');
|
35
|
-
s.src = src;
|
36
|
-
document.body.appendChild(s);
|
37
|
-
|
38
|
-
var callbackTimer = setInterval(function() {
|
39
|
-
var call = false;
|
40
|
-
try {
|
41
|
-
call = test.call();
|
42
|
-
} catch (e) {}
|
43
|
-
|
44
|
-
if (call) {
|
45
|
-
clearInterval(callbackTimer);
|
46
|
-
callback.call();
|
47
|
-
}
|
48
|
-
}, 100);
|
49
|
-
}
|
50
|
-
|
51
|
-
loadExtScript('https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js',
|
52
|
-
function(){ return typeof jQuery == 'function'},
|
53
|
-
fillInForm);
|
54
|
-
" in current tab of window 1
|
55
|
-
open location item 1 of argv
|
56
|
-
display dialog "Download initiated...navigate back to your terminal and await completion"
|
57
|
-
end tell
|
58
|
-
end run
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'rocket_fuel/fix/command_line_tools/dmg_metadata'
|
2
|
-
|
3
|
-
module RocketFuel
|
4
|
-
module Fix
|
5
|
-
module CommandLineTools
|
6
|
-
class Install
|
7
|
-
def initialize(dmg_path)
|
8
|
-
@dmg_path = dmg_path
|
9
|
-
@metadata = DmgMetadata.new(dmg_path)
|
10
|
-
end
|
11
|
-
|
12
|
-
def run
|
13
|
-
#sudo before the work needs to be done to improve clarity of prompt
|
14
|
-
`sudo echo `
|
15
|
-
`echo Y | PAGER=true hdiutil attach '#{@dmg_path}' -quiet `
|
16
|
-
`sudo installer -pkg '/Volumes/#{volumes_dir}/#{pkg_name}.pkg' -target /`
|
17
|
-
`hdiutil detach '/Volumes/#{volumes_dir}' || hdiutil detach '/Volumes/#{volume_dir}' -force`
|
18
|
-
end
|
19
|
-
|
20
|
-
protected
|
21
|
-
def volume_dir
|
22
|
-
@metadata.volume_dir
|
23
|
-
end
|
24
|
-
|
25
|
-
def pkg_name
|
26
|
-
@metadata.pkg_name
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
require'rocket_fuel/fix'
|
4
|
-
|
5
|
-
describe RocketFuel::Fix::CommandLineTools::DmgMetadata do
|
6
|
-
RocketFuel::SystemDetails::SUPPORTED_OSX_MINORS.each do |version|
|
7
|
-
let(:dmg_metadata) { RocketFuel::Fix::CommandLineTools::DmgMetadata.new('') }
|
8
|
-
|
9
|
-
it "has a volume dir for #{version}" do
|
10
|
-
RocketFuel::SystemDetails.os.stubs(:minor_version).returns(version)
|
11
|
-
expect(dmg_metadata.volume_dir).to_not be_nil
|
12
|
-
end
|
13
|
-
|
14
|
-
it "has a pkg_name for #{version}" do
|
15
|
-
RocketFuel::SystemDetails.os.stubs(:minor_version).returns(version)
|
16
|
-
expect(dmg_metadata.pkg_name).to_not be_nil
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
require'rocket_fuel/fix'
|
4
|
-
|
5
|
-
describe RocketFuel::Fix::CommandLineTools::Download do
|
6
|
-
RocketFuel::SystemDetails::SUPPORTED_OSX_MINORS.each do |version|
|
7
|
-
let(:download) { RocketFuel::Fix::CommandLineTools::Download.new }
|
8
|
-
it "has a url for #{version}" do
|
9
|
-
expect(download.url).to_not be_nil
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|