lib/renuo/cli.rb in renuo-cli-1.2.1 vs lib/renuo/cli.rb in renuo-cli-1.3.0

- old
+ new

@@ -1,7 +1,8 @@ require 'renuo/cli/version' require 'rubygems' +require 'gems' require 'colorize' require 'renuo/cli/app/name_display' require 'renuo/cli/app/local_storage' require 'renuo/cli/app/list_large_git_files' require 'renuo/cli/app/generate_password' @@ -16,10 +17,22 @@ module Renuo class CLI def start require 'commander/import' program :version, Renuo::Cli::VERSION - program :description, 'renuo CLI' + program :description, 'Renuo CLI' + + info = Gems.info Renuo::Cli::NAME + + if Gem::Version.new(Renuo::Cli::VERSION) < Gem::Version.new(info['version']) + say "You are running the version #{Renuo::Cli::VERSION} but the brand new #{info['version']} is available. 🎉" + if agree("Why don't you update with `gem update renuo-cli`? I can run it for you. 💪") + system("gem update #{Renuo::Cli::NAME}") + abort 'Nice! I updated myself. 🤩 Now you can run the command again.' + end + abort('Good. Just do it yourself then...😒') + exit + end command 'display-name'.to_sym do |c| c.syntax = 'renuo display-name [options]' c.summary = 'Sets the name of a customer on the Renuo dashboard' c.description = 'Sets the name of a customer on the Renuo dashboard'