Sha256: 96f50e0a4fcc7f7bf1164680d6ce29af12e7e8746c3c771d79eec496c2a067c9

Contents?: true

Size: 907 Bytes

Versions: 36

Compression:

Stored size: 907 Bytes

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

begin
  unless ENV['SKIP_VERSION_CHECK']
    version_info = BB::Gem.version_info(check_interval: 900)
    if version_info[:gem_update_available]
      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

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
hu-2.0.7 lib/hu/common.rb
hu-2.0.6 lib/hu/common.rb
hu-2.0.5 lib/hu/common.rb
hu-2.0.4 lib/hu/common.rb
hu-2.0.3 lib/hu/common.rb
hu-2.0.2 lib/hu/common.rb
hu-2.0.1 lib/hu/common.rb
hu-2.0.0 lib/hu/common.rb
hu-1.6.5 lib/hu/common.rb
hu-1.6.4 lib/hu/common.rb
hu-1.6.3 lib/hu/common.rb
hu-1.6.2 lib/hu/common.rb
hu-1.6.1 lib/hu/common.rb
hu-1.6.0 lib/hu/common.rb
hu-1.5.17 lib/hu/common.rb
hu-1.5.16 lib/hu/common.rb