Commit c68a488a authored by Praveen Arimbrathodiyil's avatar Praveen Arimbrathodiyil
Browse files

Imported Upstream version 1.40.0

parent ced1259c
* Aaron Patterson <aaron.patterson@gmail.com>
* Akira Matsuda <ronnie@dio.jp>
* Alexandru Calinoiu <calinoiu.alexandru@agilefreaks.com>
* Anatol <anatol.pomozov@gmail.com>
* Artem <temikus@google.com>
* Artem Yakimenko <temikus@google.com>
......@@ -10,6 +11,9 @@
* Dominic Cleal <dcleal@redhat.com>
* Evan Light <evan@tripledogdare.net>
* Frederick Cheung <frederick.cheung@gmail.com>
* Gilles Dubreuil <gilles@redhat.com>
* Griffin Smith <wildgriffin45@gmail.com>
* Harry Maclean <harryjmaclean@googlemail.com>
* Isaac Hollander McCreery <ihmccreery@google.com>
* Jake Bell <jake@theunraveler.com>
* Josh Kalderimis <josh.kalderimis@gmail.com>
......@@ -37,4 +41,5 @@
* mountkin <moutkin@gmail.com>
* ozroc <ozrocpablo@gmail.com>
* schneems <richard.schneeman@gmail.com>
* starbelly <starbelly@pobox.com>
\ No newline at end of file
* starbelly <starbelly@pobox.com>
* zhitongLBN <z.liu@linkbynet.com>
\ No newline at end of file
The MIT License (MIT)
Copyright (c) 2014 [CONTRIBUTORS.md](https://github.com/fog/fog/blob/master/CONTRIBUTORS.md)
Copyright (c) 2014-2016 [CONTRIBUTORS.md](https://github.com/fog/fog/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
......
1.40.0 05/19/2016
==========================================================
add minitest helpers for schema (parity to shindo)
1.39.0 05/11/2016
==========================================================
cleanup warnings
add NFV module
only dup frozen strings
1.38.0 04/20/2016
==========================================================
more specific service not found error
fix string freeze issue for ruby 2.3
bump excon dep
1.37.0 03/31/2016
==========================================================
......
......@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]
spec.add_dependency("builder")
spec.add_dependency("excon", "~> 0.45")
spec.add_dependency("excon", "~> 0.49")
spec.add_dependency("formatador", "~> 0.2")
spec.add_development_dependency("coveralls")
......
......@@ -64,6 +64,7 @@ require File.expand_path('../image', __FILE__)
require File.expand_path('../introspection', __FILE__)
require File.expand_path('../metering', __FILE__)
require File.expand_path('../monitoring', __FILE__)
require File.expand_path('../nfv', __FILE__)
require File.expand_path('../network', __FILE__)
require File.expand_path('../orchestration', __FILE__)
require File.expand_path('../storage', __FILE__)
......
......@@ -15,7 +15,7 @@ module Fog
spc = service_provider_constant(service_name, provider_name)
spc.new(attributes)
rescue LoadError, NameError # Only rescue errors in finding the libraries, allow connection errors through to the caller
raise ArgumentError, "#{provider} has no #{service_name.downcase} service"
raise Fog::Service::NotFound, "#{provider} has no #{service_name.downcase} service"
end
def providers
......
module Fog
module StringifyKeys
# Returns a new hash with all keys converted to strings.
def self.stringify(hash)
transform_hash(hash) do |hash, key, value|
def self.stringify(original_hash)
transform_hash(original_hash) do |hash, key, value|
hash[key.to_s] = value
end
end
......
module Fog
module Core
VERSION = "1.37.0"
VERSION = "1.40.0"
end
end
......@@ -4,7 +4,7 @@ module Fog
def self.new(orig_attributes)
attributes = orig_attributes.dup # prevent delete from having side effects
case provider = attributes.delete(:provider).to_s.downcase.to_sym
case attributes.delete(:provider).to_s.downcase.to_sym
when :stormondemand
require "fog/dns/storm_on_demand"
Fog::DNS::StormOnDemand.new(attributes)
......
module Fog
module NFV
extend Fog::ServicesMixin
end
end
......@@ -16,7 +16,7 @@ module Fog
end
attributes = orig_attributes.dup # prevent delete from having side effects
case provider = attributes.delete(:provider).to_s.downcase.to_sym
case attributes.delete(:provider).to_s.downcase.to_sym
when :internetarchive
require "fog/internet_archive/storage"
Fog::Storage::InternetArchive.new(attributes)
......@@ -42,7 +42,8 @@ module Fog
def self.get_body_size(body)
if body.respond_to?(:encoding)
original_encoding = body.encoding
body.force_encoding('BINARY')
body = body.dup if body.frozen?
body = body.force_encoding('BINARY')
end
size = if body.respond_to?(:bytesize)
......
......@@ -6,6 +6,7 @@ require "fog/test_helpers/formats_helper"
require "fog/test_helpers/mock_helper"
require "fog/test_helpers/model_helper"
require "fog/test_helpers/responds_to_helper"
require "fog/test_helpers/types_helper"
require "fog/test_helpers/succeeds_helper"
require "fog/test_helpers/compute/flavors_helper"
require "fog/test_helpers/compute/server_helper"
......
require "fog/schema/data_validator"
# format related hackery
# allows both true.is_a?(Fog::Boolean) and false.is_a?(Fog::Boolean)
# allows both nil.is_a?(Fog::Nullable::String) and "".is_a?(Fog::Nullable::String)
module Fog
module Boolean; end
module Nullable
module Boolean; end
module Integer; end
module String; end
module Time; end
module Float; end
module Hash; end
module Array; end
end
end
[FalseClass, TrueClass].each { |klass| klass.send(:include, Fog::Boolean) }
[FalseClass, TrueClass, NilClass, Fog::Boolean].each { |klass| klass.send(:include, Fog::Nullable::Boolean) }
[NilClass, String].each { |klass| klass.send(:include, Fog::Nullable::String) }
[NilClass, Time].each { |klass| klass.send(:include, Fog::Nullable::Time) }
[Integer, NilClass].each { |klass| klass.send(:include, Fog::Nullable::Integer) }
[Float, NilClass].each { |klass| klass.send(:include, Fog::Nullable::Float) }
[Hash, NilClass].each { |klass| klass.send(:include, Fog::Nullable::Hash) }
[Array, NilClass].each { |klass| klass.send(:include, Fog::Nullable::Array) }
module Shindo
class Tests
# Generates a Shindo test that compares a hash schema to the result
......
require "fog/schema/data_validator"
module MiniTest::Assertions
# Compares a hash's structure against a reference schema hash and returns true
# when they match. Fog::Schema::Datavalidator is used for the validation.
def assert_match_schema(actual, schema, message = nil, options = {})
validator = Fog::Schema::DataValidator.new
message = "expected:\n #{actual}\nto be equivalent of:\n#{schema}"
assert(validator.validate(actual, schema, options), message)
end
end
module MiniTest::Expectations
infect_an_assertion :assert_match_schema, :must_match_schema, :reverse
end
# Format related hackery
# allows both true.is_a?(Fog::Boolean) and false.is_a?(Fog::Boolean)
# allows both nil.is_a?(Fog::Nullable::String) and ''.is_a?(Fog::Nullable::String)
module Fog
module Boolean; end
module Nullable
module Boolean; end
module Integer; end
module String; end
module Time; end
module Float; end
module Hash; end
module Array; end
end
end
[FalseClass, TrueClass].each {|klass| klass.send(:include, Fog::Boolean)}
[FalseClass, TrueClass, NilClass, Fog::Boolean].each {|klass| klass.send(:include, Fog::Nullable::Boolean)}
[NilClass, String].each {|klass| klass.send(:include, Fog::Nullable::String)}
[NilClass, Time].each {|klass| klass.send(:include, Fog::Nullable::Time)}
[Integer, NilClass].each {|klass| klass.send(:include, Fog::Nullable::Integer)}
[Float, NilClass].each {|klass| klass.send(:include, Fog::Nullable::Float)}
[Hash, NilClass].each {|klass| klass.send(:include, Fog::Nullable::Hash)}
[Array, NilClass].each {|klass| klass.send(:include, Fog::Nullable::Array)}
......@@ -67,6 +67,7 @@ describe "Fog::Storage" do
module Storage
class BothWays
attr_reader :args
def initialize(args)
@args = args
end
......@@ -105,5 +106,14 @@ describe "Fog::Storage" do
skip
end
end
it "respects frozen strings" do
if RUBY_VERSION >= "2.3.0"
body = "foo".freeze
Fog::Storage.get_body_size(body)
else
skip
end
end
end
end
end
\ No newline at end of file
require "spec_helper"
require "fog/test_helpers/formats_helper"
require "fog/test_helpers/types_helper"
module Shindo
class Tests
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment