Sha256: 2771b48a7daac6e1c21b98654e0a17d1ad0c76df709b6bdac6c060796dac741c

Contents?: true

Size: 1.08 KB

Versions: 19

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true
require 'blackbox/gem'
require 'config'

module Hu
  API_TOKEN = ENV['HEROKU_API_KEY'] || ENV['HEROKU_API_TOKEN'] || Netrc.read['api.heroku.com']&.password
  CONFIG_FILE = File.join(ENV['HOME'], '.hu.yaml')
end

class String
  def strip_heredoc
    indent = scan(/^[ \t]*(?=\S)/).min&.size || 0
    gsub(/^[ \t]{#{indent}}/, '')
  end
end

Config.load_and_set_settings Hu::CONFIG_FILE
require 'hu/telemetry'

begin
  unless ENV['SKIP_VERSION_CHECK']
    version_info = BB::Gem.version_info(check_interval: 900)
    unless version_info[:installed_is_latest] == true
      Hu::Tm.t(:gem_outdated, installed_version: version_info[:gem_installed_version], available_version: version_info[:gem_latest_version])
      puts
      puts "\e[33;1mWoops! \e[0mA newer version of #{version_info[:gem_name]} is available."
      puts "       Please type '\e[1mgem install #{version_info[:gem_name]}\e[0m' to upgrade (v#{version_info[:gem_installed_version]} -> v#{version_info[:gem_latest_version]})."
      sleep 1
      puts
      exit 1
    end
  end
rescue
end

Hu::Tm.t(:launch)

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
hu-1.5.1 lib/hu/common.rb
hu-1.5.0 lib/hu/common.rb
hu-1.4.11 lib/hu/common.rb
hu-1.4.10 lib/hu/common.rb
hu-1.4.9 lib/hu/common.rb
hu-1.4.8 lib/hu/common.rb
hu-1.4.7 lib/hu/common.rb
hu-1.4.6 lib/hu/common.rb
hu-1.4.5 lib/hu/common.rb
hu-1.4.4 lib/hu/common.rb
hu-1.4.2 lib/hu/common.rb
hu-1.4.1 lib/hu/common.rb
hu-1.4.0 lib/hu/common.rb
hu-1.3.23 lib/hu/common.rb
hu-1.3.22 lib/hu/common.rb
hu-1.3.21 lib/hu/common.rb
hu-1.3.20 lib/hu/common.rb
hu-1.3.19 lib/hu/common.rb
hu-1.3.18 lib/hu/common.rb