Class: RightConf::BuildConfigurator

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

Instance Method Summary collapse

Methods included from Configurator

#[], #check, 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

#check_linuxObject Also known as: check_darwin, check_windows

No way to check, return false

Return

false

Always return false



36
37
38
# File 'lib/rconf/configurators/build_configurator.rb', line 36

def check_linux
  false
end

#run_linuxObject Also known as: run_darwin

Run command line

Return

true

Always return true



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/rconf/configurators/build_configurator.rb', line 46

def run_linux
  if tarball_url && tarball_dir.nil?
    report_fatal("tarball_url is specified (#{tarball_url.inspect}) but tarball_dir is missing")
  end
  report_check message if message
  Command.execute('mkdir', '-p', path, :abort_on_failure => "Failed to create #{path}")
  if tarball_url
    Dir.chdir(path) do
      filename = File.basename(tarball_url)
      unless File.exists?(File.join(Dir.pwd, filename))
        Command.execute('curl', '-O', '-f', tarball_url, :abort_on_failure => "Failed to curl #{tarball_url}") 
      end
      abf = { :abort_on_failure => "Failed to uncompress #{filename}" }
      case filename
      when /\.tar\.gz$|\.tgz$/ then
        Command.execute('tar', '-xzvf', filename, abf)
      when /\.zip$/ then
        Command.execute('unzip', filename, abf)
      when /\.gzip$/ then
        Command.execute('gunzip', filename, abf)
      else
        report_fatal("Unknown file extension #{File.extname(filename)}")
      end
      path File.join(path, tarball_dir)
      if !File.directory?(path)
        report_fatal("Could not find tarball dir #{tarball_dir.inspect} after untaring #{filename}")
      end
    end
  end
  Dir.chdir(path) do
    Command.execute(*command_args(pre_step)) if pre_step
    opts = configure_opts && configure_opts[Platform.family]
    Command.execute(*command_args("./configure #{opts}"))
    Command.execute(*command_args('make'))
    report_success
    report("Please enter you password to run the install step")
    Command.sudo('echo')
    report_check 'Installing'
    Command.sudo(*command_args('make install'))
  end
  report_success if message
  true
end

#run_windowsObject

Run command line on Windows

Return

true

Always return true



95
96
97
# File 'lib/rconf/configurators/build_configurator.rb', line 95

def run_windows
  true # TBD
end