Class: Spree::Admin::Updater
- Inherits:
-
Object
- Object
- Spree::Admin::Updater
- Defined in:
- app/models/spree/admin/updater.rb
Constant Summary collapse
- SPREE_CLOUD_UPDATES_URL =
'https://spreecloud.io/updates.json'.freeze
Class Method Summary collapse
- .current_release ⇒ Object
-
.fetch_updates ⇒ Array<Hash>
Returns the releases newer than the running version, fetched from spreecloud.io and cached for a day.
- .latest_release ⇒ Object
- .update_available? ⇒ Boolean
Class Method Details
.current_release ⇒ Object
19 20 21 |
# File 'app/models/spree/admin/updater.rb', line 19 def current_release Spree.version end |
.fetch_updates ⇒ Array<Hash>
Returns the releases newer than the running version, fetched from
spreecloud.io and cached for a day. The request carries only the
running version, Rails.env, the storefront URL and the anonymous
Spree.install_id. Failures are cached as an empty list too, so an
unreachable endpoint costs at most one timed-out request per day.
30 31 32 33 34 |
# File 'app/models/spree/admin/updater.rb', line 30 def fetch_updates Rails.cache.fetch("spree/admin/updater/fetch_updates/#{current_release}", expires_in: 1.day) do fetch_updates_from_spree_cloud end end |
.latest_release ⇒ Object
15 16 17 |
# File 'app/models/spree/admin/updater.rb', line 15 def latest_release fetch_updates.first end |
.update_available? ⇒ Boolean
11 12 13 |
# File 'app/models/spree/admin/updater.rb', line 11 def update_available? fetch_updates.any? end |