[SCM] ci-tooling packaging branch, master, updated. 35277096009b100c57e0ab254be94b0a2e2756f2
Harald Sitter
apachelogger-guest at moszumanska.debian.org
Mon Dec 7 12:57:49 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=ee0643a
The following commit has been merged in the master branch:
commit ee0643a5b9e04e372cd03f3364eea70c7638b0d8
Author: Harald Sitter <sitter at kde.org>
Date: Mon Dec 7 13:37:39 2015 +0100
reduce option complexity
---
lib/lp.rb | 31 ++++++++++---------------------
1 file changed, 10 insertions(+), 21 deletions(-)
diff --git a/lib/lp.rb b/lib/lp.rb
index 818822d..dfb03c2 100644
--- a/lib/lp.rb
+++ b/lib/lp.rb
@@ -49,46 +49,35 @@ module Launchpad
@token = nil
@conf_path = ENV['HOME']
- # @!visibility private
- # @note NOT thread safe
- def self.token
- # FIXME: @token is now unused
- consumer_options = {
+ def self.consumer_options
+ {
signature_method: 'PLAINTEXT',
request_token_path: '/+request-token',
authorize_path: '/+authorize-token',
access_token_path: '/+access-token'
}
+ end
- token_hash = {}
+ # @!visibility private
+ # @note NOT thread safe
+ def self.token
+ # FIXME: @token is now unused
# FIXME: this should be moved to a method one presumes.
conf = "#{@conf_path}/tooling/confined/lp-tokens.json"
conf = "#{@conf_path}/.config/lp-tokens.json" unless File.exist?(conf)
- if File.exist?(conf)
- token_hash = JSON.parse(File.read(conf), symbolize_names: true)
- else
- return nil
- end
+ return nil unless File.exist?(conf)
+ token_hash = JSON.parse(File.read(conf), symbolize_names: true)
site_options = { scheme: :header, site: 'https://api.launchpad.net' }
consumer_options = consumer_options.merge(site_options)
consumer = OAuth::Consumer.new('kubuntu-ci', '', consumer_options)
- access_token = OAuth::AccessToken.from_hash(consumer, token_hash)
- @token = access_token
- @token
+ @token = OAuth::AccessToken.from_hash(consumer, token_hash)
end
# Get or load OAuth token.
# @note NOT thread safe
# @return [OAuth::AccessToken]
def self.authenticate
- consumer_options = {
- signature_method: 'PLAINTEXT',
- request_token_path: '/+request-token',
- authorize_path: '/+authorize-token',
- access_token_path: '/+access-token'
- }
-
# 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...
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list