diff --git a/README.md b/README.md index e6a54eb..21cc9bf 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,16 @@ vmfloaty ======== + +A CLI helper tool for Puppet Labs vmpooler to help you stay afloat. + +## Install + +``` +gem install vmfloaty +``` + +## Usage + +``` +TODO +``` diff --git a/bin/floaty b/bin/floaty index 795638b..5c5a3f6 100755 --- a/bin/floaty +++ b/bin/floaty @@ -1,4 +1,6 @@ #!/usr/bin/env ruby $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__)) -require 'vmfloaty/cli' +require 'vmfloaty' + +Vmfloaty.new(ENV).start diff --git a/lib/vmfloaty.rb b/lib/vmfloaty.rb index 2db041a..3f67104 100644 --- a/lib/vmfloaty.rb +++ b/lib/vmfloaty.rb @@ -1 +1,16 @@ require 'vmfloaty/cli' + +class Vmfloaty + + def initialize(env) + @vmpooler_url = env['VMPOOLER_URL'] + + unless @vmpooler_url + @vmpooler_url = 'http://vcloud.delivery.puppetlabs.net/vm' + end + end + + def start + CLI.start(ARGV) + end +end diff --git a/lib/vmfloaty/cli.rb b/lib/vmfloaty/cli.rb index 52b4497..018af2e 100644 --- a/lib/vmfloaty/cli.rb +++ b/lib/vmfloaty/cli.rb @@ -1,25 +1,35 @@ require 'thor' +require 'net/http' class CLI < Thor - desc "get", "Gets a vm" - def get - say 'Get a vm here' + desc "get [operating system,...] [--withpe]", "Gets a VM" + option :withpe + def get(os) + say "vmpooler: #{@vmpooler_url}" + if options[:withpe] + say "Get a #{os} VM here and provision with PE verison #{options[:withpe]}" + else + say "Get a #{os} VM here" + end end - desc "modify", "Modify a vm" - def modify + desc "modify [hostname]", "Modify a VM" + def modify(hostname) say 'Modify a vm' end - desc "list", "List all active vms" - def list - say 'Listing your vms' + desc "status", "List status of all active VMs" + def status + say 'List of active VMs' end - desc "release", "Schedules a vm for deletion" - def release - say 'Releases a vm' + desc "list", "List all open VMs" + def list + say 'Listing open vms on vmpooler' + end + + desc "release [hostname]", "Schedules a VM for deletion" + def release(hostname) + say 'Releases a VM' end end - -CLI.start(ARGV)