From: Michal Fojtik <[email protected]>
Signed-off-by: Michal fojtik <[email protected]> --- server/config.ru | 3 +-- server/lib/cimi/helpers.rb | 5 ----- server/lib/deltacloud/core_ext.rb | 28 ++++++++++++++++++++++++++++ server/lib/deltacloud/helpers.rb | 5 ----- server/lib/ec2/helpers.rb | 9 ++------- 5 files changed, 31 insertions(+), 19 deletions(-) create mode 100644 server/lib/deltacloud/core_ext.rb diff --git a/server/config.ru b/server/config.ru index 5deff47..2b5697d 100644 --- a/server/config.ru +++ b/server/config.ru @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -# The default URL prefix (where to mount Deltacloud API) +load './lib/deltacloud/core_ext.rb' # The default driver is 'mock' ENV['API_DRIVER'] ||= 'mock' @@ -22,7 +22,6 @@ ENV['API_DRIVER'] ||= 'mock' # Set the API frontend use ('cimi' or 'deltacloud', default is 'deltacloud') ENV['API_FRONTEND'] ||= 'deltacloud' - # We need to set different API version and entrypoint location if ENV['API_FRONTEND'] == 'deltacloud' API_VERSION = "9.9.9" diff --git a/server/lib/cimi/helpers.rb b/server/lib/cimi/helpers.rb index 4535c39..a9a4926 100644 --- a/server/lib/cimi/helpers.rb +++ b/server/lib/cimi/helpers.rb @@ -25,11 +25,6 @@ require_relative '../deltacloud/helpers/assets_helper' require_relative '../deltacloud/helpers/deltacloud_helper' require_relative '../deltacloud/helpers/rabbit_helper' require_relative '../deltacloud/helpers/rabbit_helper' -require_relative '../deltacloud/core_ext/string' -require_relative '../deltacloud/core_ext/array' -require_relative '../deltacloud/core_ext/hash' -require_relative '../deltacloud/core_ext/integer' -require_relative '../deltacloud/core_ext/proc' require_relative './helpers/cimi_helper' require_relative './models' diff --git a/server/lib/deltacloud/core_ext.rb b/server/lib/deltacloud/core_ext.rb new file mode 100644 index 0000000..51a882a --- /dev/null +++ b/server/lib/deltacloud/core_ext.rb @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +unless Kernel.respond_to?(:require_relative) + module Kernel + def require_relative(path) + require File.join(File.dirname(caller[0]), path.to_str) + end + end +end + +require_relative './core_ext/string' +require_relative './core_ext/array' +require_relative './core_ext/hash' +require_relative './core_ext/integer' +require_relative './core_ext/proc' diff --git a/server/lib/deltacloud/helpers.rb b/server/lib/deltacloud/helpers.rb index 8e265fc..bc2ea98 100644 --- a/server/lib/deltacloud/helpers.rb +++ b/server/lib/deltacloud/helpers.rb @@ -19,11 +19,6 @@ require_relative 'helpers/url_helper' require_relative 'helpers/deltacloud_helper' require_relative 'helpers/rabbit_helper' require_relative 'helpers/blob_stream_helper' -require_relative 'core_ext/string' -require_relative 'core_ext/array' -require_relative 'core_ext/hash' -require_relative 'core_ext/integer' -require_relative 'core_ext/proc' module Deltacloud::Collections class Base < Sinatra::Base diff --git a/server/lib/ec2/helpers.rb b/server/lib/ec2/helpers.rb index 32380fa..d73ea47 100644 --- a/server/lib/ec2/helpers.rb +++ b/server/lib/ec2/helpers.rb @@ -18,12 +18,7 @@ module Deltacloud end require_relative './helpers/errors' -require_relative './helpers/convertor' - +require_relative './helpers/converter' require_relative '../deltacloud/helpers/driver_helper' require_relative '../deltacloud/helpers/auth_helper' -require_relative '../deltacloud/core_ext/string' -require_relative '../deltacloud/core_ext/array' -require_relative '../deltacloud/core_ext/hash' -require_relative '../deltacloud/core_ext/integer' -require_relative '../deltacloud/core_ext/proc' + -- 1.7.10.1
