Sha256: ce5fc64f2456e91ed43af3ff35628b89ba1ce2425a4a8b3e8d9ab3b1eafad551
Contents?: true
Size: 916 Bytes
Versions: 4
Compression:
Stored size: 916 Bytes
Contents
require "open-uri" require "thor" require "yajl" module Codelation class Cli < Thor desc "update", "Update codelation-cli to latest version" def update command = "gem install codelation-cli" puts "Running #{command}..." exec(command) end desc "version", "Show version information" def version gem_version = "v#{Codelation::VERSION}" # Grab the latest version of the RubyGem rubygems_json = open("https://rubygems.org/api/v1/gems/codelation-cli.json").read rubygems_version = "v#{Yajl::Parser.parse(rubygems_json)['version'].strip}" upgrade_message = "" if gem_version != rubygems_version upgrade_message = " Run `codelation update` to install" end puts puts "Codelation CLI" puts " Installed: #{gem_version}" puts " Latest: #{rubygems_version}#{upgrade_message}" puts end end end
Version data entries
4 entries across 4 versions & 1 rubygems