Sha256: 47a446a8ae174032525621181a493f27435cd3673952663947f377f29473275d

Contents?: true

Size: 918 Bytes

Versions: 12

Compression:

Stored size: 918 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)
    unless version_info[:installed_is_latest] == true
      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

12 entries across 12 versions & 1 rubygems

Version Path
hu-1.5.13 lib/hu/common.rb
hu-1.5.12 lib/hu/common.rb
hu-1.5.11 lib/hu/common.rb
hu-1.5.10 lib/hu/common.rb
hu-1.5.9 lib/hu/common.rb
hu-1.5.8 lib/hu/common.rb
hu-1.5.7 lib/hu/common.rb
hu-1.5.6 lib/hu/common.rb
hu-1.5.5 lib/hu/common.rb
hu-1.5.4 lib/hu/common.rb
hu-1.5.3 lib/hu/common.rb
hu-1.5.2 lib/hu/common.rb