Class: RightConf::GitRepoConfigurator

Inherits:
Object
  • Object
show all
Includes:
Configurator
Defined in:
lib/rconf/configurators/git_repo_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

Check whether repo was already cloned

Return

true

If repo was already cloned

false

Otherwise



31
32
33
# File 'lib/rconf/configurators/git_repo_configurator.rb', line 31

def check_linux
  File.exist?(path) && File.exist?(File.join(path, '.git'))
end

#run_linuxObject Also known as: run_darwin

Clone git repo and run build commands if given

Return

true

Always return true



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

def run_linux
  if File.exist?(path)
    FileUtils.mv(path, "#{path}_old")
    post_note "Had to move #{path} to #{path}_old"
  end
  report_check("Cloning #{repo} into #{path}")
  Command.execute('git', 'clone', repo, path,
                  :abort_on_failure => "Failed to clone #{repo} into #{path}")
  report_success
  if tag
    report_check("Checking out #{tag}")
    Dir.chdir(path) do
      Command.execute('git', 'checkout', tag,
                      :abort_on_failure => "Failed to checkout #{tag}")
    end
    report_success
  end
  true
end

#run_windowsObject

Clone git repo and run build commands if given on Windows

Return

true

Always return true



66
67
68
# File 'lib/rconf/configurators/git_repo_configurator.rb', line 66

def run_windows
  true # TBD
end