module PgUtils

Public Class Methods

addon_name() click to toggle source
# File lib/heroku/pgutils.rb, line 8
def self.addon_name
  ENV['HEROKU_POSTGRESQL_ADDON_NAME'] || 'heroku-postgresql'
end

Public Instance Methods

deprecate_dash_dash_db(name) click to toggle source
# File lib/heroku/pgutils.rb, line 12
def deprecate_dash_dash_db(name)
  return unless args.include? "--db"
  output_with_bang "The --db option has been deprecated"
  usage = Heroku::Command::Help.usage_for_command(name)
  error "#{usage}"
end
display_info(label, info) click to toggle source
# File lib/heroku/pgutils.rb, line 32
def display_info(label, info)
  display(format("%-12s %s", label, info))
end
spinner(ticks) click to toggle source
# File lib/heroku/pgutils.rb, line 19
def spinner(ticks)
  %w(/ - \\ |)[ticks % 4]
end
ticking() { |ticks| ... } click to toggle source
# File lib/heroku/pgutils.rb, line 23
def ticking
  ticks = 0
  loop do
    yield(ticks)
    ticks +=1
    sleep 1
  end
end
translate_fork_and_follow(addon, config) click to toggle source
# File lib/heroku/pgutils.rb, line 36
def translate_fork_and_follow(addon, config)
  if addon =~ %r^#{PgUtils.addon_name}/
    %w[fork follow].each do |opt|
      if val = config[opt]
        unless val.is_a?(String)
          error("--#{opt} requires a database argument")
        end
        resolved = Resolver.new(val, config_vars)
        display resolved.message if resolved.message
        abort_with_database_list(val) unless resolved[:url]
        config[opt] = resolved[:url]
      end
    end
  end
end