credentials_manager 0.15.1 → 0.16.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7aa6450b02a05cf3cd8ea07c390bf9df24f6152
4
- data.tar.gz: 269ec6a5a925266cfd86789f679a52a7ef657b27
3
+ metadata.gz: 6eee55d49f41c211199559e3d44365130b764dbd
4
+ data.tar.gz: 125ef8b4502e4a9e15871769298ef4ac4235cca5
5
5
  SHA512:
6
- metadata.gz: ce6a0c73ad2e691abab04d1401b83059078cdcaa8cfe91c34874037d9fcf8c8828eb81ff9e6c3701fb6dde1de596f9df5eec500602345e93426908ce8bee5535
7
- data.tar.gz: 56b068930c538d96859f698592391423aa10963f1f536c6759d81387148672108e52373778f493a4de380553eba1c4984ea4e1b2deec18cf4aaf3297756caa1f
6
+ metadata.gz: b4188b66c8c8e9bf4d90e132dbb4ae75112b2604a8f8583d6c67eb8cc06ec661add5d0c18ebbefb4be3d60e9474d2721de0023788b5687d2331492415df4291b
7
+ data.tar.gz: de5a4725b24bd66913193daa4777498752fb2fcdc98d44e15b58c647517b5f66b5e898ea3bf791a66599e4e3970398aa03436b0a4a6168a11d2009937afb73b3
data/README.md CHANGED
@@ -23,7 +23,7 @@ password has been deleted.
23
23
 
24
24
  ## Storing in the keychain
25
25
 
26
- By default, your Apple credentials are stored in the OS X Keychain.
26
+ By default, your Apple credentials are stored in the macOS Keychain.
27
27
 
28
28
  Your password is only stored locally on your computer.
29
29
 
@@ -8,4 +8,5 @@ require 'security'
8
8
  require 'highline/import' # to hide the entered password
9
9
 
10
10
  module CredentialsManager
11
+ ROOT = Pathname.new(File.expand_path('../..', __FILE__))
11
12
  end
@@ -3,7 +3,11 @@ require 'highline/import' # to hide the entered password
3
3
 
4
4
  module CredentialsManager
5
5
  class AccountManager
6
- def initialize(user: nil, password: nil)
6
+ # @param prefix [String] Very optional, is used for the
7
+ # iTunes Transporter which uses application specofic passwords
8
+ def initialize(user: nil, password: nil, prefix: nil)
9
+ @prefix = prefix || "deliver"
10
+
7
11
  @user = user
8
12
  @password = password
9
13
  end
@@ -16,9 +20,12 @@ module CredentialsManager
16
20
  return @user
17
21
  end
18
22
 
23
+ def fetch_password_from_env
24
+ ENV["FASTLANE_PASSWORD"] || ENV["DELIVER_PASSWORD"]
25
+ end
26
+
19
27
  def password(ask_if_missing: true)
20
- @password ||= ENV["FASTLANE_PASSWORD"]
21
- @password ||= ENV["DELIVER_PASSWORD"]
28
+ @password ||= fetch_password_from_env
22
29
  unless @password
23
30
  item = Security::InternetPassword.find(server: server_name)
24
31
  @password ||= item.password if item
@@ -32,6 +39,13 @@ module CredentialsManager
32
39
  # @return: Did the user decide to remove the old entry and enter a new password?
33
40
  def invalid_credentials(force: false)
34
41
  puts "The login credentials for '#{user}' seem to be wrong".red
42
+
43
+ if fetch_password_from_env
44
+ puts "The password was taken from the environment variable"
45
+ puts "Please make sure it is correct"
46
+ return false
47
+ end
48
+
35
49
  if force || agree("Do you want to re-enter your password? (y/n)", true)
36
50
  puts "Removing Keychain entry for user '#{user}'...".yellow
37
51
  remove_from_keychain
@@ -50,22 +64,28 @@ module CredentialsManager
50
64
  @password = nil
51
65
  end
52
66
 
67
+ def server_name
68
+ "#{@prefix}.#{user}"
69
+ end
70
+
53
71
  private
54
72
 
55
73
  def ask_for_login
56
74
  puts "-------------------------------------------------------------------------------------".green
57
75
  puts "The login information you enter will be stored in your Mac OS Keychain".green
