rocket_fuel 0.0.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 +7 -0
- data/.gitignore +14 -0
- data/.rspec +1 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +7 -0
- data/bin/rocket_fuel +8 -0
- data/lib/rocket_fuel/command_line_interface.rb +40 -0
- data/lib/rocket_fuel/fix/abstract_fix.rb +30 -0
- data/lib/rocket_fuel/fix/command_line_tool_fix.rb +61 -0
- data/lib/rocket_fuel/fix/command_line_tools/dmg_metadata.rb +46 -0
- data/lib/rocket_fuel/fix/command_line_tools/download.rb +30 -0
- data/lib/rocket_fuel/fix/command_line_tools/download_routine.rb +76 -0
- data/lib/rocket_fuel/fix/command_line_tools/install.applescript +58 -0
- data/lib/rocket_fuel/fix/command_line_tools/install.rb +31 -0
- data/lib/rocket_fuel/fix/file_sanitizer_fix.rb +25 -0
- data/lib/rocket_fuel/fix/macports_fix.rb +36 -0
- data/lib/rocket_fuel/fix/rbenv_fix.rb +24 -0
- data/lib/rocket_fuel/fix/rvm_fix.rb +24 -0
- data/lib/rocket_fuel/fix.rb +10 -0
- data/lib/rocket_fuel/operating_system.rb +53 -0
- data/lib/rocket_fuel/precheck/check.rb +52 -0
- data/lib/rocket_fuel/precheck/check_result.rb +17 -0
- data/lib/rocket_fuel/precheck/command_line_result_presenter.rb +28 -0
- data/lib/rocket_fuel/precheck/command_line_tool_check.rb +43 -0
- data/lib/rocket_fuel/precheck/macports_check.rb +48 -0
- data/lib/rocket_fuel/precheck/rbenv_check.rb +42 -0
- data/lib/rocket_fuel/precheck/run.rb +57 -0
- data/lib/rocket_fuel/precheck/rvm_check.rb +41 -0
- data/lib/rocket_fuel/precheck.rb +26 -0
- data/lib/rocket_fuel/system_details.rb +21 -0
- data/lib/rocket_fuel/version.rb +3 -0
- data/lib/rocket_fuel.rb +10 -0
- data/rocket_fuel.gemspec +28 -0
- data/spec/rocket_fuel/fix/command_line_tools/dmg_metadata_spec.rb +19 -0
- data/spec/rocket_fuel/fix/command_line_tools/download_spec.rb +12 -0
- data/spec/rocket_fuel/fix/macports_fix_spec.rb +23 -0
- data/spec/rocket_fuel/fix/rbenv_fix_spec.rb +29 -0
- data/spec/rocket_fuel/fix/rvm_fix_spec.rb +29 -0
- data/spec/rocket_fuel/operating_system_spec.rb +29 -0
- data/spec/rocket_fuel/precheck/check_result_spec.rb +23 -0
- data/spec/rocket_fuel/precheck/check_spec.rb +19 -0
- data/spec/rocket_fuel/precheck/command_line_result_presenter_spec.rb +32 -0
- data/spec/rocket_fuel/precheck/command_line_tool_check_spec.rb +71 -0
- data/spec/rocket_fuel/precheck/macports_check_spec.rb +34 -0
- data/spec/rocket_fuel/precheck/rbenv_check_spec.rb +35 -0
- data/spec/rocket_fuel/precheck/run_spec.rb +10 -0
- data/spec/rocket_fuel/precheck/rvm_check_spec.rb +38 -0
- data/spec/rocket_fuel/precheck_spec.rb +10 -0
- data/spec/spec_helper.rb +34 -0
- metadata +195 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b2b732a640edd303e1eb042f58222a07b00c3070
|
4
|
+
data.tar.gz: cb1593ddd42da275b2d15724d0f4d36ee934f7a3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 21f0ed99469e6f0ca1b470713b51f1a27588f6dcd9ba257c075e7dd37c7220594ebe826fcc30535f939fccf4406ea23f0b40a82ea513fe700d288897f3350853
|
7
|
+
data.tar.gz: 6882d0a7211428262167273e4a8b75b542cdfe141c9180d5643f04c4df7995663f2e43d23f10742ea35081b38be9d18c3f989ecdd7066ec3374dc53e085d6f73
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Dan Pickett
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# RocketFuel
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'rocket_fuel'
|
11
|
+
```
|
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
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it ( https://github.com/[my-github-username]/rocket_fuel/fork )
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/rocket_fuel
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
module RocketFuel
|
2
|
+
class CommandLineInterface < Thor
|
3
|
+
package_name 'rocket_fuel'
|
4
|
+
|
5
|
+
desc 'precheck', 'check for requirements prior to installation'
|
6
|
+
def precheck
|
7
|
+
require 'rocket_fuel/precheck'
|
8
|
+
say '***Rocket Fuel: Checking prerequisites***', :blue
|
9
|
+
say ''
|
10
|
+
|
11
|
+
RocketFuel::Precheck::Run.new.results
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'fix', 'fix problems that can cause issues with running rocket fuel'
|
16
|
+
def fix(fix)
|
17
|
+
require 'rocket_fuel/precheck'
|
18
|
+
require 'rocket_fuel/fix'
|
19
|
+
if fix_class = RocketFuel::Precheck.fixes[fix.to_sym]
|
20
|
+
the_fix = fix_class.new
|
21
|
+
say(the_fix.title)
|
22
|
+
say('Fixing...')
|
23
|
+
the_fix.run
|
24
|
+
say('')
|
25
|
+
|
26
|
+
if the_fix.check
|
27
|
+
if the_fix.check.ok?
|
28
|
+
say('Fix successful.', :green)
|
29
|
+
else
|
30
|
+
say('Fix failed.', :red)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
desc 'install [package]', 'install rocket fuel packages'
|
37
|
+
def install
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rocket_fuel/precheck'
|
2
|
+
|
3
|
+
module RocketFuel
|
4
|
+
module Fix
|
5
|
+
class AbstractFix
|
6
|
+
class << self
|
7
|
+
def fix_name(fix_name)
|
8
|
+
@fix_name = fix_name
|
9
|
+
end
|
10
|
+
|
11
|
+
def fix_name_value
|
12
|
+
@fix_name
|
13
|
+
end
|
14
|
+
|
15
|
+
def register!
|
16
|
+
RocketFuel::Precheck.register_fix(self)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def check
|
21
|
+
unless @check
|
22
|
+
if klass = RocketFuel::Precheck.checks[self.class.fix_name_value]
|
23
|
+
@check = klass.new
|
24
|
+
end
|
25
|
+
end
|
26
|
+
@check
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'rocket_fuel/fix/command_line_tools/download_routine'
|
2
|
+
require 'rocket_fuel/fix/command_line_tools/install'
|
3
|
+
module RocketFuel
|
4
|
+
module Fix
|
5
|
+
class CommandLineToolFix < AbstractFix
|
6
|
+
fix_name :command_line_tools
|
7
|
+
register!
|
8
|
+
|
9
|
+
include Thor::Base
|
10
|
+
|
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
|
+
def run
|
16
|
+
dev_account = ask('Do you have an apple developer account?',
|
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
|
38
|
+
end
|
39
|
+
|
40
|
+
def title
|
41
|
+
'Command Line Tools must be installed for you to install ruby!'
|
42
|
+
end
|
43
|
+
|
44
|
+
def message
|
45
|
+
'Installing Ruby requires a C compiler. For the Mac, Apple provides ' +
|
46
|
+
'a package known as "Command Line Tools" which includes a C compiler. ' +
|
47
|
+
'In order to download these tools, you must create an Apple Developer ' +
|
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'
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,46 @@
|
|
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
|
@@ -0,0 +1,30 @@
|
|
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_version.gsub(/\.*\Z/, '')
|
22
|
+
end
|
23
|
+
|
24
|
+
def base_host
|
25
|
+
'https://developer.apple.com'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,76 @@
|
|
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
|
@@ -0,0 +1,58 @@
|
|
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
|
@@ -0,0 +1,31 @@
|
|
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
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
module RocketFuel
|
3
|
+
module Fix
|
4
|
+
class FileSanitizerFix < AbstractFix
|
5
|
+
def run
|
6
|
+
self.class.files_to_remove.each do |path|
|
7
|
+
if FileTest.exist?(path)
|
8
|
+
FileUtils.rm_rf(path)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def remove_file(file)
|
15
|
+
@files_to_remove ||= []
|
16
|
+
@files_to_remove << file
|
17
|
+
end
|
18
|
+
|
19
|
+
def files_to_remove
|
20
|
+
@files_to_remove
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'rocket_fuel/fix/file_sanitizer_fix'
|
2
|
+
module RocketFuel
|
3
|
+
module Fix
|
4
|
+
class MacportsFix < FileSanitizerFix
|
5
|
+
UNINSTALL_URL = 'https://guide.macports.org/chunked/' +
|
6
|
+
'installing.macports.uninstalling.html'
|
7
|
+
|
8
|
+
fix_name :macports
|
9
|
+
register!
|
10
|
+
|
11
|
+
#file manifest retrieved from
|
12
|
+
#https://guide.macports.org/chunked/installing.macports.uninstalling.html
|
13
|
+
remove_file '/opt/local'
|
14
|
+
remove_file '/Applications/DarwinPorts'
|
15
|
+
remove_file '/Applications/MacPorts'
|
16
|
+
remove_file '/Library/LaunchDaemons/org.macports.*'
|
17
|
+
remove_file '/Library/Receipts/DarwinPorts*.pkg'
|
18
|
+
remove_file '/Library/Receipts/MacPorts*.pkg'
|
19
|
+
remove_file '/Library/StartupItems/DarwinPortsStartup'
|
20
|
+
remove_file '/Library/Tcl/darwinports1.0'
|
21
|
+
remove_file '/Library/Tcl/macports1.0'
|
22
|
+
remove_file File.join(ENV['HOME'], '.macports')
|
23
|
+
|
24
|
+
def title
|
25
|
+
'macports must be removed for Rocket Fuel to function properly'
|
26
|
+
end
|
27
|
+
|
28
|
+
def message
|
29
|
+
'Rocket Fuel installs a package manager, homebrew, which will ' +
|
30
|
+
'not play nicely with macports. You can follow uninstallation ' +
|
31
|
+
"instructions at #{UNINSTALL_URL}" +
|
32
|
+
'to remove macports.'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rocket_fuel/fix/file_sanitizer_fix'
|
2
|
+
module RocketFuel
|
3
|
+
module Fix
|
4
|
+
class RbenvFix < FileSanitizerFix
|
5
|
+
fix_name :rbenv
|
6
|
+
register!
|
7
|
+
|
8
|
+
remove_file RocketFuel::Precheck::RbenvCheck.home_path
|
9
|
+
remove_file RocketFuel::Precheck::RbenvCheck.global_path
|
10
|
+
|
11
|
+
def title
|
12
|
+
'rbenv must be removed for Rocket Fuel to function properly'
|
13
|
+
end
|
14
|
+
|
15
|
+
def message
|
16
|
+
'Rocket Fuel installs a ruby version manager, chruby, which will ' +
|
17
|
+
'not play nicely with rbenv. To remove it, you can invoke the command ' +
|
18
|
+
'`rm -rf ~/.rbenv && rm -rf /usr/local/var/rbenv`. ' +
|
19
|
+
'Note that once Rocket Fuel has installed successfully, ' +
|
20
|
+
'you will likely have to reinstall ruby gems previously installed.'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rocket_fuel/fix/file_sanitizer_fix'
|
2
|
+
|
3
|
+
module RocketFuel
|
4
|
+
module Fix
|
5
|
+
class RvmFix < FileSanitizerFix
|
6
|
+
fix_name :rvm
|
7
|
+
register!
|
8
|
+
|
9
|
+
remove_file RocketFuel::Precheck::RvmCheck.home_path
|
10
|
+
remove_file RocketFuel::Precheck::RvmCheck.global_path
|
11
|
+
|
12
|
+
def title
|
13
|
+
'RVM must be removed for Rocket Fuel to function properly'
|
14
|
+
end
|
15
|
+
|
16
|
+
def message
|
17
|
+
'Rocket Fuel installs a ruby version manager, chruby, which will ' +
|
18
|
+
'not play nicely with RVM. To remove it, you can invoke the command ' +
|
19
|
+
'`rvm implode`. Note that once Rocket Fuel has installed successfully, ' +
|
20
|
+
'you will likely have to reinstall ruby gems previously installed.'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
|
3
|
+
module RocketFuel
|
4
|
+
class OperatingSystem
|
5
|
+
attr_reader :raw_name, :version
|
6
|
+
|
7
|
+
def initialize(os = nil, version = nil)
|
8
|
+
@raw_name, @version = os, version
|
9
|
+
if @raw_name.nil?
|
10
|
+
derive_raw_name
|
11
|
+
end
|
12
|
+
|
13
|
+
if @version.nil?
|
14
|
+
derive_version
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
#cribbed from Selenium
|
20
|
+
def name
|
21
|
+
case @raw_name
|
22
|
+
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
23
|
+
:windows
|
24
|
+
when /darwin|mac os/
|
25
|
+
:mac
|
26
|
+
when /linux/
|
27
|
+
:linux
|
28
|
+
when /solaris|bsd/
|
29
|
+
:unix
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def platform_family?(platform)
|
34
|
+
name == platform.to_sym
|
35
|
+
end
|
36
|
+
|
37
|
+
#strip the patch level
|
38
|
+
def minor_version
|
39
|
+
/\A(\d+\.\d+)/.match(@version)[0]
|
40
|
+
end
|
41
|
+
|
42
|
+
protected
|
43
|
+
def derive_raw_name
|
44
|
+
@raw_name = RbConfig::CONFIG['host_os']
|
45
|
+
end
|
46
|
+
|
47
|
+
def derive_version
|
48
|
+
if platform_family?(:mac)
|
49
|
+
@version = `sw_vers -productVersion`.chomp
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|