dpl-scalingo 1.9.6.travis.2795.5 → 1.9.6.travis.2827.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dpl/provider/scalingo.rb +3 -32
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cee51114f7ce2ec934ecd5158a9cfcaaf7af0a755bd5e0bf72db06c9df56152d
4
- data.tar.gz: aa32d19e0005af56e072dda89c2113ddbc1ddabdb1cf1f9e6262a80e1a6beb2c
3
+ metadata.gz: 967ba70c710d6abba14dfc264fee3bb6db6933e42e824782c1f281bc11d48819
4
+ data.tar.gz: 93789fb47a8c7efa42ea6adaf6c73cc706f6f307b267f8b19de273e1ab212ca6
5
5
  SHA512:
6
- metadata.gz: 06c21d0e9042127ba2d1c70cc45e552de8890b7a47fe54b21a1e14d489e9b9d374def9a922f1c4a8bccae0a5db2d61222a06f000fc52556b35e313eb4f660fd3
7
- data.tar.gz: bef144ea6ed01a3bf84e14657b31951ea77361b39c66055f647410d676946dfcbe7a7f6ada1a1eb5a7fa5dc76bcb4c95916298faf8674a083d66300caa291a1f
6
+ metadata.gz: 315945bf1c66e4c57d640dbaf37387e2e5e4bec63ad01f931fd1557eb0265ef156bcadfee3114a284683be20c2a4471d6451f66eb1a639d1df926083452606e4
7
+ data.tar.gz: 5929f9fd676b59cd58151daf3c058607374476c2a3ffb7548bb1cdebac5413ca2eeffc78955ab3bb183fae28f2df173155b7cd22254ba7ebb21045e039aaca5c
@@ -25,38 +25,9 @@ module DPL
25
25
  end
26
26
 
27
27
  def check_auth
28
- if @options[:api_key]
29
- unless context.shell "mkdir -p ~/.config/scalingo"
30
- error "Couldn't create authentication file."
31
- end
32
- url = URI.parse('http://api.scalingo.com/v1/users/self')
33
- http = Net::HTTP.new(url.host, url.port)
34
- request = Net::HTTP::Get.new(url.request_uri)
35
- request.basic_auth("", @options[:api_key])
36
- request["Accept"] = "application/json"
37
- request["Content-type"] = "application/json"
38
- response = http.request(request)
39
- data = {}
40
- if File.exist?("#{Dir.home}/.config/scalingo/auth")
41
- data = JSON.parse(File.read("#{Dir.home}/.config/scalingo/auth"))
42
- end
43
- begin
44
- user = JSON.parse(response.body)
45
- rescue
46
- error "Invalid API token."
47
- end
48
- data["auth_config_data"] = {}
49
- data["auth_config_data"]["api.scalingo.com"] = {}
50
- data["auth_config_data"]["api.scalingo.com"]["id"] = user["user"]["id"]
51
- data["auth_config_data"]["api.scalingo.com"]["last_name"] = user["user"]["last_name"]
52
- data["auth_config_data"]["api.scalingo.com"]["username"] = user["user"]["username"]
53
- data["auth_config_data"]["api.scalingo.com"]["email"] = user["user"]["email"]
54
- data["auth_config_data"]["api.scalingo.com"]["first_name"] = user["user"]["first_name"]
55
- data["auth_config_data"]["api.scalingo.com"]["auth_token"] = @options[:api_key]
56
- data["last_update"] = DateTime.now
57
- f = File.open("#{Dir.home}/.config/scalingo/auth", "w+") {
58
- |f| f.write(data.to_json)
59
- }
28
+ token = @options[:api_key] || @options[:api_token]
29
+ if token
30
+ context.shell "timeout 2 ./scalingo login --api-token #{token} 2> /dev/null > /dev/null"
60
31
  elsif @options[:username] && @options[:password]
61
32
  context.shell "echo -e \"#{@options[:username]}\n#{@options[:password]}\" | timeout 2 ./scalingo login 2> /dev/null > /dev/null"
62
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dpl-scalingo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.6.travis.2795.5
4
+ version: 1.9.6.travis.2827.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-28 00:00:00.000000000 Z
11
+ date: 2018-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dpl
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.9.6.travis.2795.5
19
+ version: 1.9.6.travis.2827.6
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.9.6.travis.2795.5
26
+ version: 1.9.6.travis.2827.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement