Sha256: d4d33910860912f678a28c2bdab7ae96e41fe9861cfeca289d935da099ffce5f

Contents?: true

Size: 827 Bytes

Versions: 27

Compression:

Stored size: 827 Bytes

Contents

module Veewee
  module Provider
    module Virtualbox
      module BoxCommand

        def screenshot(filename,options={})
          raise Veewee::Error, "The VM needs to exist before we can take a screenshot" unless self.exists?
          raise Veewee::Error, "The VM needs to be running before we can test a screenshot" unless self.running?
          # If the vm is not powered off, take a screenshot
          if (self.exists? && self.running?)
            ui.info "Saving screenshot of vm #{name} in #{filename}"

            command="#{@vboxcmd} controlvm \"#{name}\" screenshotpng \"#{filename}\""
            shell_exec("#{command}")
            unless File.exists?(filename)
              raise Veewee::Error,"Saving Screenshot #{filename} failed"
            end
          end
        end

      end
    end
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
veewee-0.5.0.alpha4 lib/veewee/provider/virtualbox/box/screenshot.rb
veewee-0.5.0.alpha3 lib/veewee/provider/virtualbox/box/screenshot.rb
veewee-0.5.0.alpha2 lib/veewee/provider/virtualbox/box/screenshot.rb
veewee-0.5.0.alpha1 lib/veewee/provider/virtualbox/box/screenshot.rb
veewee-0.4.5.1 lib/veewee/provider/virtualbox/box/screenshot.rb
veewee-0.4.5 lib/veewee/provider/virtualbox/box/screenshot.rb
veewee-0.4.5.pre1 lib/veewee/provider/virtualbox/box/screenshot.rb
veewee-0.4.4 lib/veewee/provider/virtualbox/box/screenshot.rb
veewee-0.4.3 lib/veewee/provider/virtualbox/box/screenshot.rb
veewee-0.4.2 lib/veewee/provider/virtualbox/box/screenshot.rb
veewee-0.4.1 lib/veewee/provider/virtualbox/box/screenshot.rb
veewee-0.4.0 lib/veewee/provider/virtualbox/box/screenshot.rb
veewee-0.3.12 lib/veewee/provider/virtualbox/box/screenshot.rb
veewee-0.3.11 lib/veewee/provider/virtualbox/box/screenshot.rb
veewee-0.3.10 lib/veewee/provider/virtualbox/box/screenshot.rb
veewee-0.3.9 lib/veewee/provider/virtualbox/box/screenshot.rb
veewee-atlassian-0.3.11 lib/veewee/provider/virtualbox/box/screenshot.rb
veewee-0.3.7 lib/veewee/provider/virtualbox/box/screenshot.rb
veewee-0.3.6 lib/veewee/provider/virtualbox/box/screenshot.rb
veewee-0.3.5 lib/veewee/provider/virtualbox/box/screenshot.rb