class Oc::Run::Sizes

Public Instance Methods

run() click to toggle source
# File lib/system/run/commands/sizes.rb, line 5
def run
  result = barge.size.all
  if !result.success?
    puts "Error: #{result["error_message"]}".red
  else
    puts "Sizes".yellow
    rows = []

    rows << [
      'ID',
      'Memory',
      'Disk',
      'Cpu',
      'Price (Monthly)',
      'Price (Hourly)',
    ]

    result.sizes.each do |size|
      rows << [
        size.slug,
        size.memory.to_s + " MB",
        size.disk.to_s + " GB",
        size.vcpus,
        "$ " + size.price_monthly.to_s,
        "$ " + size.price_hourly.to_s
      ]
    end
    table = Terminal::Table.new :rows => rows
    puts table
  end
end

Private Instance Methods

barge() click to toggle source
# File lib/system/run/commands/sizes.rb, line 37
def barge
  puts "I'm thinking, please wait..".blue
  Oc::Config.get_barge
end