Sha256: 55dee851bab43ec077857098b920ffeda5ec2e72849ffa6ea5df371c9a379a7a

Contents?: true

Size: 948 Bytes

Versions: 1

Compression:

Stored size: 948 Bytes

Contents

module EY
  module Metadata
    # This gets pulled in when you're running from your developer machine (i.e., not on a cloud instance).
    module Outsider
      IMPOSSIBLE = KEYS.grep(/present/) + KEYS.grep(/password/) + KEYS.grep(/mysql/)
      
      POSSIBLE = KEYS - IMPOSSIBLE
      
      IMPOSSIBLE.each do |name|
        define_method name do
          raise CannotGetFromHere
        end
      end
      
      POSSIBLE.each do |name|
        define_method name do
          engine_yard_cloud_api.send name
        end
      end
      
      def eyrc_path
        File.join File.expand_path("~#{Etc.getpwuid.name}"), '.eyrc'
      end
      
      def git_config_path
        File.join Dir.pwd, '.git', 'config'
      end

      # An adapter that reads from the public EngineYard Cloud API (https://cloud.engineyard.com)
      def engine_yard_cloud_api
        @engine_yard_cloud_api ||= EngineYardCloudApi.new
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
engineyard-metadata-0.0.5 lib/engineyard-metadata/outsider.rb