58
- puts "You can also pass the password using the `FASTLANE_PASSWORD` env variable".green
76
+ puts "You can also pass the password using the `FASTLANE_PASSWORD` environment variable".green
59
77
  puts "More information about it on GitHub: https://github.com/fastlane/fastlane/tree/master/credentials_manager".green
60
78
  puts "-------------------------------------------------------------------------------------".green
61
79
 
62
80
  if @user.to_s.length == 0
81
+ raise "Missing username, and running in non-interactive shell" if $stdout.isatty == false
63
82
  @user = ask("Username: ") while @user.to_s.length == 0
64
83
  # we return here, as only the username was asked for now, we'll get called for the pw again anyway
65
84
  return
66
85
  end
67
86
 
68
87
  while @password.to_s.length == 0
88
+ raise "Missing password for user #{@user}, and running in non-interactive shell" if $stdout.isatty == false
69
89
  @password = ask("Password (for #{@user}): ") { |q| q.echo = "*" }
70
90
  end
71
91
 
@@ -80,9 +100,5 @@ module CredentialsManager
80
100
  return false
81
101
  end
82
102
  end
83
-
84
- def server_name
85
- "deliver.#{user}"
86
- end
87
103
  end
88
104
  end
@@ -1,8 +1,9 @@
1
1
  module CredentialsManager
2
2
  # Access the content of the app file (e.g. app identifier and Apple ID)
3
3
  class AppfileConfig
4
-
5
4
  def self.try_fetch_value(key)
5
+ # We need to load the file every time we call this method
6
+ # to support the `for_lane` keyword
6
7
  begin
7
8
  return self.new.data[key]
8
9
  rescue => ex
@@ -21,7 +22,7 @@ module CredentialsManager
21
22
 
22
23
  def initialize(path = nil)
23
24
  if path
24
- raise "Could not find Appfile at path '#{path}'".red unless File.exist?(path)
25
+ raise "Could not find Appfile at path '#{path}'".red unless File.exist?(File.expand_path(path))
25
26
  end
26
27
 
27
28
  path ||= self.class.default_path
@@ -42,12 +43,35 @@ module CredentialsManager
42
43
  # rubocop:disable Lint/Eval
43
44
  eval(content)
44
45
  # rubocop:enable Lint/Eval
46
+
47
+ print_debug_information(path: full_path) if $verbose
45
48
  end
46
49
  end
47
50
 
48
51
  fallback_to_default_values
49
52
  end
50
53
 
54
+ def print_debug_information(path: nil)
55
+ self.class.already_printed_debug_information ||= {}
56
+ return if self.class.already_printed_debug_information[self.data]
57
+ # self.class.already_printed_debug_information is a hash, we use to detect if we already printed this data
58
+ # this is necessary, as on the course of a fastlane run, the values might change, e.g. when using
59
+ # the `for_lane` keyword.
60
+
61
+ puts "Successfully loaded Appfile at path '#{path}'".yellow
62
+
63
+ self.data.each do |key, value|
64
+ puts "- #{key.to_s.cyan}: '#{value.to_s.green}'"
65
+ end
66
+ puts "-------"
67
+
68
+ self.class.already_printed_debug_information[self.data] = true
69
+ end
70
+
71
+ def self.already_printed_debug_information
72
+ @already_printed_debug_information ||= {}
73
+ end
74
+
51
75
  def fallback_to_default_values
52
76
  data[:apple_id] ||= ENV["FASTLANE_USER"] || ENV["DELIVER_USER"]
53
77
  end
@@ -1,3 +1,3 @@
1
1
  module CredentialsManager
2
- VERSION = "0.15.1"
2
+ VERSION = "0.16.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: credentials_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.16.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-19 00:00:00.000000000 Z
11
+ date: 2016-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "<"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: '12'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "<"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: '12'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: pry
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: 0.38.0
187
+ version: 0.44.0
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: 0.38.0
194
+ version: 0.44.0
195
195
  description: Password manager used in fastlane.tools
196
196
  email:
197
197
  - fastlane@krausefx.com
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  version: '0'
229
229
  requirements: []
230
230
  rubyforge_project:
231
- rubygems_version: 2.4.5.1
231
+ rubygems_version: 2.6.8
232
232
  signing_key:
233
233
  specification_version: 4
234
234
  summary: Password manager used in fastlane.tools