class Velcro::Installer::Base

Parent class for velcro installers

Attributes

dryrun[R]

Public Class Methods

installer(options = {}) click to toggle source
# File lib/velcro/installer/base.rb, line 11
def self.installer(options = {})
  return Installer::Mac.new(options)   if Velcro.osx?
  return Installer::Linux.new(options) if Velcro.linux?

  fail UnkownOperatingSystem, 'Velcro cannot recognize your OS'
end
new(options = {}) click to toggle source
# File lib/velcro/installer/base.rb, line 7
def initialize(options = {})
  @dryrun = options[:dryrun] || false
end

Public Instance Methods

install(target) click to toggle source
# File lib/velcro/installer/base.rb, line 18
def install(target)
  package_manager = manager_name(target)
  if package_manager.nil?
    puts "Uknown install procedure for #{target}"
    return
  else
    puts "Installing #{target} via #{package_manager}..."
  end

  return if dryrun
  # Resolves to something like:
  #    self.brew_install("mysql")
  send "#{package_manager}_install", target
end

Private Instance Methods

manager_name(target) click to toggle source
# File lib/velcro/installer/base.rb, line 35
def manager_name(target)
  return :velcro if respond_to?(target.to_sym, true)
  return :brew   if brew?(target)
  return :cask   if cask?(target)
end
oh_my_zsh() click to toggle source
# File lib/velcro/installer/base.rb, line 52
def oh_my_zsh
  `curl -L http://install.ohmyz.sh | sh`
end
rvm() click to toggle source
# File lib/velcro/installer/base.rb, line 45
def rvm
  `gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3`
  `curl -sSL https://get.rvm.io | bash -s stable`
  `. #{Velco.home}/.rvm/scripts/rvm`
  # `rvm install #{Velcro.config.ruby_version}`
end
velcro_install(target) click to toggle source
# File lib/velcro/installer/base.rb, line 41
def velcro_install(target)
  send(target.to_sym)
end