Sha256: 0f2084f9299cc6563f7873ea804b5cb853ffaa5eff82462126747c499dad465f

Contents?: true

Size: 896 Bytes

Versions: 1

Compression:

Stored size: 896 Bytes

Contents

namespace :vps do
  task(:default) { list }
  import_pack(:connect, self, "VPS")
  
  desc <<-DESC
    Display a list of all your VPS's.
  DESC
  task :list do
    puts_title "All VPS's"
    puts_list VPS.all do |t|
      t.col("Hostname", :hostname)
      t.col("Memory capacity") { |s| "#{s.memory_capacity} MB" }
      t.col("Disk capacity") { |s| "#{s.disk_capacity} GB" }
      t.col("Status") { |s| s.status.to_s.capitalize }
    end
  end
  
  desc <<-DESC
    Display a list of hostsnames of all your VPS's. Useful for refering to
    these programmatically.
  DESC
  task :hostnames do
    VPS.all.each { |vps| puts vps.hostname }
  end
  
  desc <<-DESC
    List all users (UNIX accounts) that have a home folder.
  DESC
  task :users do
    ENV['CMD'] = "ls /home | grep -v ^_"
    run
  end
  
  def fetch_current
    (id = ENV["ID"] || ENV["ON"]) ? VPS.find(id) : VPS.last
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
Flucti-flucti-cli-0.1.16 lib/flucti/tasks/vps_tasks.rb