Sha256: e4f161947065cce8d1fee97d4f8d487be7569ba37f21f66d741a358f075bd85b

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

#!/usr/bin/env ruby

require 'optparse'
require 'methadone'
require 'recent_ruby'
require 'net/http'
require 'json'
require 'parser/current'

class App
  include Methadone::Main
  include Methadone::CLILogging
  extend RecentRuby

  main do
    gemfile = options['gemfile']
    version = options['version-string']

    version_base_url = ENV['VERSION_BASE_URL'] || 'https://raw.githubusercontent.com/rbenv/ruby-build/master/share/ruby-build/'
    versions_url = ENV['VERSIONS_URL'] || 'https://api.github.com/repos/rbenv/ruby-build/contents/share/ruby-build'

    validate_args(gemfile, version)
    version = parse_gemfile(gemfile) if gemfile
    validate_mri_version(version)
    minor = version.split('.')[0, 2]

    rubies = get_rubies(versions_url)
    latest = latest_minor_version(rubies, minor)
    compare_versions(version, latest, minor)

    check_eol(version, version_base_url)

    puts 'Ruby version check completed successfully.'
  end

  on('--gemfile PATH', 'Path of Gemfile')
  on('--version-string STRING', 'Ruby version string (e.g. 2.3.1)')

  version RecentRuby::VERSION

  use_log_level_option toggle_debug_on_signal: 'USR1'

  go!
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
recent_ruby-0.1.5 bin/recent_ruby
recent_ruby-0.1.4 bin/recent_ruby
recent_ruby-0.1.3 bin/recent_ruby
recent_ruby-0.1.2 bin/recent_ruby
recent_ruby-0.1.1 bin/recent_ruby
recent_ruby-0.1.0 bin/recent_ruby