class Granify::Controller::Update

Public Instance Methods

goliath() click to toggle source
# File lib/controllers/update.rb, line 33
def goliath
  Notify.info("Checking for updates")



end
granify() click to toggle source
# File lib/controllers/update.rb, line 25
def granify
  Notify.info("Checking for updates")

  status = @model.command.arbitrary("git checkout master && git pull")
  puts status.inspect
  exit
end
pre_exec() click to toggle source

Setup all flags supported by this command

Calls superclass method Granify::Controller::Base#pre_exec
# File lib/controllers/update.rb, line 5
def pre_exec
  # flag methods that require internet access
  @methods_require_internet.push(:rbtils)

  super
end
rbtils() click to toggle source
# File lib/controllers/update.rb, line 12
def rbtils
  Notify.info("Checking for updates")

  status = Command::Exec.global("(cd #{Granify::INSTALLED_DIR} && git checkout master && git pull) 2>&1").split("\n")
  
  if status.include? "Your branch is up-to-date with 'origin/master'."
    Notify.warning("You are running the current version of #{Granify::PACKAGE_NAME}")
  else
    # TODO: run on a different machine, currently this just assumes it worked..
    Notify.success("Successfully updated to the latest version")
  end
end