diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a92eeee --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +*.gem +*.rbc +.bundle +.config +.yardoc +Gemfile.lock +InstalledFiles +_yardoc +coverage +doc/ +lib/bundler/man +pkg +rdoc +spec/reports +test/tmp +test/version_tmp +tmp +*.bundle +*.so +*.o +*.a +mkmf.log +gemfiles/*.lock \ No newline at end of file diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..9df0b45 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,20 @@ +Metrics/LineLength: + Enabled: false + +Style/EachWithObject: + Enabled: false + +Style/Encoding: + EnforcedStyle: when_needed + +Style/FormatString: + Enabled: false + +Style/HashSyntax: + EnforcedStyle: hash_rockets + +Style/SignalException: + EnforcedStyle: only_raise + +Style/StringLiterals: + EnforcedStyle: double_quotes diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 0000000..7905758 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +fog-vmfusion \ No newline at end of file diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..c346e7a --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.1.4 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..ff5b21a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +matrix: + include: + - rvm: 1.8.7 + gemfile: gemfiles/Gemfile.1.9.2- + - rvm: 1.9.2 + gemfile: gemfiles/Gemfile.1.9.2- + - rvm: 1.9.3 + gemfile: gemfiles/Gemfile.1.9.3+ + - rvm: 2.0.0 + gemfile: gemfiles/Gemfile.1.9.3+ + - rvm: 2.1.4 + gemfile: gemfiles/Gemfile.1.9.3+ + env: COVERAGE=true + - rvm: ree + gemfile: gemfiles/Gemfile.1.9.2- + - rvm: jruby + gemfile: gemfiles/Gemfile.1.9.3+ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..bdb8025 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,18 @@ +## Getting Involved + +New contributors are always welcome, when it doubt please ask questions. We strive to be an open and welcoming community. Please be nice to one another. + +### Coding + +* Pick a task: + * Offer feedback on open [pull requests](https://github.com/fog/fog-vmfusion/pulls). + * Review open [issues](https://github.com/fog/fog-vmfusion/issues) for things to help on. + * [Create an issue](https://github.com/fog/fog-vmfusion/issues/new) to start a discussion on additions or features. +* Fork the project, add your changes and tests to cover them in a topic branch. +* Commit your changes and rebase against `fog/fog-vmfusion` to ensure everything is up to date. +* [Submit a pull request](https://github.com/fog/fog-vmfusion/compare/) + +### Non-Coding + +* Offer feedback on open [issues](https://github.com/fog/fog-vmfusion/issues). +* Organize or volunteer at events. \ No newline at end of file diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 0000000..3a89ff9 --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,9 @@ +* Carlos Sanchez +* Cody Herriges +* James Herdman +* Lance Ivy +* Kyle Rames +* Patrick Debois +* Paul Thornthwaite +* Paulo Henrique Lopes Ribeiro +* Wesley Beary diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..3f49bfe --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +# Specify your gem's dependencies in fog-vmfusion.gemspec +gemspec diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..6236013 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014-2014 [CONTRIBUTORS.md](https://github.com/fog/fog-vmfusion/blob/master/CONTRIBUTORS.md) + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..55aadfc --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +# Fog::Vmfusion + +[![Gem Version](https://badge.fury.io/rb/fog-vmfusion.svg)](http://badge.fury.io/rb/fog-vmfusion) [![Build Status](https://travis-ci.org/fog/fog-vmfusion.svg?branch=master)](https://travis-ci.org/fog/fog-vmfusion) [![Dependency Status](https://gemnasium.com/fog/fog-vmfusion.svg)](https://gemnasium.com/fog/fog-vmfusion) [![Coverage Status](https://img.shields.io/coveralls/fog/fog-vmfusion.svg)](https://coveralls.io/r/fog/fog-vmfusion?branch=master) [![Code Climate](https://codeclimate.com/github/fog/fog-vmfusion.png)](https://codeclimate.com/github/fog/fog-vmfusion) + +Module for the 'fog' gem to support VMWARE Fusion + +## Help Needed + +This gem needs a maintainer. If you want to work on it, please contact +[@geemus](mailto:geemus@gmail.com) or [@plribeiro3000](mailto:plribeiro3000@gmail.com) + +## Installation + +Add this line to your application's Gemfile: + +```ruby +gem 'fog-vmfusion' +``` + +And then execute: + + $ bundle + +Or install it yourself as: + + $ gem install fog-vmfusion + +## Usage + +TODO: Write usage instructions here + +## Contributing + +1. Fork it ( https://github.com/fog/fog-vmfusion/fork ) +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push to the branch (`git push origin my-new-feature`) +5. Create a new Pull Request diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..2eef1eb --- /dev/null +++ b/Rakefile @@ -0,0 +1,11 @@ +require 'bundler/gem_tasks' +require 'rake/testtask' + +Rake::TestTask.new do |t| + t.libs.push %w(spec) + t.test_files = FileList['spec/**/*_spec.rb'] + t.verbose = true +end + +desc 'Default Task' +task :default => :test diff --git a/fog-vmfusion.gemspec b/fog-vmfusion.gemspec new file mode 100644 index 0000000..f22fe1c --- /dev/null +++ b/fog-vmfusion.gemspec @@ -0,0 +1,37 @@ +# coding: utf-8 +lib = File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require 'fog/vmfusion/version' + +Gem::Specification.new do |spec| + spec.name = "fog-vmfusion" + spec.version = Fog::Vmfusion::VERSION + spec.authors = %q(Paulo Henrique Lopes Ribeiro) + spec.email = %q(plribeiro3000@gmail.com) + spec.summary = %q{Module for the 'fog' gem to support VMWARE FUSION.} + spec.description = %q{This library can be used as a module for `fog` or as standalone provider + to use the VMWARE FUSION in applications.} + spec.homepage = "" + spec.license = "MIT" + + files = `git ls-files -z`.split("\x0") + files.delete(".hound.yml") + spec.files = files + + spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } + spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) + spec.require_paths = ["lib"] + + spec.add_dependency "fog-core" + spec.add_dependency "fission" + + spec.add_development_dependency "rake" + spec.add_development_dependency "minitest" + spec.add_development_dependency "turn" + spec.add_development_dependency "pry" + + if RUBY_VERSION.to_f > 1.9 + spec.add_development_dependency "coveralls" + spec.add_development_dependency "rubocop" + end +end diff --git a/gemfiles/Gemfile.1.9.2- b/gemfiles/Gemfile.1.9.2- new file mode 100644 index 0000000..aed015e --- /dev/null +++ b/gemfiles/Gemfile.1.9.2- @@ -0,0 +1,8 @@ +source :rubygems + +gem 'mime-types', '< 2.0' +gem 'nokogiri', '< 1.6' +gem 'rest-client', '~> 1.6.8' +gem 'fog-core' + +gemspec :path => '../' \ No newline at end of file diff --git a/gemfiles/Gemfile.1.9.3+ b/gemfiles/Gemfile.1.9.3+ new file mode 100644 index 0000000..da0ce3e --- /dev/null +++ b/gemfiles/Gemfile.1.9.3+ @@ -0,0 +1,7 @@ +source :rubygems + +gem 'activesupport', '>= 3.0', '< 4' +gem 'mime-types', '< 2.0' +gem 'fog-core' + +gemspec :path => '../' \ No newline at end of file diff --git a/lib/fog/bin/vmfusion.rb b/lib/fog/bin/vmfusion.rb new file mode 100644 index 0000000..68584e9 --- /dev/null +++ b/lib/fog/bin/vmfusion.rb @@ -0,0 +1,58 @@ +module Vmfusion # deviates from other bin stuff to accomodate gem + class << self + def class_for(key) + case key + when :compute + Fog::Compute::Vmfusion + else + raise ArgumentError, "Unrecognized service: #{key}" + end + end + + def [](service) + @@connections ||= Hash.new do |hash, key| + hash[key] = case key + when :compute + Fog::Logger.warning("Vmfusion[:compute] is not recommended, use Compute[:vmfusion] for portability") + Fog::Compute.new(:provider => "Vmfusion") + else + raise ArgumentError, "Unrecognized service: #{key.inspect}" + end + end + @@connections[service] + end + + def available? + begin + availability=true unless Gem::Specification::find_by_name("fission").nil? + rescue Gem::LoadError + availability=false + rescue + availability_gem=Gem.available?("fission") + end + + if availability + for service in services + for collection in self.class_for(service).collections + unless self.respond_to?(collection) + self.class_eval <<-EOS, __FILE__, __LINE__ + def self.#{collection} + self[:#{service}].#{collection} + end + EOS + end + end + end + end + availability + end + + def collections + services.map {|service| self[service].collections}.flatten.sort_by {|service| service.to_s} + end + + def services + Fog::Vmfusion.services + end + end +end diff --git a/lib/fog/compute/vmfusion/server.rb b/lib/fog/compute/vmfusion/server.rb new file mode 100644 index 0000000..3834867 --- /dev/null +++ b/lib/fog/compute/vmfusion/server.rb @@ -0,0 +1,256 @@ +require "fog/compute/models/server" + +module Fog + module Compute + class Vmfusion + class Server < Fog::Compute::Server + identity :name + + attribute :ipaddress + attribute :power_state + attribute :mac_addresses + attribute :path + + attr_accessor :password + + # There is currently no documented model of creating VMs from scratch + # sans Fusion's wizard. + def save + raise Fog::Errors::Error.new("Creating a new vm is not yet supported") + end + + # Fussion doesn't have the concept of templates so one just clones + # regular VMs. + def clone(name) + requires :raw + + ::Fission::VM.clone(@raw[:fission].name,name) + return service.servers.get(name) + end + + # Destroy, deletes the VM from the local disk but only hard stops the VM + # before doing so if you set :force to true. + def destroy(options = { :force => false }) + requires :raw + + if ready? + if options[:force] + stop + end + end + + @raw[:fission].delete + end + + # Start is pretty self explanatory...if you pass :headless as true you + # won't get a console on launch. + def start(options = { :headless => false }) + requires :raw + + unless ready? + @raw[:fission].start(:headless => options[:headless]) + return true + else + return false + end + end + + # We're covering a lot of bases here with the different ways one can + # stop a VM from running. + + # Stop is a hard stop, like pulling out the power cord. + def stop + requires :raw + + if ready? + @raw[:fission].stop(:hard => true) + return true + else + return false + end + end + + # Halt and poweroff are just synonyms for stop. + def halt + stop + end + + def poweroff + stop + end + + # This is a graceful shutdown but Fusion is only capable of a graceful + # shutdown if tools are installed. Fusion does the right thing though + # and if graceful can't be initiated it just does a hard stop. + def shutdown + requires :raw + if ready? + @raw[:fission].stop + return true + else + return false + end + end + + # Attempt a graceful shutdown, wait for the VM to completely shutdown + # and then start it again. + def reboot + if ready? + shutdown + wait_for { ! ready? } + start + return true + else + return false + end + end + + # Resuming from suspend is the same thing as start to Fusion. + def resume + start + end + + def suspend + requires :raw + if ready? + @raw[:fission].suspend + return true + else + return false + end + end + + # Fusion VM Metadata. + + # The power state of the VM is commonly going to be three values; + # running, not running, or suspended. + def power_state + requires :raw + @raw[:fission].state.data + end + + def ready? + requires :raw + @raw[:fission].running?.data + end + + # Path to the VM's vmx file on the local disk. + def path + requires :raw + @raw[:fission].path + end + + # We obtain the first ipaddress. This should generally be a safe + # assumption for Fusion. Even if an address is provided via NAT, + # bridge, or host only it will by accessible from the host machine the + # VM resides on. + def ipaddress + requires :raw + ip(@raw[:fission]) + end + + # Keeping these three methods around for API compatibility reasons. + # Makes the vmfusion provider function similar to cloud providers and + # the vsphere provider. Future goal is to add an actual private and + # public concept. Needs changes to fission and a determination what is + # a public or private address here; bridge, nat, host-only. + def public_ip_address + ipaddress + end + + def private_ip_address + ipaddress + end + + def state + power_state + end + + # Collecting all mac_addresses the VM has...mostly just because we are + # doing the same thing for the vSphere provider. + def mac_addresses + requires :raw + macs(@raw[:fission]) + end + + # Sets up a convenient way to SSH into a Fusion VM using credentials + # stored in your .fog file. + + # Simply spawn an SSH session. + def ssh(commands) + super(commands, password ? {:password => password} : {}) + end + + # SCP something to our VM. + def scp(local_path, remote_path, upload_options = {}) + requires :ssh_ip_address, :username + + scp_options = {} + scp_options[:password] = password unless self.password.nil? + scp_options[:key_data] = [private_key] if self.private_key + + Fog::SCP.new(ssh_ip_address, username, scp_options).upload(local_path, remote_path, upload_options) + end + + # Sets up a new SSH key on the VM so one doesn't need to use a password + # ever again. + def setup(credentials = {}) + requires :public_key, :ssh_ip_address, :username + + credentials[:password] = password unless self.password.nil? + credentails[:key_data] = [private_key] if self.private_key + + commands = [ + %{mkdir .ssh}, + ] + if public_key + commands << %{echo "#{public_key}" >> ~/.ssh/authorized_keys} + end + + # wait for domain to be ready + Timeout::timeout(360) do + begin + Timeout::timeout(8) do + Fog::SSH.new(ssh_ip_address, username, credentials.merge(:timeout => 4)).run("pwd") + end + rescue Errno::ECONNREFUSED + sleep(2) + retry + rescue Net::SSH::AuthenticationFailed, Timeout::Error + retry + end + end + Fog::SSH.new(ssh_ip_address, username, credentials).run(commands) + end + + private + def ip(fission) + first_int = fission.network_info.data.keys.first + fission.network_info.data[first_int]["ip_address"] + end + + def macs(fission) + fission.mac_addresses.data + end + + def raw + @raw + end + + def raw=(new_raw) + @raw = new_raw + + raw_attributes = { + :name => new_raw[:fission].name, + :power_state => new_raw[:state], + :ipaddress => ip(new_raw[:fission]), + :mac_addresses => macs(new_raw[:fission]), + :path => new_raw[:fission].path + } + + merge_attributes(raw_attributes) + end + end + end + end +end diff --git a/lib/fog/compute/vmfusion/servers.rb b/lib/fog/compute/vmfusion/servers.rb new file mode 100644 index 0000000..e6c2c05 --- /dev/null +++ b/lib/fog/compute/vmfusion/servers.rb @@ -0,0 +1,33 @@ +module Fog + module Compute + class Vmfusion + class Servers < Fog::Collection + model Fog::Compute::Vmfusion::Server + + def all(filter = nil) + data = [] + + states = ::Fission::VM.all_with_status.data + + filter = {} if filter.nil? + unless filter.key?(:name) + vms=::Fission::VM.all.data + vms.each do |vm| + data << { :raw => { :fission => vm, + :state => states[vm.name] } } + end + else + data << { :raw => { :fission => ::Fission::VM.new(filter[:name]), + :state => states[filter[:name]] } } + end + + load(data) + end + + def get(name) + self.all(:name => name).first + end + end + end + end +end diff --git a/lib/fog/compute/vmfusion.rb b/lib/fog/compute/vmfusion.rb new file mode 100644 index 0000000..0d65d0f --- /dev/null +++ b/lib/fog/compute/vmfusion.rb @@ -0,0 +1,28 @@ +module Fog + module Compute + class Vmfusion < Fog::Service + autoload :Server, File.expand_path("../vmfusion/server", __FILE__) + autoload :Servers, File.expand_path("../vmfusion/servers", __FILE__) + + model_path "fog/compute/vmfusion" + + model :server + collection :servers + + class Mock + def initialize(_options = {}) + Fog::Mock.not_implemented + end + end + + class Real + def initialize(_options = {}) + require "fission" + rescue LoadError => e + retry if require("rubygems") + raise e.message + end + end + end + end +end diff --git a/lib/fog/vmfusion/version.rb b/lib/fog/vmfusion/version.rb new file mode 100644 index 0000000..7f3c78a --- /dev/null +++ b/lib/fog/vmfusion/version.rb @@ -0,0 +1,5 @@ +module Fog + module Vmfusion + VERSION = "0.1.0" + end +end diff --git a/lib/fog/vmfusion.rb b/lib/fog/vmfusion.rb new file mode 100644 index 0000000..697637f --- /dev/null +++ b/lib/fog/vmfusion.rb @@ -0,0 +1,14 @@ +require "fog/core" +require File.expand_path("../vmfusion/version", __FILE__) + +module Fog + module Vmfusion + extend Fog::Provider + + service(:compute, "Compute") + end + + module Compute + autoload :Vmfusion, File.expand_path("../compute/vmfusion", __FILE__) + end +end diff --git a/metadata.yml b/metadata.yml new file mode 100644 index 0000000..33aa279 --- /dev/null +++ b/metadata.yml @@ -0,0 +1,179 @@ +--- !ruby/object:Gem::Specification +name: fog-vmfusion +version: !ruby/object:Gem::Version + version: 0.1.0 +platform: ruby +authors: +- Paulo Henrique Lopes Ribeiro +autorequire: +bindir: bin +cert_chain: [] +date: 2015-04-04 00:00:00.000000000 Z +dependencies: +- !ruby/object:Gem::Dependency + name: fog-core + requirement: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' + type: :runtime + prerelease: false + version_requirements: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' +- !ruby/object:Gem::Dependency + name: fission + requirement: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' + type: :runtime + prerelease: false + version_requirements: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' +- !ruby/object:Gem::Dependency + name: rake + requirement: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' + type: :development + prerelease: false + version_requirements: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' +- !ruby/object:Gem::Dependency + name: minitest + requirement: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' + type: :development + prerelease: false + version_requirements: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' +- !ruby/object:Gem::Dependency + name: turn + requirement: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' + type: :development + prerelease: false + version_requirements: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' +- !ruby/object:Gem::Dependency + name: pry + requirement: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' + type: :development + prerelease: false + version_requirements: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' +- !ruby/object:Gem::Dependency + name: coveralls + requirement: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' + type: :development + prerelease: false + version_requirements: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' +- !ruby/object:Gem::Dependency + name: rubocop + requirement: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' + type: :development + prerelease: false + version_requirements: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' +description: |- + This library can be used as a module for `fog` or as standalone provider + to use the VMWARE FUSION in applications. +email: plribeiro3000@gmail.com +executables: [] +extensions: [] +extra_rdoc_files: [] +files: +- ".gitignore" +- ".rubocop.yml" +- ".ruby-gemset" +- ".ruby-version" +- ".travis.yml" +- CONTRIBUTING.md +- CONTRIBUTORS.md +- Gemfile +- LICENSE.md +- README.md +- Rakefile +- fog-vmfusion.gemspec +- gemfiles/Gemfile.1.9.2- +- gemfiles/Gemfile.1.9.3+ +- lib/fog/bin/vmfusion.rb +- lib/fog/compute/vmfusion.rb +- lib/fog/compute/vmfusion/server.rb +- lib/fog/compute/vmfusion/servers.rb +- lib/fog/vmfusion.rb +- lib/fog/vmfusion/version.rb +- spec/minitest_helper.rb +homepage: '' +licenses: +- MIT +metadata: {} +post_install_message: +rdoc_options: [] +require_paths: +- lib +required_ruby_version: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' +required_rubygems_version: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' +requirements: [] +rubyforge_project: +rubygems_version: 2.4.2 +signing_key: +specification_version: 4 +summary: Module for the 'fog' gem to support VMWARE FUSION. +test_files: +- spec/minitest_helper.rb diff --git a/spec/minitest_helper.rb b/spec/minitest_helper.rb new file mode 100644 index 0000000..2d02b80 --- /dev/null +++ b/spec/minitest_helper.rb @@ -0,0 +1,31 @@ +require 'minitest/spec' +require 'minitest/autorun' +require 'turn' + +Turn.config do |c| + # use one of output formats: + # :outline - turn's original case/test outline mode [default] + # :progress - indicates progress with progress bar + # :dotted - test/unit's traditional dot-progress mode + # :pretty - new pretty reporter + # :marshal - dump output as YAML (normal run mode only) + # :cue - interactive testing + # c.format = :outline + # turn on invoke/execute tracing, enable full backtrace + c.trace = 20 + # use humanized test names (works only with :outline format) + c.natural = true +end + +if ENV['COVERAGE'] + require 'coveralls' + require 'simplecov' + + SimpleCov.start do + add_filter '/spec/' + end +end + +require File.join(File.dirname(__FILE__), '../lib/fog/vmfusion.rb') + +Coveralls.wear! if ENV['COVERAGE']