class DbMirror::CLI

Public Instance Methods

start() click to toggle source
# File lib/db_mirror.rb, line 9
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
update_gem!() click to toggle source
# File lib/db_mirror.rb, line 22
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