require "rubygems" require "commander" require "gems" module DbMirror class CLI include Commander::Methods def start program :name, DbMirror::Cli::NAME program :version, DbMirror::Cli::VERSION program :description, DbMirror::Cli::DESCRIPTION update_gem! command :gen do |c| end command :compare do |c| end end def update_gem! info = Gems.info DbMirror::Cli::NAME if Gem::Version.new(DbMirror::Cli::VERSION) < Gem::Version.new(info["version"]) say "You are running the version #{DbMirror::Cli::VERSION} but the brand new #{info["version"]} is available. 🎉" if agree("Why don't you update with `gem update #{DbMirror::Cli::VERSION}`? I can run it for you. 💪") system("gem update #{DbMirror::Cli::NAME}") abort "Nice! I updated myself. Now you can run the command again." end abort("Good. Just do it yourself then...😒") end end end end