lib/preinstaller.rb in cocoapods-keys-2.0.0 vs lib/preinstaller.rb in cocoapods-keys-2.0.1

- old
+ new

@@ -40,12 +40,12 @@ # Add keys to the keyring that have been added, # and prompt for their value if needed. keys.each do |key| unless keyring.keychain_has_key?(key) - if ENV['CI'] - raise Informative, "CocoaPods-Keys could not find a key named: #{key}" + if ci? + raise Pod::Informative, "CocoaPods-Keys could not find a key named: #{key}" end unless has_shown_intro ui.puts "\n CocoaPods-Keys has detected a keys mismatch for your setup." has_shown_intro = true @@ -69,11 +69,11 @@ existing_keyring || !keys.empty? end def check_for_multiple_keyrings(project, current_dir) - if !ENV['TRAVIS'] && !ENV['TEAMCITY_VERSION'] && !ENV['CIRCLECI'] + unless ci? ui = Pod::UserInterface keyrings = KeyringLiberator.get_all_keyrings_named(project) if keyrings.count > 1 ui.puts "Found multiple keyrings for project #{project.inspect}, but" ui.puts "no match found for current path (#{current_dir}):" @@ -82,8 +82,15 @@ end ui.puts "\nPress enter to create a new keyring, or `ctrl + c` to cancel" ui.gets end end + end + + def ci? + %w([JENKINS_HOME TRAVIS CIRCLECI CI TEAMCITY_VERSION GO_PIPELINE_NAME bamboo_buildKey GITLAB_CI XCS]).each do |current| + return true if ENV.key?(current) + end + false end end end