[SCM] ci-tooling packaging branch, master, updated. 35277096009b100c57e0ab254be94b0a2e2756f2
Harald Sitter
apachelogger-guest at moszumanska.debian.org
Mon Dec 7 12:57:50 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=57f281f
The following commit has been merged in the master branch:
commit 57f281fbedcee0704db418f07a5dd3ae263ff93e
Author: Harald Sitter <sitter at kde.org>
Date: Mon Dec 7 13:43:03 2015 +0100
dry token hash reading
---
lib/lp.rb | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/lib/lp.rb b/lib/lp.rb
index 0f67f45..30a8254 100644
--- a/lib/lp.rb
+++ b/lib/lp.rb
@@ -64,13 +64,18 @@ module Launchpad
conf
end
+ def self.token_from_file(file)
+ return nil unless File.exist?(file)
+ JSON.parse(File.read(file), symbolize_names: true)
+ end
+
# @!visibility private
# @note NOT thread safe
def self.token
# FIXME: @token is now unused
# FIXME: this should be moved to a method one presumes.
- return nil unless File.exist?(conf)
- token_hash = JSON.parse(File.read(conf), symbolize_names: true)
+ token_hash = token_from_file(conf)
+ return nil unless token_hash
site_options = { scheme: :header, site: 'https://api.launchpad.net' }
consumer_options = consumer_options.merge(site_options)
@@ -85,10 +90,8 @@ module Launchpad
# Fun story, during auth for some reason launchpad needs the flags in the
# body while at usage it only works with flags in the header...
- token_hash = {}
- if File.exist?(conf)
- token_hash = JSON.parse(File.read(conf), symbolize_names: true)
- else
+ token_hash = token_from_file(conf)
+ unless token_hash
site_options = { scheme: :header, site: 'https://api.launchpad.net' }
consumer_options = consumer_options.merge(site_options)
consumer = OAuth::Consumer.new('kubuntu-ci', '', consumer_options)
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list