lib/phone_gap/build/credentials.rb in phone_gap-build-0.6.1 vs lib/phone_gap/build/credentials.rb in phone_gap-build-0.6.2
- old
+ new
@@ -15,15 +15,25 @@
@token = credentials[:token]
self
end
def load
- config_file = File.expand_path('../../../../config/phonegap.yml', __FILE__)
- if File.exists? config_file
+ if config_file && File.exists?(config_file)
@config = YAML::load_file(config_file)
@token = @config['token']
end
self
+ end
+
+ private
+
+ def config_file
+ if ENV['BUNDLE_GEMFILE']
+ application_root = ENV['BUNDLE_GEMFILE'].gsub('Gemfile', '')
+ File.expand_path(File.join(application_root, 'config', 'phonegap.yml'), __FILE__)
+ else
+ false
+ end
end
end
end
end