class ActiveScripts::Packages::Wkhtmltopdf

Private Instance Methods

install() click to toggle source

INFO: ActiveScripts::Packages::Wkhtmltopdf contains code that

execute the wkhtmltopdf package.
# File lib/active_scripts/packages/wkhtmltopdf.rb, line 10
def install
  if package_installed?(command: "which wkhtmltopdf", includes: "wkhtmltopdf")
    case $operating_system
    when :linux
      execute_command!("sudo apt-get -y install xvfb")
      execute_command!("wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb")
      execute_command!("sudo apt-get -y -f install")
      execute_command!("sudo dpkg -i wkhtmltox-0.12.2.1_linux-trusty-amd64.deb")
      execute_command!("cat #{addendum_path!('wkhtmltopdf.txt')} > wkhtmltopdf.sh")
      execute_command!("sudo chmod a+x wkhtmltopdf.sh")
      execute_command!("sudo mv wkhtmltopdf.sh /usr/local/bin/")
      say_ok("   Installation complete!")
    else
      notify_package_unavailable!
    end
  else
    notify_package_missing!
  end
end
uninstall() click to toggle source
# File lib/active_scripts/packages/wkhtmltopdf.rb, line 47
def uninstall
  if package_installed?(command: "which wkhtmltopdf", includes: "wkhtmltopdf")
    case $operating_system
    when :linux
      execute_command!("sudo apt-get -y --purge remove xvfb")
      execute_command!("sudo apt-get -y autoremove")
      say_ok("   Installation complete!")
    else
      notify_package_unavailable!
    end
  else
    notify_package_missing!
  end
end
upgrade() click to toggle source
# File lib/active_scripts/packages/wkhtmltopdf.rb, line 30
def upgrade
  if package_installed?(command: "which wkhtmltopdf", includes: "wkhtmltopdf")
    case $operating_system
    when :linux
      execute_command!("sudo apt-get -y upgrade xvfb")
      execute_command!("sudo apt-get -y -f upgrade")
      execute_command!("wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb")
      execute_command!("sudo dpkg -i wkhtmltox-0.12.2.1_linux-trusty-amd64.deb")
      say_ok("   Installation complete!")
    else
      notify_package_unavailable!
    end
  else
    notify_package_missing!
  end
end