Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only load necessary parts of right_aws via autoloading #121

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
4 changes: 4 additions & 0 deletions lib/acf/right_acf_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -547,3 +547,7 @@ def tagend(name)
end
end
end

require 'acf/right_acf_streaming_interface'
require 'acf/right_acf_origin_access_identities'
require 'acf/right_acf_invalidations'
11 changes: 9 additions & 2 deletions lib/awsbase/right_awsbase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,17 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

module Digest
autoload :MD5, 'digest/md5'
end

module REXML
autoload :Document, 'rexml/document'
autoload :Text, 'rexml/text'
end

# Test
module RightAws
require 'digest/md5'

class AwsUtils #:nodoc:
@@digest1 = OpenSSL::Digest::Digest.new("sha1")
@@digest256 = nil
Expand Down
13 changes: 13 additions & 0 deletions lib/ec2/right_ec2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -539,3 +539,16 @@ def reset
end

end

require 'ec2/right_ec2_images'
require 'ec2/right_ec2_instances'
require 'ec2/right_ec2_security_groups'
require 'ec2/right_ec2_spot_instances'
require 'ec2/right_ec2_ebs'
require 'ec2/right_ec2_reserved_instances'
require 'ec2/right_ec2_vpc'
require 'ec2/right_ec2_vpc2'
require 'ec2/right_ec2_monitoring'
require 'ec2/right_ec2_placement_groups'
require 'ec2/right_ec2_windows_mobility'
require 'ec2/right_ec2_tags'
5 changes: 5 additions & 0 deletions lib/iam/right_iam_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,8 @@ def reset
end

end

require 'iam/right_iam_groups'
require 'iam/right_iam_users'
require 'iam/right_iam_access_keys'
require 'iam/right_iam_mfa_devices'
60 changes: 20 additions & 40 deletions lib/right_aws.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,54 +27,34 @@
require 'time'
require "cgi"
require "base64"
require "rexml/document"
require "openssl"
require "digest/sha1"

require 'rubygems'
require 'right_http_connection'

$:.unshift(File.dirname(__FILE__))
require 'awsbase/version'
require 'awsbase/support'
require 'awsbase/benchmark_fix'
require 'awsbase/right_awsbase'
require 'ec2/right_ec2'
require 'ec2/right_ec2_images'
require 'ec2/right_ec2_instances'
require 'ec2/right_ec2_security_groups'
require 'ec2/right_ec2_spot_instances'
require 'ec2/right_ec2_ebs'
require 'ec2/right_ec2_reserved_instances'
require 'ec2/right_ec2_vpc'
require 'ec2/right_ec2_vpc2'
require 'ec2/right_ec2_monitoring'
require 'ec2/right_ec2_placement_groups'
require 'ec2/right_ec2_windows_mobility'
require 'ec2/right_ec2_tags'
require 'elb/right_elb_interface'
require 'emr/right_emr_interface'
require 'acw/right_acw_interface'
require 'as/right_as_interface'
require 's3/right_s3_interface'
require 's3/right_s3'
require 'sqs/right_sqs_interface'
require 'sqs/right_sqs'
require 'sqs/right_sqs_gen2_interface'
require 'sqs/right_sqs_gen2'
require 'sdb/right_sdb_interface'
require 'acf/right_acf_interface'
require 'acf/right_acf_streaming_interface'
require 'acf/right_acf_origin_access_identities'
require 'acf/right_acf_invalidations'
require 'rds/right_rds_interface'
require 'iam/right_iam_interface'
require 'iam/right_iam_groups'
require 'iam/right_iam_users'
require 'iam/right_iam_access_keys'
require 'iam/right_iam_mfa_devices'
require 'route_53/right_route_53_interface'
require 'sns/right_sns_interface'

module RightAws
autoload :AcfInterface, 'acf/right_acf_interface'
autoload :AcwInterface, 'acw/right_acw_interface'
autoload :AsInterface, 'as/right_as_interface'
autoload :Ec2, 'ec2/right_ec2'
autoload :ElbInterface, 'elb/right_elb_interface'
autoload :EmrInterface, 'emr/right_emr_interface'
autoload :IamInterface, 'iam/right_iam_interface'
autoload :RdsInterface, 'rds/right_rds_interface'
autoload :Route53Interface, 'route_53/right_route_53_interface'
autoload :S3, 's3/right_s3'
autoload :S3Interface, 's3/right_s3_interface'
autoload :SdbInterface, 'sdb/right_sdb_interface'
autoload :SnsInterface, 'sns/right_sns_interface'
autoload :Sqs, 'sqs/right_sqs'
autoload :SqsGen2, 'sqs/right_sqs_gen2'
autoload :SqsGen2Interface, 'sqs/right_sqs_gen2_interface'
autoload :SqsInterface, 'sqs/right_sqs_interface'
end

#-

Expand Down
41 changes: 41 additions & 0 deletions lib/right_aws/all.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#
# Copyright (c) 2011 RightScale Inc
#
# 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 the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

require 'right_aws'
require 'acf/right_acf_interface'
require 'acw/right_acw_interface'
require 'as/right_as_interface'
require 'ec2/right_ec2'
require 'elb/right_elb_interface'
require 'emr/right_emr_interface'
require 'iam/right_iam_interface'
require 'rds/right_rds_interface'
require 'route_53/right_route_53_interface'
require 's3/right_s3'
require 's3/right_s3_interface'
require 'sdb/right_sdb_interface'
require 'sns/right_sns_interface'
require 'sqs/right_sqs'
require 'sqs/right_sqs_gen2'
require 'sqs/right_sqs_gen2_interface'
require 'sqs/right_sqs_interface'