class POEditor::Command
Public Class Methods
check_update()
click to toggle source
# File lib/poeditor/commands/command.rb, line 29 def self.check_update begin uri = URI("https://api.github.com"\ "/repos/StyleShare/poeditor-cli/releases/latest") data = JSON(Net::HTTP.get(uri)) latest = data["tag_name"] if Gem::Version.new(VERSION) < Gem::Version.new(latest) UI.puts %{\ poeditor-cli #{latest} is available. (You're using #{VERSION}) To update: `$ gem install poeditor-cli` Changelog: https://github.com/StyleShare/poeditor-cli/releases\ }.green end rescue end end
command_class(argv)
click to toggle source
# File lib/poeditor/commands/command.rb, line 18 def self.command_class(argv) case argv[0] when "pull" PullCommand when "--version" VersionCommand else HelpCommand end end
run(argv)
click to toggle source
The entry point of the CLI application
# File lib/poeditor/commands/command.rb, line 7 def self.run(argv) UI.enabled = true self.check_update command = self.command_class(argv).new begin command.run(argv) rescue POEditor::Exception => e puts "[!] #{e.message}".red end end