Class: BBFlow::Updater
- Inherits:
-
Object
- Object
- BBFlow::Updater
- Extended by:
- Persistent
- Defined in:
- lib/bb_flow/updater.rb
Constant Summary collapse
- CHECK_INTERVAL =
60 * 60 * 24 * 7
Class Method Summary collapse
Methods included from Persistent
Class Method Details
.ensure_up_to_date! ⇒ void
This method returns an undefined value.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/bb_flow/updater.rb', line 9 def ensure_up_to_date! return if recently_checked? || !update_available? if Printer.simple_question("An update from #{current_version} to #{latest_version} is available. Should I install it?") command = "gem install bb-flow -v '#{latest_version}'" puts "Executing `#{command}`..." `#{command}` exit Printer.success("Hooray, the new version has been installed! You can find the changes here: https://github.com/brightbytes/bb-flow/blob/master/CHANGELOG.md") end rescue StandardError => exception Printer.error("An error occurred while trying to self-update the gem: #{exception.}") ensure update_last_check_unixtime! end |