Module: Vmfusion
- Defined in:
- lib/fog/bin/vmfusion.rb
Overview
deviates from other bin stuff to accomodate gem
Class Method Summary collapse
- .[](service) ⇒ Object
- .available? ⇒ Boolean
- .class_for(key) ⇒ Object
- .collections ⇒ Object
- .services ⇒ Object
Class Method Details
.[](service) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fog/bin/vmfusion.rb', line 12 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 |
.available? ⇒ Boolean
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/fog/bin/vmfusion.rb', line 25 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 |
.class_for(key) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/fog/bin/vmfusion.rb', line 3 def class_for(key) case key when :compute Fog::Compute::Vmfusion else raise ArgumentError, "Unrecognized service: #{key}" end end |
.collections ⇒ Object
50 51 52 |
# File 'lib/fog/bin/vmfusion.rb', line 50 def collections services.map {|service| self[service].collections}.flatten.sort_by {|service| service.to_s} end |