diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 6323724..3e0d254 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -13,13 +13,3 @@ Metrics/AbcSize: # Configuration parameters: CountComments. Metrics/MethodLength: Max: 13 - -# Offense count: 1 -# Cop supports --auto-correct. -Performance/ParallelAssignment: - Enabled: false - -# Offense count: 1 -# Cop supports --auto-correct. -Style/TrailingUnderscoreVariable: - Enabled: false diff --git a/.travis.yml b/.travis.yml index 939ced4..d479252 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +sudo: false language: ruby rvm: - 2.2 @@ -7,10 +8,24 @@ rvm: - rbx-2 - jruby script: "bundle exec rake" +addons: + apt: + packages: + - idn + - build-essential # this and below attempt allow rubinius to be setup ok + - bison + - ruby-dev + - rake zlib1g-dev + - libyaml-dev + - libssl-dev + - libreadline-dev + - libncurses5-dev + - llvm + - llvm-dev + - libeditline-dev + - libedit-dev before_install: - gem update bundler - - sudo apt-get update - - sudo apt-get install idn notifications: email: recipients: diff --git a/lib/googleauth/credentials_loader.rb b/lib/googleauth/credentials_loader.rb index 04d5fc0..0e5dfdf 100644 --- a/lib/googleauth/credentials_loader.rb +++ b/lib/googleauth/credentials_loader.rb @@ -91,7 +91,8 @@ module Google # # @param scope [string|array|nil] the scope(s) to access def from_well_known_path(scope = nil) - home_var, base = windows? ? 'APPDATA' : 'HOME', WELL_KNOWN_PATH + home_var = windows? ? 'APPDATA' : 'HOME' + base = WELL_KNOWN_PATH root = ENV[home_var].nil? ? '' : ENV[home_var] base = File.join('.config', base) unless windows? path = File.join(root, base) diff --git a/spec/googleauth/get_application_default_spec.rb b/spec/googleauth/get_application_default_spec.rb index 13fe861..26eda35 100644 --- a/spec/googleauth/get_application_default_spec.rb +++ b/spec/googleauth/get_application_default_spec.rb @@ -71,10 +71,10 @@ describe '#get_application_default' do { 'Metadata-Flavor' => 'Google' }, ''] end - end # GCE not detected + end # GCE not detected Dir.mktmpdir do |dir| ENV.delete(@var_name) unless ENV[@var_name].nil? # no env var - ENV['HOME'] = dir # no config present in this tmp dir + ENV['HOME'] = dir # no config present in this tmp dir c = Faraday.new do |b| b.adapter(:test, stubs) end @@ -127,10 +127,10 @@ describe '#get_application_default' do { 'Metadata-Flavor' => 'Google' }, ''] end - end # GCE detected + end # GCE detected Dir.mktmpdir do |dir| ENV.delete(@var_name) unless ENV[@var_name].nil? # no env var - ENV['HOME'] = dir # no config present in this tmp dir + ENV['HOME'] = dir # no config present in this tmp dir c = Faraday.new do |b| b.adapter(:test, stubs) end diff --git a/spec/googleauth/service_account_spec.rb b/spec/googleauth/service_account_spec.rb index ceda286..d8cf18f 100644 --- a/spec/googleauth/service_account_spec.rb +++ b/spec/googleauth/service_account_spec.rb @@ -54,7 +54,7 @@ shared_examples 'jwt header auth' do expect(hdr).to_not be_nil expect(hdr.start_with?(auth_prefix)).to be true authorization = hdr[auth_prefix.length..-1] - payload, _ = JWT.decode(authorization, @key.public_key) + payload, = JWT.decode(authorization, @key.public_key) expect(payload['aud']).to eq(test_uri) expect(payload['iss']).to eq(client_email) end