chore: RuboCop lint Style/Globalvars (#943)

This commit is contained in:
Geoff Hubbard 2019-03-09 14:23:48 +01:00 committed by Mattia
parent c8c9a0217c
commit 6ff61c0ecc
2 changed files with 4 additions and 10 deletions

View File

@ -48,12 +48,6 @@ Style/Documentation:
- 'lib/faraday/response/raise_error.rb'
- 'lib/faraday/utils.rb'
# Offense count: 2
# Configuration parameters: AllowedVariables.
Style/GlobalVars:
Exclude:
- 'script/generate_certs'
# Offense count: 1
Style/MultipleComparison:
Exclude:

View File

@ -1,14 +1,14 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
# Usage: generate_certs
# Usage: generate_certs [options]
# options:
# -s Display shell exports that link env variables to filenames
# Generate test certs for testing Faraday with SSL
require 'openssl'
require 'fileutils'
$shell = ARGV.include? '-s'
# Adapted from WEBrick::Utils. Skips cert extensions so it
# can be used as a CA bundle
def create_self_signed_cert(bits, cname, _comment)
@ -29,7 +29,7 @@ end
def write(file, contents, env_var)
FileUtils.mkdir_p(File.dirname(file))
File.open(file, 'w') { |f| f.puts(contents) }
puts %(export #{env_var}="#{file}") if $shell
puts %(export #{env_var}="#{file}") if ARGV.include? '-s'
end
# One cert / CA for ease of testing when ignoring verification