Class: RightConf::MercurialConfigurator

Inherits:
Object
  • Object
show all
Includes:
Configurator
Defined in:
lib/rconf/configurators/mercurial_configurator.rb

Constant Summary collapse

MAC_MERCURIAL_URL =
'http://mercurial.berkwood.com/binaries/Mercurial-1.8.1-py2.6-macosx10.6.zip'
MAC_MERCURIAL_FILE =
'mercurial-1.8.1_20110310-py2.6-macosx10.6'

Instance Method Summary collapse

Methods included from Configurator

#[], included, #post_process, #run, #signature, #validate

Methods included from ProgressReporter

included, report_to_file, report_to_stdout

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RightConf::Configurator

Instance Method Details

#run_darwinObject

Brew does not have a package for mercurial :(

Return

true

Always return true



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/rconf/configurators/mercurial_configurator.rb', line 42

def run_darwin
  unless mercurial_installed
    report_check('Installing Mercurial')
    tempdir = File.join(ENV['HOME'], '.rconf_temp')
    FileUtils.mkdir_p(tempdir)
    begin
      Dir.chdir(tempdir) do
        Command.execute('curl', '-O', '-f', MAC_MERCURIAL_URL,
                        abort_option('Failed to download Mercurial'))
        Command.execute('unzip', File.basename(MAC_MERCURIAL_URL),
                        abort_option('Failed to unzip Mercurial'))
      end
      Dir.chdir(File.join(tempdir, MAC_MERCURIAL_FILE)) do
        Command.sudo('installer', '-pkg', MAC_MERCURIAL_FILE.gsub('_', '+') + '.mpkg', '-target', '/',
                     abort_option('Failed to install Mercurial'))
      end
    ensure
      FileUtils.rm_rf(tempdir)
    end
    report_success
  end
end

#run_linuxObject

Install Linux Mercurial package

Return

true

Always return true



31
32
33
34
35
36
# File 'lib/rconf/configurators/mercurial_configurator.rb', line 31

def run_linux
  unless mercurial_installed
    opts = { :report => true }.merge(abort_option('Failed to install Mercurial'))
    PackageInstaller.install('mercurial', opts) { !mercurial_installed }
  end
end

#run_windowsObject

Install Windows software

Return

true

Always return true



69
70
71
# File 'lib/rconf/configurators/mercurial_configurator.rb', line 69

def run_windows
  # TBD
end