Skip to content

Commit

Permalink
Merge pull request #253 from Abdulwahaab710/master
Browse files Browse the repository at this point in the history
Updated outdated dependencies
  • Loading branch information
simon3z authored Jul 4, 2017
2 parents 2770480 + d774ff9 commit 1e7e4f4
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 26 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
language: ruby
rvm:
- "2.0"
- "2.1"
- "2.2"
- "2.3.0"
- "2.4.0"
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require 'rake/testtask'
require 'rubocop/rake_task'
require 'yaml'

task default: [:test, :rubocop] # same as .travis.yml
task default: %i[test rubocop] # same as .travis.yml

Rake::TestTask.new do |t|
t.libs << 'test'
Expand Down
11 changes: 6 additions & 5 deletions kubeclient.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# coding: utf-8

lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'kubeclient/version'
Expand All @@ -20,13 +21,13 @@ Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.0.0'

spec.add_development_dependency 'bundler', '~> 1.6'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rake', '~> 12.0'
spec.add_development_dependency 'minitest'
spec.add_development_dependency 'minitest-rg'
spec.add_development_dependency 'webmock', '~> 2.3.1'
spec.add_development_dependency 'webmock', '~> 3.0.1'
spec.add_development_dependency 'vcr'
spec.add_development_dependency 'rubocop', '= 0.47.1'
spec.add_development_dependency 'rubocop', '= 0.49.1'
spec.add_dependency 'rest-client'
spec.add_dependency 'recursive-open-struct', '~> 1.0.0'
spec.add_dependency 'http', '~> 2.0'
spec.add_dependency 'recursive-open-struct', '~> 1.0.4'
spec.add_dependency 'http', '~> 2.2.2'
end
8 changes: 4 additions & 4 deletions lib/kubeclient/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Kubeclient
# Common methods
# this is mixed in by other gems
module ClientMixin
ENTITY_METHODS = %w(get watch delete create update patch).freeze
ENTITY_METHODS = %w[get watch delete create update patch].freeze

DEFAULT_SSL_OPTIONS = {
client_cert: nil,
Expand Down Expand Up @@ -394,7 +394,7 @@ def watch_pod_log(pod_name, namespace, container: nil)
def proxy_url(kind, name, port, namespace = '')
discover unless @discovered
entity_name_plural =
if %w(services pods nodes).include?(kind.to_s)
if %w[services pods nodes].include?(kind.to_s)
kind.to_s
else
@entities[kind.to_s].resource_name
Expand Down Expand Up @@ -467,13 +467,13 @@ def validate_auth_options(opts)
# maintain backward compatibility:
opts[:username] = opts[:user] if opts[:user]

if [:bearer_token, :bearer_token_file, :username].count { |key| opts[key] } > 1
if %i[bearer_token bearer_token_file username].count { |key| opts[key] } > 1
raise(
ArgumentError,
'Invalid auth options: specify only one of username/password,' \
' bearer_token or bearer_token_file'
)
elsif [:username, :password].count { |key| opts[key] } == 1
elsif %i[username password].count { |key| opts[key] } == 1
raise ArgumentError, 'Basic auth requires both username & password'
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/kubeclient/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def fetch_user_auth_options(user)
if user.key?('token')
options[:bearer_token] = user['token']
else
%w(username password).each do |attr|
%w[username password].each do |attr|
options[attr.to_sym] = user[attr] if user.key?(attr)
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/test_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Unit tests for the common module
class CommonTest < MiniTest::Test
def test_underscore_entity
%w(
%w[
Pod pod
Service service
ReplicationController replication_controller
Expand All @@ -25,7 +25,7 @@ def test_underscore_entity
BuildConfig build_config
Image image
ImageStream image_stream
).each_slice(2) do |singular, plural|
].each_slice(2) do |singular, plural|
assert_equal(Kubeclient::ClientMixin.underscore_entity(singular), plural)
end
end
Expand Down
10 changes: 5 additions & 5 deletions test/test_kubeclient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,10 @@ def test_api_bearer_token_failure

def test_api_basic_auth_success
stub_request(:get, 'http://localhost:8080/api/v1')
.with(basic_auth: %w(username password))
.with(basic_auth: %w[username password])
.to_return(body: open_test_file('core_api_resource_list.json'), status: 200)
stub_request(:get, 'http://localhost:8080/api/v1/pods')
.with(basic_auth: %w(username password))
.with(basic_auth: %w[username password])
.to_return(body: open_test_file('pod_list.json'), status: 200)

client = Kubeclient::Client.new(
Expand All @@ -429,10 +429,10 @@ def test_api_basic_auth_success

def test_api_basic_auth_back_comp_success
stub_request(:get, 'http://localhost:8080/api/v1')
.with(basic_auth: %w(username password))
.with(basic_auth: %w[username password])
.to_return(body: open_test_file('core_api_resource_list.json'), status: 200)
stub_request(:get, 'http://localhost:8080/api/v1/pods')
.with(basic_auth: %w(username password))
.with(basic_auth: %w[username password])
.to_return(body: open_test_file('pod_list.json'), status: 200)

client = Kubeclient::Client.new(
Expand All @@ -452,7 +452,7 @@ def test_api_basic_auth_failure
response = OpenStruct.new(code: 401, message: '401 Unauthorized')

stub_request(:get, 'http://localhost:8080/api/v1')
.with(basic_auth: %w(username password))
.with(basic_auth: %w[username password])
.to_raise(Kubeclient::HttpError.new(401, error_message, response))

client = Kubeclient::Client.new(
Expand Down
12 changes: 6 additions & 6 deletions test/test_resource_list_without_kind.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ def test_get_from_json_api_v1
entity: 'pod',
type: 'Pod',
name: 'pods',
methods: %w(pod pods)
methods: %w[pod pods]
},
{
entity: 'node',
type: 'Node',
name: 'nodes',
methods: %w(node nodes)
methods: %w[node nodes]
},
{
entity: 'service',
type: 'Service',
name: 'services',
methods: %w(service services)
methods: %w[service services]
}
].each { |h| assert_entities(client.instance_variable_get(:@entities)[h[:entity]], h) }

Expand All @@ -49,19 +49,19 @@ def test_get_from_json_oapi_v1
entity: 'template',
type: 'Template',
name: 'templates',
methods: %w(template templates)
methods: %w[template templates]
},
{
entity: 'build',
type: 'Build',
name: 'builds',
methods: %w(build builds)
methods: %w[build builds]
},
{
entity: 'project',
type: 'Project',
name: 'projects',
methods: %w(project projects)
methods: %w[project projects]
}
].each { |h| assert_entities(client.instance_variable_get(:@entities)[h[:entity]], h) }

Expand Down

0 comments on commit 1e7e4f4

Please sign in to comment.