Class: Mozzn::Cli
Instance Method Summary collapse
Instance Method Details
#help(command = nil) ⇒ Object
33 34 35 36 37 |
# File 'lib/mozzn/cli.rb', line 33 def help command = nil puts 'Primary help topics, type "mozzn help COMMAND" for more details.' puts "Version: #{Mozzn::VERSION}" super command end |
#update ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mozzn/cli.rb', line 19 def update # TODO after gem release https://rubygems.org/api/v1/versions/mozzn.json @connection = Faraday.new('https://rubygems.org/api/v1/versions/coulda.json') response = @connection.get body = JSON.parse(response.body) versions = body.map { |n| n['number'] } if Gem::Version.new(versions.last) > Gem::Version.new(Mozzn::VERSION) say 'An update is available. To install it run the following command "update gem mozzn"', :yellow else say 'You have the latest version.', :green end end |