1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[core] Move XML/JSON code up out of core

Rather than embedding XML and JSON support within fog-core, this is the
start of extracting them to exist alongside core.

That will move the responsibility to each provider to declare if they want
XML or JSON services.

Goal being as we move towards a modular fog this allows providers to
require core and either JSON or XML gems and not pick up dependencies
only required by the other.
This commit is contained in:
Paul Thornthwaite 2013-06-14 11:02:30 +01:00
parent e172362b45
commit f6280910f8
5 changed files with 44 additions and 11 deletions

View file

@ -1,4 +1,5 @@
require 'fog/core/json'
require "fog/json"
module Fog
module AWS
module CredentialFetcher
@ -61,4 +62,3 @@ module Fog
end
end
end

View file

@ -19,11 +19,9 @@ require 'fog/core/current_machine'
require 'fog/core/deprecation'
require 'fog/core/errors'
require 'fog/core/hmac'
require 'fog/core/json'
require 'fog/core/logger'
require 'fog/core/model'
require 'fog/core/mock'
require 'fog/core/parser' # FIXME: would be better to only load when nokogiri is required
require 'fog/core/provider'
require 'fog/core/service'
require 'fog/core/ssh'
@ -32,6 +30,11 @@ require 'fog/core/time'
require 'fog/core/timeout'
require 'fog/core/wait_for'
# data exchange specific (to be extracted and used on a per provider basis)
require 'fog/xml'
require 'fog/json'
# service wrappers
require 'fog/compute'
require 'fog/identity'

View file

@ -1,4 +1,4 @@
require 'nokogiri'
require "nokogiri"
module Fog
module Parsers

View file

@ -1,6 +1,18 @@
require 'multi_json'
require "multi_json"
module Fog
# @note Extracting JSON components out of core is a work in progress.
#
# The {JSON} module includes functionality that is common between APIs using
# JSON to send and receive data.
#
# The intent is to provide common code for provider APIs using JSON but not
# require it for those using XML.
#
# @todo Add +require "fog/json" and/or +include Fog::JSON+ to providers using
# its services
#
module JSON
def self.sanitize(data)
@ -28,6 +40,5 @@ module Fog
def self.decode(obj)
MultiJson.decode(obj)
end
end
end

19
lib/fog/xml.rb Normal file
View file

@ -0,0 +1,19 @@
require "nokogiri"
require "fog/core/parser"
module Fog
# @note Extracting XML components out of core is a work in progress.
#
# The {XML} module includes functionality that is common between APIs using
# XML to send and receive data.
#
# The intent is to provide common code for provider APIs using XML but not
# require it for those using JSON.
#
# @todo Add +require "fog/xml"+ and/or +include Fog::XML+ to providers using
# its services
#
module XML
end
end