Module: GitPusshuTen::Helpers::Environment::Installers

Included in:
Environment
Defined in:
lib/gitpusshuten/helpers/environment/installers.rb

Instance Method Summary collapse

Instance Method Details

#ensure_aptitude_installed!Object

Ensures that the aptitude package manager is installed



47
48
49
50
51
52
53
54
# File 'lib/gitpusshuten/helpers/environment/installers.rb', line 47

def ensure_aptitude_installed!
  if not installed?('aptitude')
    Spinner.return :message => "Ensuring package manager is installed and up to date.." do
      execute_as_root('apt-get update; apt-get install -y aptitude')
      'Done!'.color(:green)
    end
  end
end

#install!(utility) ⇒ Object

Installs the specified package(s)



8
9
10
11
# File 'lib/gitpusshuten/helpers/environment/installers.rb', line 8

def install!(utility)
  ensure_aptitude_installed!
  execute_as_root("aptitude update; aptitude install -y #{utility}")
end

#install_gitconfig!Object

Installs a generated .gitconfig



32
33
34
35
36
# File 'lib/gitpusshuten/helpers/environment/installers.rb', line 32

def install_gitconfig!
  command  = "cd #{home_dir}; echo -e \"[receive]\ndenyCurrentBranch = ignore\" > .gitconfig;"
  command += "chown #{c.user}:#{c.user} .gitconfig"
  execute_as_root(command)
end

#install_pushand!Object

Installs PushAnd



22
23
24
25
26
27
28
# File 'lib/gitpusshuten/helpers/environment/installers.rb', line 22

def install_pushand!      
  download_packages!(home_dir)
  command = "cd #{home_dir}; cp -R gitpusshuten-packages/pushand/ .; chown -R #{c.user}:#{c.user} pushand;"
  command += "'#{home_dir}/pushand/pushand_server_uninstall'; '#{home_dir}/pushand/pushand_server_install'"
  execute_as_root(command)
  clean_up_packages!(home_dir)
end

#installed?(utility) ⇒ Boolean

Determines whether the specified utility has been installed or not

Returns:

  • (Boolean)


40
41
42
43
# File 'lib/gitpusshuten/helpers/environment/installers.rb', line 40

def installed?(utility)
  return false if execute_as_root("which #{utility}").nil?
  true
end

#uninstall!(utility) ⇒ Object

Uninstalls the specified package(s)



15
16
17
18
# File 'lib/gitpusshuten/helpers/environment/installers.rb', line 15

def uninstall!(utility)
  ensure_aptitude_installed!
  execute_as_root("aptitude remove -y #{utility}")
end