[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=070a4f8

The following commit has been merged in the master branch:
commit 070a4f82c169386900d457a8d7ca5d02999bfdd5
Author: Harald Sitter <sitter at kde.org>
Date:   Mon Dec 7 13:44:56 2015 +0100

    refactor token request into own method
---
 lib/lp.rb | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/lib/lp.rb b/lib/lp.rb
index 30a8254..8449f3e 100644
--- a/lib/lp.rb
+++ b/lib/lp.rb
@@ -83,6 +83,19 @@ module Launchpad
     @token = OAuth::AccessToken.from_hash(consumer, token_hash)
   end
 
+  def self.request_token
+    site_options = { scheme: :header, site: 'https://api.launchpad.net' }
+    consumer_options = consumer_options.merge(site_options)
+    consumer = OAuth::Consumer.new('kubuntu-ci', '', consumer_options)
+    request_token = consumer.get_request_token(oauth_callback: '')
+    puts request_token.authorize_url(oauth_callback: '')
+    loop do
+      puts 'Type "done" and hit enter when done'
+      break if gets.strip == 'done'
+    end
+    request_token.get_access_token.params
+  end
+
   # Get or load OAuth token.
   # @note NOT thread safe
   # @return [OAuth::AccessToken]
@@ -92,19 +105,7 @@ module Launchpad
 
     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)
-      request_token = consumer.get_request_token(oauth_callback: '')
-      puts request_token.authorize_url(oauth_callback: '')
-      loop do
-        puts 'Type "done" and hit enter when done'
-        break if gets.strip == 'done'
-      end
-      access_token = request_token.get_access_token
-
-      # Get the hash, write to file.
-      token_hash = access_token.params
+      token_hash = request_token
       File.write(conf, JSON.fast_generate(token_hash))
     end
 

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list