lib/engineyard-metadata/outsider.rb in engineyard-metadata-0.0.6 vs lib/engineyard-metadata/outsider.rb in engineyard-metadata-0.0.7

- old
+ new

@@ -52,10 +52,12 @@ # this happens when we don't get any help from the user and the environment has been found based on the repository uri engine_yard_cloud_api.environment_name elsif ENV['EY_ENVIRONMENT_NAME'] ENV['EY_ENVIRONMENT_NAME'] end + raise RuntimeError, "[engineyard-metadata gem] You need to run this from the application repo, set EY::Metadata.environment_name= or set ENV['EY_ENVIRONMENT_NAME']" unless @environment_name.to_s.strip.length > 0 + @environment_name end def ey_cloud_token=(str) # clear this out in case it was inferred @repository_uri = nil @@ -68,13 +70,13 @@ def ey_cloud_token return @ey_cloud_token if @ey_cloud_token.is_a? String @ey_cloud_token = if ENV['EY_CLOUD_TOKEN'] ENV['EY_CLOUD_TOKEN'] elsif File.exist? eyrc_path - YAML.load(File.read(eyrc_path))['ey_cloud_token'] - else - raise RuntimeError, "[engineyard-metadata gem] You need to download #{eyrc_path} or set ENV['EY_CLOUD_TOKEN']" + YAML.load(File.read(eyrc_path))['api_token'] end + raise RuntimeError, "[engineyard-metadata gem] You need to have #{eyrc_path}, set EY::Metadata.ey_cloud_token= or set ENV['EY_CLOUD_TOKEN']" unless @ey_cloud_token.to_s.strip.length > 0 + @ey_cloud_token end # The URL that EngineYard has on file for your application. # # There's no setter for this because you should really use EY::Metadata.environment_name= or ENV['EY_ENVIRONMENT_NAME']