diff --git a/lib/fog.rb b/lib/fog.rb index f87ab99e8..335c795bf 100644 --- a/lib/fog.rb +++ b/lib/fog.rb @@ -10,7 +10,6 @@ require 'fog/core' # data exchange specific (to be extracted and used on a per provider basis) require 'fog/xml' require 'fog/json' -require 'fog/core/parser' # deprecation wrappers (XML wrapped version) require 'fog/core/deprecated/connection' diff --git a/lib/fog/aws/auto_scaling.rb b/lib/fog/aws/auto_scaling.rb index 0acf2479d..75cda1646 100644 --- a/lib/fog/aws/auto_scaling.rb +++ b/lib/fog/aws/auto_scaling.rb @@ -86,8 +86,6 @@ module Fog # * AutoScaling object with connection to AWS. def initialize(options={}) - require 'fog/core/parser' - @use_iam_profile = options[:use_iam_profile] @connection_options = options[:connection_options] || {} diff --git a/lib/fog/aws/beanstalk.rb b/lib/fog/aws/beanstalk.rb index 371d7b52a..144677a2e 100644 --- a/lib/fog/aws/beanstalk.rb +++ b/lib/fog/aws/beanstalk.rb @@ -64,7 +64,6 @@ module Fog class Real include Fog::AWS::CredentialFetcher::ConnectionMethods def initialize(options={}) - require 'fog/core/parser' @use_iam_profile = options[:use_iam_profile] diff --git a/lib/fog/aws/cdn.rb b/lib/fog/aws/cdn.rb index dd9c6207b..68106a004 100644 --- a/lib/fog/aws/cdn.rb +++ b/lib/fog/aws/cdn.rb @@ -142,7 +142,6 @@ EOF # ==== Returns # * cdn object with connection to aws. def initialize(options={}) - require 'fog/core/parser' @use_iam_profile = options[:use_iam_profile] setup_credentials(options) diff --git a/lib/fog/aws/cloud_formation.rb b/lib/fog/aws/cloud_formation.rb index 487b680c2..55b54c299 100644 --- a/lib/fog/aws/cloud_formation.rb +++ b/lib/fog/aws/cloud_formation.rb @@ -46,7 +46,6 @@ module Fog # ==== Returns # * CloudFormation object with connection to AWS. def initialize(options={}) - require 'fog/core/parser' @use_iam_profile = options[:use_iam_profile] diff --git a/lib/fog/aws/compute.rb b/lib/fog/aws/compute.rb index 74eadb1e2..a382fde7c 100644 --- a/lib/fog/aws/compute.rb +++ b/lib/fog/aws/compute.rb @@ -449,7 +449,6 @@ module Fog attr_accessor :region def initialize(options={}) - require 'fog/core/parser' @connection_options = options[:connection_options] || {} @region = options[:region] ||= 'us-east-1' diff --git a/lib/fog/aws/dns.rb b/lib/fog/aws/dns.rb index bc25ff458..0b653b613 100644 --- a/lib/fog/aws/dns.rb +++ b/lib/fog/aws/dns.rb @@ -90,7 +90,6 @@ module Fog # ==== Returns # * dns object with connection to aws. def initialize(options={}) - require 'fog/core/parser' @use_iam_profile = options[:use_iam_profile] setup_credentials(options) diff --git a/lib/fog/aws/elb.rb b/lib/fog/aws/elb.rb index 63f19f411..c46e4b07e 100644 --- a/lib/fog/aws/elb.rb +++ b/lib/fog/aws/elb.rb @@ -131,7 +131,6 @@ module Fog # ==== Returns # * ELB object with connection to AWS. def initialize(options={}) - require 'fog/core/parser' @use_iam_profile = options[:use_iam_profile] @connection_options = options[:connection_options] || {} diff --git a/lib/fog/aws/iam.rb b/lib/fog/aws/iam.rb index 84a0fdfcd..ea7370273 100644 --- a/lib/fog/aws/iam.rb +++ b/lib/fog/aws/iam.rb @@ -173,7 +173,6 @@ module Fog # ==== Returns # * IAM object with connection to AWS. def initialize(options={}) - require 'fog/core/parser' @use_iam_profile = options[:use_iam_profile] @connection_options = options[:connection_options] || {} diff --git a/lib/fog/aws/ses.rb b/lib/fog/aws/ses.rb index 22c4994f0..7fd34f27f 100644 --- a/lib/fog/aws/ses.rb +++ b/lib/fog/aws/ses.rb @@ -48,7 +48,6 @@ module Fog # ==== Returns # * SES object with connection to AWS. def initialize(options={}) - require 'fog/core/parser' @use_iam_profile = options[:use_iam_profile] setup_credentials(options) diff --git a/lib/fog/aws/simpledb.rb b/lib/fog/aws/simpledb.rb index 9054ae9ee..fa13597dd 100644 --- a/lib/fog/aws/simpledb.rb +++ b/lib/fog/aws/simpledb.rb @@ -70,7 +70,6 @@ module Fog # ==== Returns # * SimpleDB object with connection to aws. def initialize(options={}) - require 'fog/core/parser' @use_iam_profile = options[:use_iam_profile] setup_credentials(options) diff --git a/lib/fog/aws/storage.rb b/lib/fog/aws/storage.rb index d9c22aee6..c37f3b5b2 100644 --- a/lib/fog/aws/storage.rb +++ b/lib/fog/aws/storage.rb @@ -415,7 +415,6 @@ module Fog # ==== Returns # * S3 object with connection to aws. def initialize(options={}) - require 'fog/core/parser' @use_iam_profile = options[:use_iam_profile] @instrumentor = options[:instrumentor] diff --git a/lib/fog/aws/sts.rb b/lib/fog/aws/sts.rb index b16ef3502..c5c0b8ca7 100644 --- a/lib/fog/aws/sts.rb +++ b/lib/fog/aws/sts.rb @@ -72,7 +72,6 @@ module Fog # ==== Returns # * STS object with connection to AWS. def initialize(options={}) - require 'fog/core/parser' @use_iam_profile = options[:use_iam_profile] setup_credentials(options) diff --git a/lib/fog/bare_metal_cloud/compute.rb b/lib/fog/bare_metal_cloud/compute.rb index d504196c6..327478450 100644 --- a/lib/fog/bare_metal_cloud/compute.rb +++ b/lib/fog/bare_metal_cloud/compute.rb @@ -45,7 +45,6 @@ module Fog class Real def initialize(options={}) - require 'fog/core/parser' @bare_metal_cloud_password = options[:bare_metal_cloud_password] @bare_metal_cloud_username = options[:bare_metal_cloud_username] diff --git a/lib/fog/core/parser.rb b/lib/fog/core/parser.rb index daf04403a..7e1c9d369 100644 --- a/lib/fog/core/parser.rb +++ b/lib/fog/core/parser.rb @@ -1,112 +1,2 @@ -require "nokogiri" - -module Fog - module Parsers - class Base < Nokogiri::XML::SAX::Document - attr_reader :response - - def initialize - reset - end - - def attr_value(name, attrs) - (entry = attrs.find {|a, v| a == name }) && entry.last - end - - def reset - @response = {} - end - - def characters(string) - @value ||= '' - @value << string - end - - # ############################################################################### - # This is a workaround. Original implementation from Nokogiri is overwritten with - # one that does not join namespace prefix with local name. - def start_element_namespace name, attrs = [], prefix = nil, uri = nil, ns = [] - start_element name, attrs - end - - def end_element_namespace name, prefix = nil, uri = nil - end_element name - end - - # ############################################################################### - - def start_element(name, attrs = []) - @value = nil - end - - def value - @value && @value.dup - end - end - end -end - -module Fog - class ToHashDocument < Nokogiri::XML::SAX::Document - def initialize - @stack = [] - end - - def characters(string) - @value ||= '' - @value << string.strip - end - - def end_element(name) - last = @stack.pop - if last.empty? && @value.empty? - @stack.last[name.to_sym] = '' - elsif last == {:i_nil=>"true"} - @stack.last[name.to_sym] = nil - elsif !@value.empty? - @stack.last[name.to_sym] = @value - end - @value = '' - end - - def body - @stack.first - end - - def response - body - end - - def start_element(name, attributes = []) - @value = '' - parsed_attributes = {} - until attributes.empty? - if attributes.first.is_a?(Array) - key, value = attributes.shift - else - key, value = attributes.shift, attributes.shift - end - parsed_attributes[key.gsub(':','_').to_sym] = value - end - if @stack.last.is_a?(Array) - @stack.last << {name.to_sym => parsed_attributes} - else - data = if @stack.empty? - @stack.push(parsed_attributes) - parsed_attributes - elsif @stack.last[name.to_sym] - unless @stack.last[name.to_sym].is_a?(Array) - @stack.last[name.to_sym] = [@stack.last[name.to_sym]] - end - @stack.last[name.to_sym] << parsed_attributes - @stack.last[name.to_sym].last - else - @stack.last[name.to_sym] = {} - @stack.last[name.to_sym].merge!(parsed_attributes) - @stack.last[name.to_sym] - end - @stack.push(data) - end - end - end -end +Fog::Logger.deprecation("fog/core/parser is deprecated use fog/xml instead [light_black](#{caller.first})[/]") +require 'fog/xml' \ No newline at end of file diff --git a/lib/fog/dnsmadeeasy/dns.rb b/lib/fog/dnsmadeeasy/dns.rb index 199e18841..78b421f11 100644 --- a/lib/fog/dnsmadeeasy/dns.rb +++ b/lib/fog/dnsmadeeasy/dns.rb @@ -76,7 +76,6 @@ module Fog # ==== Returns # * dns object with connection to aws. def initialize(options={}) - require 'fog/core/parser' @dnsmadeeasy_api_key = options[:dnsmadeeasy_api_key] @dnsmadeeasy_secret_key = options[:dnsmadeeasy_secret_key] diff --git a/lib/fog/dynect/core.rb b/lib/fog/dynect/core.rb index 796d9084d..8a3ba55d4 100644 --- a/lib/fog/dynect/core.rb +++ b/lib/fog/dynect/core.rb @@ -2,7 +2,6 @@ require 'nokogiri' require 'fog/core' require 'fog/xml' -require 'fog/core/parser' module Fog module Dynect diff --git a/lib/fog/ecloud/compute.rb b/lib/fog/ecloud/compute.rb index 6cf51694d..ad2c8cd29 100644 --- a/lib/fog/ecloud/compute.rb +++ b/lib/fog/ecloud/compute.rb @@ -284,7 +284,6 @@ module Fog end def initialize(options = {}) - require 'fog/core/parser' @base_path = options[:base_path] || '/cloudapi/ecloud' @connections = {} @connection_options = options[:connection_options] || {} diff --git a/lib/fog/ecloud/core.rb b/lib/fog/ecloud/core.rb index a1b5468d8..08dc2765a 100644 --- a/lib/fog/ecloud/core.rb +++ b/lib/fog/ecloud/core.rb @@ -1,5 +1,5 @@ require 'fog/core' - +require 'fog/xml' module Fog module Ecloud ECLOUD_OPTIONS = [:ecloud_authentication_method] diff --git a/lib/fog/google/storage.rb b/lib/fog/google/storage.rb index 94cc7f0a0..bba769d1f 100644 --- a/lib/fog/google/storage.rb +++ b/lib/fog/google/storage.rb @@ -211,7 +211,6 @@ module Fog # ==== Returns # * Storage object with connection to google. def initialize(options={}) - require 'fog/core/parser' @google_storage_access_key_id = options[:google_storage_access_key_id] @google_storage_secret_access_key = options[:google_storage_secret_access_key] diff --git a/lib/fog/internet_archive/storage.rb b/lib/fog/internet_archive/storage.rb index dffd8d54f..dc3604982 100644 --- a/lib/fog/internet_archive/storage.rb +++ b/lib/fog/internet_archive/storage.rb @@ -240,7 +240,6 @@ module Fog # ==== Returns # * S3 object with connection to aws. def initialize(options={}) - require 'fog/core/parser' setup_credentials(options) @connection_options = options[:connection_options] || {} diff --git a/lib/fog/vcloud/compute.rb b/lib/fog/vcloud/compute.rb index 95b0d81b5..030e5dae7 100644 --- a/lib/fog/vcloud/compute.rb +++ b/lib/fog/vcloud/compute.rb @@ -179,7 +179,6 @@ module Fog def initialize(options = {}) require 'builder' - require 'fog/core/parser' @connections = {} @connection_options = options[:connection_options] || {} diff --git a/lib/fog/vcloud/core.rb b/lib/fog/vcloud/core.rb index 7722fd286..6d4e9c557 100644 --- a/lib/fog/vcloud/core.rb +++ b/lib/fog/vcloud/core.rb @@ -1,4 +1,5 @@ require 'fog/core' +require 'fog/xml' module Fog module Vcloud diff --git a/lib/fog/zerigo/dns.rb b/lib/fog/zerigo/dns.rb index 9ce50ae97..db8da4ddf 100644 --- a/lib/fog/zerigo/dns.rb +++ b/lib/fog/zerigo/dns.rb @@ -67,7 +67,6 @@ module Fog class Real def initialize(options={}) - require 'fog/core/parser' @zerigo_email = options[:zerigo_email] @zerigo_token = options[:zerigo_token]