dawarich/app/services/check_app_version.rb

14 lines
332 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class CheckAppVersion
def initialize
@repo_url = 'https://api.github.com/repos/Freika/dawarich/tags'
@app_version = File.read('.app_version').strip
end
def call
latest_version = JSON.parse(Net::HTTP.get(URI.parse(@repo_url)))[0]['name']
latest_version == @app_version
end
end